Annotation of /trunk/kernel-alx/patches-5.4/0259-5.4.160-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(hide annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (18 months, 3 weeks ago) by niro
File size: 373034 byte(s)
Mon Oct 24 12:40:44 2022 UTC (18 months, 3 weeks ago) by niro
File size: 373034 byte(s)
-add missing
1 | niro | 3637 | diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
2 | index dbb68067ba4ea..b11e1fd95ee5f 100644 | ||
3 | --- a/Documentation/admin-guide/kernel-parameters.txt | ||
4 | +++ b/Documentation/admin-guide/kernel-parameters.txt | ||
5 | @@ -5480,6 +5480,13 @@ | ||
6 | as generic guest with no PV drivers. Currently support | ||
7 | XEN HVM, KVM, HYPER_V and VMWARE guest. | ||
8 | |||
9 | + xen.balloon_boot_timeout= [XEN] | ||
10 | + The time (in seconds) to wait before giving up to boot | ||
11 | + in case initial ballooning fails to free enough memory. | ||
12 | + Applies only when running as HVM or PVH guest and | ||
13 | + started with less memory configured than allowed at | ||
14 | + max. Default is 180. | ||
15 | + | ||
16 | xen.event_eoi_delay= [XEN] | ||
17 | How long to delay EOI handling in case of event | ||
18 | storms (jiffies). Default is 10. | ||
19 | diff --git a/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt b/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt | ||
20 | index 093edda0c8dfc..6cd83d920155f 100644 | ||
21 | --- a/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt | ||
22 | +++ b/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt | ||
23 | @@ -13,6 +13,14 @@ common regulator binding documented in: | ||
24 | |||
25 | |||
26 | Required properties of the main device node (the parent!): | ||
27 | + - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used | ||
28 | + for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines. | ||
29 | + | ||
30 | + [1] If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional | ||
31 | + property is specified, then all the eight voltage values for the | ||
32 | + 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified. | ||
33 | + | ||
34 | +Optional properties of the main device node (the parent!): | ||
35 | - s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV) | ||
36 | units for buck2 when changing voltage using gpio dvs. Refer to [1] below | ||
37 | for additional information. | ||
38 | @@ -25,26 +33,13 @@ Required properties of the main device node (the parent!): | ||
39 | units for buck4 when changing voltage using gpio dvs. Refer to [1] below | ||
40 | for additional information. | ||
41 | |||
42 | - - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used | ||
43 | - for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines. | ||
44 | - | ||
45 | - [1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional | ||
46 | - property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage' | ||
47 | - property should specify atleast one voltage level (which would be a | ||
48 | - safe operating voltage). | ||
49 | - | ||
50 | - If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional | ||
51 | - property is specified, then all the eight voltage values for the | ||
52 | - 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified. | ||
53 | - | ||
54 | -Optional properties of the main device node (the parent!): | ||
55 | - s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs. | ||
56 | - s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs. | ||
57 | - s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs. | ||
58 | |||
59 | Additional properties required if either of the optional properties are used: | ||
60 | |||
61 | - - s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from | ||
62 | + - s5m8767,pmic-buck-default-dvs-idx: Default voltage setting selected from | ||
63 | the possible 8 options selectable by the dvs gpios. The value of this | ||
64 | property should be between 0 and 7. If not specified or if out of range, the | ||
65 | default value of this property is set to 0. | ||
66 | diff --git a/Makefile b/Makefile | ||
67 | index 602b5167dacd7..e938662dab289 100644 | ||
68 | --- a/Makefile | ||
69 | +++ b/Makefile | ||
70 | @@ -1,7 +1,7 @@ | ||
71 | # SPDX-License-Identifier: GPL-2.0 | ||
72 | VERSION = 5 | ||
73 | PATCHLEVEL = 4 | ||
74 | -SUBLEVEL = 159 | ||
75 | +SUBLEVEL = 160 | ||
76 | EXTRAVERSION = | ||
77 | NAME = Kleptomaniac Octopus | ||
78 | |||
79 | diff --git a/arch/arm/Makefile b/arch/arm/Makefile | ||
80 | index 1fc32b611f8a4..4f098edfbf202 100644 | ||
81 | --- a/arch/arm/Makefile | ||
82 | +++ b/arch/arm/Makefile | ||
83 | @@ -66,15 +66,15 @@ KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra) | ||
84 | # Note that GCC does not numerically define an architecture version | ||
85 | # macro, but instead defines a whole series of macros which makes | ||
86 | # testing for a specific architecture or later rather impossible. | ||
87 | -arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m | ||
88 | -arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) | ||
89 | -arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) | ||
90 | +arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m | ||
91 | +arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 -march=armv7-a | ||
92 | +arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 -march=armv6 | ||
93 | # Only override the compiler option if ARMv6. The ARMv6K extensions are | ||
94 | # always available in ARMv7 | ||
95 | ifeq ($(CONFIG_CPU_32v6),y) | ||
96 | -arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k) | ||
97 | +arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 -march=armv6k | ||
98 | endif | ||
99 | -arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t) | ||
100 | +arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 -march=armv5te | ||
101 | arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t | ||
102 | arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4 | ||
103 | arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3m | ||
104 | @@ -88,7 +88,7 @@ tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7tdmi | ||
105 | tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi | ||
106 | tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi | ||
107 | tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi | ||
108 | -tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi) | ||
109 | +tune-$(CONFIG_CPU_ARM946E) =-mtune=arm9e | ||
110 | tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi | ||
111 | tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi | ||
112 | tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi | ||
113 | @@ -96,11 +96,11 @@ tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9tdmi | ||
114 | tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi | ||
115 | tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110 | ||
116 | tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100 | ||
117 | -tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale | ||
118 | -tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale | ||
119 | -tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale) | ||
120 | -tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) | ||
121 | -tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) | ||
122 | +tune-$(CONFIG_CPU_XSCALE) =-mtune=xscale | ||
123 | +tune-$(CONFIG_CPU_XSC3) =-mtune=xscale | ||
124 | +tune-$(CONFIG_CPU_FEROCEON) =-mtune=xscale | ||
125 | +tune-$(CONFIG_CPU_V6) =-mtune=arm1136j-s | ||
126 | +tune-$(CONFIG_CPU_V6K) =-mtune=arm1136j-s | ||
127 | |||
128 | # Evaluate tune cc-option calls now | ||
129 | tune-y := $(tune-y) | ||
130 | diff --git a/arch/arm/boot/dts/at91-tse850-3.dts b/arch/arm/boot/dts/at91-tse850-3.dts | ||
131 | index 3ca97b47c69ce..7e5c598e7e68f 100644 | ||
132 | --- a/arch/arm/boot/dts/at91-tse850-3.dts | ||
133 | +++ b/arch/arm/boot/dts/at91-tse850-3.dts | ||
134 | @@ -262,7 +262,7 @@ | ||
135 | &macb1 { | ||
136 | status = "okay"; | ||
137 | |||
138 | - phy-mode = "rgmii"; | ||
139 | + phy-mode = "rmii"; | ||
140 | |||
141 | #address-cells = <1>; | ||
142 | #size-cells = <0>; | ||
143 | diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi | ||
144 | index b6ef1a7ac8a4e..186b2af7743e3 100644 | ||
145 | --- a/arch/arm/boot/dts/omap3-gta04.dtsi | ||
146 | +++ b/arch/arm/boot/dts/omap3-gta04.dtsi | ||
147 | @@ -515,7 +515,7 @@ | ||
148 | compatible = "bosch,bma180"; | ||
149 | reg = <0x41>; | ||
150 | pinctrl-names = "default"; | ||
151 | - pintcrl-0 = <&bma180_pins>; | ||
152 | + pinctrl-0 = <&bma180_pins>; | ||
153 | interrupt-parent = <&gpio4>; | ||
154 | interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; /* GPIO_115 */ | ||
155 | }; | ||
156 | diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi | ||
157 | index 369e58f64145d..9de4f17955e31 100644 | ||
158 | --- a/arch/arm/boot/dts/qcom-msm8974.dtsi | ||
159 | +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi | ||
160 | @@ -1213,8 +1213,8 @@ | ||
161 | #phy-cells = <0>; | ||
162 | qcom,dsi-phy-index = <0>; | ||
163 | |||
164 | - clocks = <&mmcc MDSS_AHB_CLK>; | ||
165 | - clock-names = "iface"; | ||
166 | + clocks = <&mmcc MDSS_AHB_CLK>, <&xo_board>; | ||
167 | + clock-names = "iface", "ref"; | ||
168 | }; | ||
169 | }; | ||
170 | }; | ||
171 | diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi | ||
172 | index eca469a64a977..a687c024daa92 100644 | ||
173 | --- a/arch/arm/boot/dts/stm32mp157c.dtsi | ||
174 | +++ b/arch/arm/boot/dts/stm32mp157c.dtsi | ||
175 | @@ -773,7 +773,7 @@ | ||
176 | #sound-dai-cells = <0>; | ||
177 | |||
178 | compatible = "st,stm32-sai-sub-a"; | ||
179 | - reg = <0x4 0x1c>; | ||
180 | + reg = <0x4 0x20>; | ||
181 | clocks = <&rcc SAI1_K>; | ||
182 | clock-names = "sai_ck"; | ||
183 | dmas = <&dmamux1 87 0x400 0x01>; | ||
184 | @@ -783,7 +783,7 @@ | ||
185 | sai1b: audio-controller@4400a024 { | ||
186 | #sound-dai-cells = <0>; | ||
187 | compatible = "st,stm32-sai-sub-b"; | ||
188 | - reg = <0x24 0x1c>; | ||
189 | + reg = <0x24 0x20>; | ||
190 | clocks = <&rcc SAI1_K>; | ||
191 | clock-names = "sai_ck"; | ||
192 | dmas = <&dmamux1 88 0x400 0x01>; | ||
193 | @@ -804,7 +804,7 @@ | ||
194 | sai2a: audio-controller@4400b004 { | ||
195 | #sound-dai-cells = <0>; | ||
196 | compatible = "st,stm32-sai-sub-a"; | ||
197 | - reg = <0x4 0x1c>; | ||
198 | + reg = <0x4 0x20>; | ||
199 | clocks = <&rcc SAI2_K>; | ||
200 | clock-names = "sai_ck"; | ||
201 | dmas = <&dmamux1 89 0x400 0x01>; | ||
202 | @@ -814,7 +814,7 @@ | ||
203 | sai2b: audio-controller@4400b024 { | ||
204 | #sound-dai-cells = <0>; | ||
205 | compatible = "st,stm32-sai-sub-b"; | ||
206 | - reg = <0x24 0x1c>; | ||
207 | + reg = <0x24 0x20>; | ||
208 | clocks = <&rcc SAI2_K>; | ||
209 | clock-names = "sai_ck"; | ||
210 | dmas = <&dmamux1 90 0x400 0x01>; | ||
211 | @@ -835,7 +835,7 @@ | ||
212 | sai3a: audio-controller@4400c004 { | ||
213 | #sound-dai-cells = <0>; | ||
214 | compatible = "st,stm32-sai-sub-a"; | ||
215 | - reg = <0x04 0x1c>; | ||
216 | + reg = <0x04 0x20>; | ||
217 | clocks = <&rcc SAI3_K>; | ||
218 | clock-names = "sai_ck"; | ||
219 | dmas = <&dmamux1 113 0x400 0x01>; | ||
220 | @@ -845,7 +845,7 @@ | ||
221 | sai3b: audio-controller@4400c024 { | ||
222 | #sound-dai-cells = <0>; | ||
223 | compatible = "st,stm32-sai-sub-b"; | ||
224 | - reg = <0x24 0x1c>; | ||
225 | + reg = <0x24 0x20>; | ||
226 | clocks = <&rcc SAI3_K>; | ||
227 | clock-names = "sai_ck"; | ||
228 | dmas = <&dmamux1 114 0x400 0x01>; | ||
229 | @@ -1191,7 +1191,7 @@ | ||
230 | sai4a: audio-controller@50027004 { | ||
231 | #sound-dai-cells = <0>; | ||
232 | compatible = "st,stm32-sai-sub-a"; | ||
233 | - reg = <0x04 0x1c>; | ||
234 | + reg = <0x04 0x20>; | ||
235 | clocks = <&rcc SAI4_K>; | ||
236 | clock-names = "sai_ck"; | ||
237 | dmas = <&dmamux1 99 0x400 0x01>; | ||
238 | @@ -1201,7 +1201,7 @@ | ||
239 | sai4b: audio-controller@50027024 { | ||
240 | #sound-dai-cells = <0>; | ||
241 | compatible = "st,stm32-sai-sub-b"; | ||
242 | - reg = <0x24 0x1c>; | ||
243 | + reg = <0x24 0x20>; | ||
244 | clocks = <&rcc SAI4_K>; | ||
245 | clock-names = "sai_ck"; | ||
246 | dmas = <&dmamux1 100 0x400 0x01>; | ||
247 | diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | ||
248 | index 9ba62774e89a1..488933b87ad5a 100644 | ||
249 | --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | ||
250 | +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | ||
251 | @@ -112,7 +112,7 @@ | ||
252 | pinctrl-names = "default"; | ||
253 | pinctrl-0 = <&gmac_rgmii_pins>; | ||
254 | phy-handle = <&phy1>; | ||
255 | - phy-mode = "rgmii"; | ||
256 | + phy-mode = "rgmii-id"; | ||
257 | status = "okay"; | ||
258 | }; | ||
259 | |||
260 | diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c | ||
261 | index 76ea4178a55cb..db798eac74315 100644 | ||
262 | --- a/arch/arm/kernel/stacktrace.c | ||
263 | +++ b/arch/arm/kernel/stacktrace.c | ||
264 | @@ -54,8 +54,7 @@ int notrace unwind_frame(struct stackframe *frame) | ||
265 | |||
266 | frame->sp = frame->fp; | ||
267 | frame->fp = *(unsigned long *)(fp); | ||
268 | - frame->pc = frame->lr; | ||
269 | - frame->lr = *(unsigned long *)(fp + 4); | ||
270 | + frame->pc = *(unsigned long *)(fp + 4); | ||
271 | #else | ||
272 | /* check current frame pointer is within bounds */ | ||
273 | if (fp < low + 12 || fp > high - 4) | ||
274 | diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig | ||
275 | index 0ab3a86b1f523..fc388eb60e0b7 100644 | ||
276 | --- a/arch/arm/mm/Kconfig | ||
277 | +++ b/arch/arm/mm/Kconfig | ||
278 | @@ -752,7 +752,7 @@ config CPU_BIG_ENDIAN | ||
279 | config CPU_ENDIAN_BE8 | ||
280 | bool | ||
281 | depends on CPU_BIG_ENDIAN | ||
282 | - default CPU_V6 || CPU_V6K || CPU_V7 | ||
283 | + default CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M | ||
284 | help | ||
285 | Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors. | ||
286 | |||
287 | diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c | ||
288 | index ee943ac325560..538d5da741b09 100644 | ||
289 | --- a/arch/arm/mm/mmu.c | ||
290 | +++ b/arch/arm/mm/mmu.c | ||
291 | @@ -415,9 +415,9 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) | ||
292 | FIXADDR_END); | ||
293 | BUG_ON(idx >= __end_of_fixed_addresses); | ||
294 | |||
295 | - /* we only support device mappings until pgprot_kernel has been set */ | ||
296 | + /* We support only device mappings before pgprot_kernel is set. */ | ||
297 | if (WARN_ON(pgprot_val(prot) != pgprot_val(FIXMAP_PAGE_IO) && | ||
298 | - pgprot_val(pgprot_kernel) == 0)) | ||
299 | + pgprot_val(prot) && pgprot_val(pgprot_kernel) == 0)) | ||
300 | return; | ||
301 | |||
302 | if (pgprot_val(prot)) | ||
303 | diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | ||
304 | index c9fa23a565624..b8d9e92197ac8 100644 | ||
305 | --- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | ||
306 | +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | ||
307 | @@ -139,7 +139,7 @@ | ||
308 | regulator-min-microvolt = <721000>; | ||
309 | regulator-max-microvolt = <1022000>; | ||
310 | |||
311 | - vin-supply = <&dc_in>; | ||
312 | + pwm-supply = <&dc_in>; | ||
313 | |||
314 | pwms = <&pwm_AO_cd 1 1250 0>; | ||
315 | pwm-dutycycle-range = <100 0>; | ||
316 | diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts | ||
317 | index 2a324f0136e3f..02ec6eda03b1c 100644 | ||
318 | --- a/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts | ||
319 | +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts | ||
320 | @@ -139,7 +139,7 @@ | ||
321 | regulator-min-microvolt = <721000>; | ||
322 | regulator-max-microvolt = <1022000>; | ||
323 | |||
324 | - vin-supply = <&main_12v>; | ||
325 | + pwm-supply = <&main_12v>; | ||
326 | |||
327 | pwms = <&pwm_AO_cd 1 1250 0>; | ||
328 | pwm-dutycycle-range = <100 0>; | ||
329 | diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | ||
330 | index c48125bf9d1e3..5209c44fda01a 100644 | ||
331 | --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | ||
332 | +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | ||
333 | @@ -139,7 +139,7 @@ | ||
334 | regulator-min-microvolt = <721000>; | ||
335 | regulator-max-microvolt = <1022000>; | ||
336 | |||
337 | - vin-supply = <&dc_in>; | ||
338 | + pwm-supply = <&dc_in>; | ||
339 | |||
340 | pwms = <&pwm_AO_cd 1 1250 0>; | ||
341 | pwm-dutycycle-range = <100 0>; | ||
342 | diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi | ||
343 | index 44ad744c4710d..6ddb6b8c1fad5 100644 | ||
344 | --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi | ||
345 | +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi | ||
346 | @@ -555,7 +555,7 @@ | ||
347 | |||
348 | gpu: gpu@ff300000 { | ||
349 | compatible = "rockchip,rk3328-mali", "arm,mali-450"; | ||
350 | - reg = <0x0 0xff300000 0x0 0x40000>; | ||
351 | + reg = <0x0 0xff300000 0x0 0x30000>; | ||
352 | interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, | ||
353 | <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, | ||
354 | <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>, | ||
355 | diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h | ||
356 | index a92a187ec8919..3a057d4279007 100644 | ||
357 | --- a/arch/arm64/include/asm/pgtable.h | ||
358 | +++ b/arch/arm64/include/asm/pgtable.h | ||
359 | @@ -54,9 +54,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | ||
360 | * page table entry, taking care of 52-bit addresses. | ||
361 | */ | ||
362 | #ifdef CONFIG_ARM64_PA_BITS_52 | ||
363 | -#define __pte_to_phys(pte) \ | ||
364 | - ((pte_val(pte) & PTE_ADDR_LOW) | ((pte_val(pte) & PTE_ADDR_HIGH) << 36)) | ||
365 | -#define __phys_to_pte_val(phys) (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK) | ||
366 | +static inline phys_addr_t __pte_to_phys(pte_t pte) | ||
367 | +{ | ||
368 | + return (pte_val(pte) & PTE_ADDR_LOW) | | ||
369 | + ((pte_val(pte) & PTE_ADDR_HIGH) << 36); | ||
370 | +} | ||
371 | +static inline pteval_t __phys_to_pte_val(phys_addr_t phys) | ||
372 | +{ | ||
373 | + return (phys | (phys >> 36)) & PTE_ADDR_MASK; | ||
374 | +} | ||
375 | #else | ||
376 | #define __pte_to_phys(pte) (pte_val(pte) & PTE_ADDR_MASK) | ||
377 | #define __phys_to_pte_val(phys) (phys) | ||
378 | diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c | ||
379 | index afc7d41347f73..a343677837c77 100644 | ||
380 | --- a/arch/arm64/net/bpf_jit_comp.c | ||
381 | +++ b/arch/arm64/net/bpf_jit_comp.c | ||
382 | @@ -996,6 +996,11 @@ out: | ||
383 | return prog; | ||
384 | } | ||
385 | |||
386 | +u64 bpf_jit_alloc_exec_limit(void) | ||
387 | +{ | ||
388 | + return BPF_JIT_REGION_SIZE; | ||
389 | +} | ||
390 | + | ||
391 | void *bpf_jit_alloc_exec(unsigned long size) | ||
392 | { | ||
393 | return __vmalloc_node_range(size, PAGE_SIZE, BPF_JIT_REGION_START, | ||
394 | diff --git a/arch/ia64/Kconfig.debug b/arch/ia64/Kconfig.debug | ||
395 | index 40ca23bd228d6..2ce008e2d1644 100644 | ||
396 | --- a/arch/ia64/Kconfig.debug | ||
397 | +++ b/arch/ia64/Kconfig.debug | ||
398 | @@ -39,7 +39,7 @@ config DISABLE_VHPT | ||
399 | |||
400 | config IA64_DEBUG_CMPXCHG | ||
401 | bool "Turn on compare-and-exchange bug checking (slow!)" | ||
402 | - depends on DEBUG_KERNEL | ||
403 | + depends on DEBUG_KERNEL && PRINTK | ||
404 | help | ||
405 | Selecting this option turns on bug checking for the IA-64 | ||
406 | compare-and-exchange instructions. This is slow! Itaniums | ||
407 | diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c | ||
408 | index b3dc39050c1ad..8a223d0e4918c 100644 | ||
409 | --- a/arch/ia64/kernel/kprobes.c | ||
410 | +++ b/arch/ia64/kernel/kprobes.c | ||
411 | @@ -398,7 +398,8 @@ static void kretprobe_trampoline(void) | ||
412 | |||
413 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | ||
414 | { | ||
415 | - regs->cr_iip = __kretprobe_trampoline_handler(regs, kretprobe_trampoline, NULL); | ||
416 | + regs->cr_iip = __kretprobe_trampoline_handler(regs, | ||
417 | + dereference_function_descriptor(kretprobe_trampoline), NULL); | ||
418 | /* | ||
419 | * By returning a non-zero value, we are telling | ||
420 | * kprobe_handler() that we don't want the post_handler | ||
421 | @@ -414,7 +415,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | ||
422 | ri->fp = NULL; | ||
423 | |||
424 | /* Replace the return addr with trampoline addr */ | ||
425 | - regs->b0 = ((struct fnptr *)kretprobe_trampoline)->ip; | ||
426 | + regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline); | ||
427 | } | ||
428 | |||
429 | /* Check the instruction in the slot is break */ | ||
430 | @@ -918,14 +919,14 @@ static struct kprobe trampoline_p = { | ||
431 | int __init arch_init_kprobes(void) | ||
432 | { | ||
433 | trampoline_p.addr = | ||
434 | - (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip; | ||
435 | + dereference_function_descriptor(kretprobe_trampoline); | ||
436 | return register_kprobe(&trampoline_p); | ||
437 | } | ||
438 | |||
439 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
440 | { | ||
441 | if (p->addr == | ||
442 | - (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip) | ||
443 | + dereference_function_descriptor(kretprobe_trampoline)) | ||
444 | return 1; | ||
445 | |||
446 | return 0; | ||
447 | diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine | ||
448 | index 1bbe0dd0c4fe5..b88a980f56f8a 100644 | ||
449 | --- a/arch/m68k/Kconfig.machine | ||
450 | +++ b/arch/m68k/Kconfig.machine | ||
451 | @@ -190,6 +190,7 @@ config INIT_LCD | ||
452 | config MEMORY_RESERVE | ||
453 | int "Memory reservation (MiB)" | ||
454 | depends on (UCSIMM || UCDIMM) | ||
455 | + default 0 | ||
456 | help | ||
457 | Reserve certain memory regions on 68x328 based boards. | ||
458 | |||
459 | diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig | ||
460 | index 2bfef67d52c63..041d34975ea2c 100644 | ||
461 | --- a/arch/mips/Kconfig | ||
462 | +++ b/arch/mips/Kconfig | ||
463 | @@ -1393,6 +1393,7 @@ config CPU_LOONGSON3 | ||
464 | select WEAK_REORDERING_BEYOND_LLSC | ||
465 | select MIPS_PGD_C0_CONTEXT | ||
466 | select MIPS_L1_CACHE_SHIFT_6 | ||
467 | + select MIPS_FP_SUPPORT | ||
468 | select GPIOLIB | ||
469 | select SWIOTLB | ||
470 | help | ||
471 | diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h | ||
472 | index aeae2effa123d..23c67c0871b17 100644 | ||
473 | --- a/arch/mips/include/asm/mips-cm.h | ||
474 | +++ b/arch/mips/include/asm/mips-cm.h | ||
475 | @@ -11,6 +11,7 @@ | ||
476 | #ifndef __MIPS_ASM_MIPS_CM_H__ | ||
477 | #define __MIPS_ASM_MIPS_CM_H__ | ||
478 | |||
479 | +#include <linux/bitfield.h> | ||
480 | #include <linux/bitops.h> | ||
481 | #include <linux/errno.h> | ||
482 | |||
483 | @@ -153,8 +154,8 @@ GCR_ACCESSOR_RO(32, 0x030, rev) | ||
484 | #define CM_GCR_REV_MINOR GENMASK(7, 0) | ||
485 | |||
486 | #define CM_ENCODE_REV(major, minor) \ | ||
487 | - (((major) << __ffs(CM_GCR_REV_MAJOR)) | \ | ||
488 | - ((minor) << __ffs(CM_GCR_REV_MINOR))) | ||
489 | + (FIELD_PREP(CM_GCR_REV_MAJOR, major) | \ | ||
490 | + FIELD_PREP(CM_GCR_REV_MINOR, minor)) | ||
491 | |||
492 | #define CM_REV_CM2 CM_ENCODE_REV(6, 0) | ||
493 | #define CM_REV_CM2_5 CM_ENCODE_REV(7, 0) | ||
494 | @@ -362,10 +363,10 @@ static inline int mips_cm_revision(void) | ||
495 | static inline unsigned int mips_cm_max_vp_width(void) | ||
496 | { | ||
497 | extern int smp_num_siblings; | ||
498 | - uint32_t cfg; | ||
499 | |||
500 | if (mips_cm_revision() >= CM_REV_CM3) | ||
501 | - return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW; | ||
502 | + return FIELD_GET(CM_GCR_SYS_CONFIG2_MAXVPW, | ||
503 | + read_gcr_sys_config2()); | ||
504 | |||
505 | if (mips_cm_present()) { | ||
506 | /* | ||
507 | @@ -373,8 +374,7 @@ static inline unsigned int mips_cm_max_vp_width(void) | ||
508 | * number of VP(E)s, and if that ever changes then this will | ||
509 | * need revisiting. | ||
510 | */ | ||
511 | - cfg = read_gcr_cl_config() & CM_GCR_Cx_CONFIG_PVPE; | ||
512 | - return (cfg >> __ffs(CM_GCR_Cx_CONFIG_PVPE)) + 1; | ||
513 | + return FIELD_GET(CM_GCR_Cx_CONFIG_PVPE, read_gcr_cl_config()) + 1; | ||
514 | } | ||
515 | |||
516 | if (IS_ENABLED(CONFIG_SMP)) | ||
517 | diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c | ||
518 | index a9eab83d9148d..611ef512c0b81 100644 | ||
519 | --- a/arch/mips/kernel/mips-cm.c | ||
520 | +++ b/arch/mips/kernel/mips-cm.c | ||
521 | @@ -179,8 +179,7 @@ static void mips_cm_probe_l2sync(void) | ||
522 | phys_addr_t addr; | ||
523 | |||
524 | /* L2-only sync was introduced with CM major revision 6 */ | ||
525 | - major_rev = (read_gcr_rev() & CM_GCR_REV_MAJOR) >> | ||
526 | - __ffs(CM_GCR_REV_MAJOR); | ||
527 | + major_rev = FIELD_GET(CM_GCR_REV_MAJOR, read_gcr_rev()); | ||
528 | if (major_rev < 6) | ||
529 | return; | ||
530 | |||
531 | @@ -263,13 +262,13 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core, | ||
532 | preempt_disable(); | ||
533 | |||
534 | if (cm_rev >= CM_REV_CM3) { | ||
535 | - val = core << __ffs(CM3_GCR_Cx_OTHER_CORE); | ||
536 | - val |= vp << __ffs(CM3_GCR_Cx_OTHER_VP); | ||
537 | + val = FIELD_PREP(CM3_GCR_Cx_OTHER_CORE, core) | | ||
538 | + FIELD_PREP(CM3_GCR_Cx_OTHER_VP, vp); | ||
539 | |||
540 | if (cm_rev >= CM_REV_CM3_5) { | ||
541 | val |= CM_GCR_Cx_OTHER_CLUSTER_EN; | ||
542 | - val |= cluster << __ffs(CM_GCR_Cx_OTHER_CLUSTER); | ||
543 | - val |= block << __ffs(CM_GCR_Cx_OTHER_BLOCK); | ||
544 | + val |= FIELD_PREP(CM_GCR_Cx_OTHER_CLUSTER, cluster); | ||
545 | + val |= FIELD_PREP(CM_GCR_Cx_OTHER_BLOCK, block); | ||
546 | } else { | ||
547 | WARN_ON(cluster != 0); | ||
548 | WARN_ON(block != CM_GCR_Cx_OTHER_BLOCK_LOCAL); | ||
549 | @@ -299,7 +298,7 @@ void mips_cm_lock_other(unsigned int cluster, unsigned int core, | ||
550 | spin_lock_irqsave(&per_cpu(cm_core_lock, curr_core), | ||
551 | per_cpu(cm_core_lock_flags, curr_core)); | ||
552 | |||
553 | - val = core << __ffs(CM_GCR_Cx_OTHER_CORENUM); | ||
554 | + val = FIELD_PREP(CM_GCR_Cx_OTHER_CORENUM, core); | ||
555 | } | ||
556 | |||
557 | write_gcr_cl_other(val); | ||
558 | @@ -343,8 +342,8 @@ void mips_cm_error_report(void) | ||
559 | cm_other = read_gcr_error_mult(); | ||
560 | |||
561 | if (revision < CM_REV_CM3) { /* CM2 */ | ||
562 | - cause = cm_error >> __ffs(CM_GCR_ERROR_CAUSE_ERRTYPE); | ||
563 | - ocause = cm_other >> __ffs(CM_GCR_ERROR_MULT_ERR2ND); | ||
564 | + cause = FIELD_GET(CM_GCR_ERROR_CAUSE_ERRTYPE, cm_error); | ||
565 | + ocause = FIELD_GET(CM_GCR_ERROR_MULT_ERR2ND, cm_other); | ||
566 | |||
567 | if (!cause) | ||
568 | return; | ||
569 | @@ -386,8 +385,8 @@ void mips_cm_error_report(void) | ||
570 | ulong core_id_bits, vp_id_bits, cmd_bits, cmd_group_bits; | ||
571 | ulong cm3_cca_bits, mcp_bits, cm3_tr_bits, sched_bit; | ||
572 | |||
573 | - cause = cm_error >> __ffs64(CM3_GCR_ERROR_CAUSE_ERRTYPE); | ||
574 | - ocause = cm_other >> __ffs(CM_GCR_ERROR_MULT_ERR2ND); | ||
575 | + cause = FIELD_GET(CM3_GCR_ERROR_CAUSE_ERRTYPE, cm_error); | ||
576 | + ocause = FIELD_GET(CM_GCR_ERROR_MULT_ERR2ND, cm_other); | ||
577 | |||
578 | if (!cause) | ||
579 | return; | ||
580 | diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S | ||
581 | index 12e58053544fc..cbf6db98cfb38 100644 | ||
582 | --- a/arch/mips/kernel/r2300_fpu.S | ||
583 | +++ b/arch/mips/kernel/r2300_fpu.S | ||
584 | @@ -29,8 +29,8 @@ | ||
585 | #define EX2(a,b) \ | ||
586 | 9: a,##b; \ | ||
587 | .section __ex_table,"a"; \ | ||
588 | - PTR 9b,bad_stack; \ | ||
589 | - PTR 9b+4,bad_stack; \ | ||
590 | + PTR 9b,fault; \ | ||
591 | + PTR 9b+4,fault; \ | ||
592 | .previous | ||
593 | |||
594 | .set mips1 | ||
595 | diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c | ||
596 | index 3f16f38230310..9a28e79f2e66e 100644 | ||
597 | --- a/arch/mips/kernel/syscall.c | ||
598 | +++ b/arch/mips/kernel/syscall.c | ||
599 | @@ -239,12 +239,3 @@ SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op) | ||
600 | { | ||
601 | return -ENOSYS; | ||
602 | } | ||
603 | - | ||
604 | -/* | ||
605 | - * If we ever come here the user sp is bad. Zap the process right away. | ||
606 | - * Due to the bad stack signaling wouldn't work. | ||
607 | - */ | ||
608 | -asmlinkage void bad_stack(void) | ||
609 | -{ | ||
610 | - do_exit(SIGSEGV); | ||
611 | -} | ||
612 | diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c | ||
613 | index aeb1b989cd4ee..e45077aecf83a 100644 | ||
614 | --- a/arch/mips/lantiq/xway/dma.c | ||
615 | +++ b/arch/mips/lantiq/xway/dma.c | ||
616 | @@ -11,6 +11,7 @@ | ||
617 | #include <linux/export.h> | ||
618 | #include <linux/spinlock.h> | ||
619 | #include <linux/clk.h> | ||
620 | +#include <linux/delay.h> | ||
621 | #include <linux/err.h> | ||
622 | |||
623 | #include <lantiq_soc.h> | ||
624 | @@ -29,6 +30,7 @@ | ||
625 | #define LTQ_DMA_PCTRL 0x44 | ||
626 | #define LTQ_DMA_IRNEN 0xf4 | ||
627 | |||
628 | +#define DMA_ID_CHNR GENMASK(26, 20) /* channel number */ | ||
629 | #define DMA_DESCPT BIT(3) /* descriptor complete irq */ | ||
630 | #define DMA_TX BIT(8) /* TX channel direction */ | ||
631 | #define DMA_CHAN_ON BIT(0) /* channel on / off bit */ | ||
632 | @@ -39,7 +41,6 @@ | ||
633 | #define DMA_POLL BIT(31) /* turn on channel polling */ | ||
634 | #define DMA_CLK_DIV4 BIT(6) /* polling clock divider */ | ||
635 | #define DMA_2W_BURST BIT(1) /* 2 word burst length */ | ||
636 | -#define DMA_MAX_CHANNEL 20 /* the soc has 20 channels */ | ||
637 | #define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */ | ||
638 | #define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */ | ||
639 | |||
640 | @@ -205,7 +206,7 @@ ltq_dma_init(struct platform_device *pdev) | ||
641 | { | ||
642 | struct clk *clk; | ||
643 | struct resource *res; | ||
644 | - unsigned id; | ||
645 | + unsigned int id, nchannels; | ||
646 | int i; | ||
647 | |||
648 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
649 | @@ -221,21 +222,24 @@ ltq_dma_init(struct platform_device *pdev) | ||
650 | clk_enable(clk); | ||
651 | ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL); | ||
652 | |||
653 | + usleep_range(1, 10); | ||
654 | + | ||
655 | /* disable all interrupts */ | ||
656 | ltq_dma_w32(0, LTQ_DMA_IRNEN); | ||
657 | |||
658 | /* reset/configure each channel */ | ||
659 | - for (i = 0; i < DMA_MAX_CHANNEL; i++) { | ||
660 | + id = ltq_dma_r32(LTQ_DMA_ID); | ||
661 | + nchannels = ((id & DMA_ID_CHNR) >> 20); | ||
662 | + for (i = 0; i < nchannels; i++) { | ||
663 | ltq_dma_w32(i, LTQ_DMA_CS); | ||
664 | ltq_dma_w32(DMA_CHAN_RST, LTQ_DMA_CCTRL); | ||
665 | ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL); | ||
666 | ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL); | ||
667 | } | ||
668 | |||
669 | - id = ltq_dma_r32(LTQ_DMA_ID); | ||
670 | dev_info(&pdev->dev, | ||
671 | "Init done - hw rev: %X, ports: %d, channels: %d\n", | ||
672 | - id & 0x1f, (id >> 16) & 0xf, id >> 20); | ||
673 | + id & 0x1f, (id >> 16) & 0xf, nchannels); | ||
674 | |||
675 | return 0; | ||
676 | } | ||
677 | diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S | ||
678 | index 873bf3434da94..7d14e9ae18fb1 100644 | ||
679 | --- a/arch/parisc/kernel/entry.S | ||
680 | +++ b/arch/parisc/kernel/entry.S | ||
681 | @@ -1841,7 +1841,7 @@ syscall_restore: | ||
682 | LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 | ||
683 | |||
684 | /* Are we being ptraced? */ | ||
685 | - ldw TASK_FLAGS(%r1),%r19 | ||
686 | + LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 | ||
687 | ldi _TIF_SYSCALL_TRACE_MASK,%r2 | ||
688 | and,COND(=) %r19,%r2,%r0 | ||
689 | b,n syscall_restore_rfi | ||
690 | diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c | ||
691 | index e202c37e56af3..9997465c11820 100644 | ||
692 | --- a/arch/parisc/kernel/smp.c | ||
693 | +++ b/arch/parisc/kernel/smp.c | ||
694 | @@ -29,6 +29,7 @@ | ||
695 | #include <linux/bitops.h> | ||
696 | #include <linux/ftrace.h> | ||
697 | #include <linux/cpu.h> | ||
698 | +#include <linux/kgdb.h> | ||
699 | |||
700 | #include <linux/atomic.h> | ||
701 | #include <asm/current.h> | ||
702 | @@ -71,7 +72,10 @@ enum ipi_message_type { | ||
703 | IPI_CALL_FUNC, | ||
704 | IPI_CPU_START, | ||
705 | IPI_CPU_STOP, | ||
706 | - IPI_CPU_TEST | ||
707 | + IPI_CPU_TEST, | ||
708 | +#ifdef CONFIG_KGDB | ||
709 | + IPI_ENTER_KGDB, | ||
710 | +#endif | ||
711 | }; | ||
712 | |||
713 | |||
714 | @@ -169,7 +173,12 @@ ipi_interrupt(int irq, void *dev_id) | ||
715 | case IPI_CPU_TEST: | ||
716 | smp_debug(100, KERN_DEBUG "CPU%d is alive!\n", this_cpu); | ||
717 | break; | ||
718 | - | ||
719 | +#ifdef CONFIG_KGDB | ||
720 | + case IPI_ENTER_KGDB: | ||
721 | + smp_debug(100, KERN_DEBUG "CPU%d ENTER_KGDB\n", this_cpu); | ||
722 | + kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); | ||
723 | + break; | ||
724 | +#endif | ||
725 | default: | ||
726 | printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n", | ||
727 | this_cpu, which); | ||
728 | @@ -225,6 +234,12 @@ send_IPI_allbutself(enum ipi_message_type op) | ||
729 | } | ||
730 | } | ||
731 | |||
732 | +#ifdef CONFIG_KGDB | ||
733 | +void kgdb_roundup_cpus(void) | ||
734 | +{ | ||
735 | + send_IPI_allbutself(IPI_ENTER_KGDB); | ||
736 | +} | ||
737 | +#endif | ||
738 | |||
739 | inline void | ||
740 | smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); } | ||
741 | diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c | ||
742 | index 87ae476d1c4f5..86a57fb0e6fae 100644 | ||
743 | --- a/arch/parisc/kernel/unwind.c | ||
744 | +++ b/arch/parisc/kernel/unwind.c | ||
745 | @@ -21,6 +21,8 @@ | ||
746 | #include <asm/ptrace.h> | ||
747 | |||
748 | #include <asm/unwind.h> | ||
749 | +#include <asm/switch_to.h> | ||
750 | +#include <asm/sections.h> | ||
751 | |||
752 | /* #define DEBUG 1 */ | ||
753 | #ifdef DEBUG | ||
754 | @@ -203,6 +205,11 @@ int __init unwind_init(void) | ||
755 | return 0; | ||
756 | } | ||
757 | |||
758 | +static bool pc_is_kernel_fn(unsigned long pc, void *fn) | ||
759 | +{ | ||
760 | + return (unsigned long)dereference_kernel_function_descriptor(fn) == pc; | ||
761 | +} | ||
762 | + | ||
763 | static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int frame_size) | ||
764 | { | ||
765 | /* | ||
766 | @@ -221,7 +228,7 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int | ||
767 | extern void * const _call_on_stack; | ||
768 | #endif /* CONFIG_IRQSTACKS */ | ||
769 | |||
770 | - if (pc == (unsigned long) &handle_interruption) { | ||
771 | + if (pc_is_kernel_fn(pc, handle_interruption)) { | ||
772 | struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size - PT_SZ_ALGN); | ||
773 | dbg("Unwinding through handle_interruption()\n"); | ||
774 | info->prev_sp = regs->gr[30]; | ||
775 | @@ -229,13 +236,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int | ||
776 | return 1; | ||
777 | } | ||
778 | |||
779 | - if (pc == (unsigned long) &ret_from_kernel_thread || | ||
780 | - pc == (unsigned long) &syscall_exit) { | ||
781 | + if (pc_is_kernel_fn(pc, ret_from_kernel_thread) || | ||
782 | + pc_is_kernel_fn(pc, syscall_exit)) { | ||
783 | info->prev_sp = info->prev_ip = 0; | ||
784 | return 1; | ||
785 | } | ||
786 | |||
787 | - if (pc == (unsigned long) &intr_return) { | ||
788 | + if (pc_is_kernel_fn(pc, intr_return)) { | ||
789 | struct pt_regs *regs; | ||
790 | |||
791 | dbg("Found intr_return()\n"); | ||
792 | @@ -246,20 +253,20 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int | ||
793 | return 1; | ||
794 | } | ||
795 | |||
796 | - if (pc == (unsigned long) &_switch_to_ret) { | ||
797 | + if (pc_is_kernel_fn(pc, _switch_to) || | ||
798 | + pc_is_kernel_fn(pc, _switch_to_ret)) { | ||
799 | info->prev_sp = info->sp - CALLEE_SAVE_FRAME_SIZE; | ||
800 | info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET); | ||
801 | return 1; | ||
802 | } | ||
803 | |||
804 | #ifdef CONFIG_IRQSTACKS | ||
805 | - if (pc == (unsigned long) &_call_on_stack) { | ||
806 | + if (pc_is_kernel_fn(pc, _call_on_stack)) { | ||
807 | info->prev_sp = *(unsigned long *)(info->sp - FRAME_SIZE - REG_SZ); | ||
808 | info->prev_ip = *(unsigned long *)(info->sp - FRAME_SIZE - RP_OFFSET); | ||
809 | return 1; | ||
810 | } | ||
811 | #endif | ||
812 | - | ||
813 | return 0; | ||
814 | } | ||
815 | |||
816 | diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S | ||
817 | index 99cd24f2ea01b..164483b37d854 100644 | ||
818 | --- a/arch/parisc/kernel/vmlinux.lds.S | ||
819 | +++ b/arch/parisc/kernel/vmlinux.lds.S | ||
820 | @@ -56,6 +56,8 @@ SECTIONS | ||
821 | { | ||
822 | . = KERNEL_BINARY_TEXT_START; | ||
823 | |||
824 | + _stext = .; /* start of kernel text, includes init code & data */ | ||
825 | + | ||
826 | __init_begin = .; | ||
827 | HEAD_TEXT_SECTION | ||
828 | MLONGCALL_DISCARD(INIT_TEXT_SECTION(8)) | ||
829 | @@ -79,7 +81,6 @@ SECTIONS | ||
830 | /* freed after init ends here */ | ||
831 | |||
832 | _text = .; /* Text and read-only data */ | ||
833 | - _stext = .; | ||
834 | MLONGCALL_KEEP(INIT_TEXT_SECTION(8)) | ||
835 | .text ALIGN(PAGE_SIZE) : { | ||
836 | TEXT_TEXT | ||
837 | diff --git a/arch/parisc/mm/fixmap.c b/arch/parisc/mm/fixmap.c | ||
838 | index 474cd241c1509..02e19a32e6c5f 100644 | ||
839 | --- a/arch/parisc/mm/fixmap.c | ||
840 | +++ b/arch/parisc/mm/fixmap.c | ||
841 | @@ -18,12 +18,9 @@ void notrace set_fixmap(enum fixed_addresses idx, phys_addr_t phys) | ||
842 | pte_t *pte; | ||
843 | |||
844 | if (pmd_none(*pmd)) | ||
845 | - pmd = pmd_alloc(NULL, pgd, vaddr); | ||
846 | - | ||
847 | - pte = pte_offset_kernel(pmd, vaddr); | ||
848 | - if (pte_none(*pte)) | ||
849 | pte = pte_alloc_kernel(pmd, vaddr); | ||
850 | |||
851 | + pte = pte_offset_kernel(pmd, vaddr); | ||
852 | set_pte_at(&init_mm, vaddr, pte, __mk_pte(phys, PAGE_KERNEL_RWX)); | ||
853 | flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE); | ||
854 | } | ||
855 | diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c | ||
856 | index 3e54484797f62..d769d61cde7ca 100644 | ||
857 | --- a/arch/parisc/mm/init.c | ||
858 | +++ b/arch/parisc/mm/init.c | ||
859 | @@ -892,9 +892,9 @@ void flush_tlb_all(void) | ||
860 | { | ||
861 | int do_recycle; | ||
862 | |||
863 | - __inc_irq_stat(irq_tlb_count); | ||
864 | do_recycle = 0; | ||
865 | spin_lock(&sid_lock); | ||
866 | + __inc_irq_stat(irq_tlb_count); | ||
867 | if (dirty_space_ids > RECYCLE_THRESHOLD) { | ||
868 | BUG_ON(recycle_inuse); /* FIXME: Use a semaphore/wait queue here */ | ||
869 | get_dirty_sids(&recycle_ndirty,recycle_dirty_array); | ||
870 | @@ -913,8 +913,8 @@ void flush_tlb_all(void) | ||
871 | #else | ||
872 | void flush_tlb_all(void) | ||
873 | { | ||
874 | - __inc_irq_stat(irq_tlb_count); | ||
875 | spin_lock(&sid_lock); | ||
876 | + __inc_irq_stat(irq_tlb_count); | ||
877 | flush_tlb_all_local(NULL); | ||
878 | recycle_sids(); | ||
879 | spin_unlock(&sid_lock); | ||
880 | diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h | ||
881 | index be0f7257b13c8..96ef54bc7d968 100644 | ||
882 | --- a/arch/powerpc/include/asm/code-patching.h | ||
883 | +++ b/arch/powerpc/include/asm/code-patching.h | ||
884 | @@ -22,6 +22,7 @@ | ||
885 | #define BRANCH_ABSOLUTE 0x2 | ||
886 | |||
887 | bool is_offset_in_branch_range(long offset); | ||
888 | +bool is_offset_in_cond_branch_range(long offset); | ||
889 | unsigned int create_branch(const unsigned int *addr, | ||
890 | unsigned long target, int flags); | ||
891 | unsigned int create_cond_branch(const unsigned int *addr, | ||
892 | diff --git a/arch/powerpc/include/asm/security_features.h b/arch/powerpc/include/asm/security_features.h | ||
893 | index e9e3f85134e54..316a9c8d1929e 100644 | ||
894 | --- a/arch/powerpc/include/asm/security_features.h | ||
895 | +++ b/arch/powerpc/include/asm/security_features.h | ||
896 | @@ -39,6 +39,11 @@ static inline bool security_ftr_enabled(u64 feature) | ||
897 | return !!(powerpc_security_features & feature); | ||
898 | } | ||
899 | |||
900 | +#ifdef CONFIG_PPC_BOOK3S_64 | ||
901 | +enum stf_barrier_type stf_barrier_type_get(void); | ||
902 | +#else | ||
903 | +static inline enum stf_barrier_type stf_barrier_type_get(void) { return STF_BARRIER_NONE; } | ||
904 | +#endif | ||
905 | |||
906 | // Features indicating support for Spectre/Meltdown mitigations | ||
907 | |||
908 | diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c | ||
909 | index 1740a66cea84d..ff022e7256934 100644 | ||
910 | --- a/arch/powerpc/kernel/security.c | ||
911 | +++ b/arch/powerpc/kernel/security.c | ||
912 | @@ -256,6 +256,11 @@ static int __init handle_no_stf_barrier(char *p) | ||
913 | |||
914 | early_param("no_stf_barrier", handle_no_stf_barrier); | ||
915 | |||
916 | +enum stf_barrier_type stf_barrier_type_get(void) | ||
917 | +{ | ||
918 | + return stf_enabled_flush_types; | ||
919 | +} | ||
920 | + | ||
921 | /* This is the generic flag used by other architectures */ | ||
922 | static int __init handle_ssbd(char *p) | ||
923 | { | ||
924 | diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c | ||
925 | index 3345f039a8769..a05f289e613ed 100644 | ||
926 | --- a/arch/powerpc/lib/code-patching.c | ||
927 | +++ b/arch/powerpc/lib/code-patching.c | ||
928 | @@ -221,6 +221,11 @@ bool is_offset_in_branch_range(long offset) | ||
929 | return (offset >= -0x2000000 && offset <= 0x1fffffc && !(offset & 0x3)); | ||
930 | } | ||
931 | |||
932 | +bool is_offset_in_cond_branch_range(long offset) | ||
933 | +{ | ||
934 | + return offset >= -0x8000 && offset <= 0x7fff && !(offset & 0x3); | ||
935 | +} | ||
936 | + | ||
937 | /* | ||
938 | * Helper to check if a given instruction is a conditional branch | ||
939 | * Derived from the conditional checks in analyse_instr() | ||
940 | @@ -274,7 +279,7 @@ unsigned int create_cond_branch(const unsigned int *addr, | ||
941 | offset = offset - (unsigned long)addr; | ||
942 | |||
943 | /* Check we can represent the target in the instruction format */ | ||
944 | - if (offset < -0x8000 || offset > 0x7FFF || offset & 0x3) | ||
945 | + if (!is_offset_in_cond_branch_range(offset)) | ||
946 | return 0; | ||
947 | |||
948 | /* Mask out the flags and target, so they don't step on each other. */ | ||
949 | diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h | ||
950 | index 55d4377ccfae3..6d2a268528dfc 100644 | ||
951 | --- a/arch/powerpc/net/bpf_jit.h | ||
952 | +++ b/arch/powerpc/net/bpf_jit.h | ||
953 | @@ -11,6 +11,7 @@ | ||
954 | #ifndef __ASSEMBLY__ | ||
955 | |||
956 | #include <asm/types.h> | ||
957 | +#include <asm/code-patching.h> | ||
958 | |||
959 | #ifdef PPC64_ELF_ABI_v1 | ||
960 | #define FUNCTION_DESCR_SIZE 24 | ||
961 | @@ -180,13 +181,26 @@ | ||
962 | #define PPC_NEG(d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a)) | ||
963 | |||
964 | /* Long jump; (unconditional 'branch') */ | ||
965 | -#define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \ | ||
966 | - (((dest) - (ctx->idx * 4)) & 0x03fffffc)) | ||
967 | +#define PPC_JMP(dest) \ | ||
968 | + do { \ | ||
969 | + long offset = (long)(dest) - (ctx->idx * 4); \ | ||
970 | + if (!is_offset_in_branch_range(offset)) { \ | ||
971 | + pr_err_ratelimited("Branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \ | ||
972 | + return -ERANGE; \ | ||
973 | + } \ | ||
974 | + EMIT(PPC_INST_BRANCH | (offset & 0x03fffffc)); \ | ||
975 | + } while (0) | ||
976 | /* "cond" here covers BO:BI fields. */ | ||
977 | -#define PPC_BCC_SHORT(cond, dest) EMIT(PPC_INST_BRANCH_COND | \ | ||
978 | - (((cond) & 0x3ff) << 16) | \ | ||
979 | - (((dest) - (ctx->idx * 4)) & \ | ||
980 | - 0xfffc)) | ||
981 | +#define PPC_BCC_SHORT(cond, dest) \ | ||
982 | + do { \ | ||
983 | + long offset = (long)(dest) - (ctx->idx * 4); \ | ||
984 | + if (!is_offset_in_cond_branch_range(offset)) { \ | ||
985 | + pr_err_ratelimited("Conditional branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx); \ | ||
986 | + return -ERANGE; \ | ||
987 | + } \ | ||
988 | + EMIT(PPC_INST_BRANCH_COND | (((cond) & 0x3ff) << 16) | (offset & 0xfffc)); \ | ||
989 | + } while (0) | ||
990 | + | ||
991 | /* Sign-extended 32-bit immediate load */ | ||
992 | #define PPC_LI32(d, i) do { \ | ||
993 | if ((int)(uintptr_t)(i) >= -32768 && \ | ||
994 | @@ -225,11 +239,6 @@ | ||
995 | #define PPC_FUNC_ADDR(d,i) do { PPC_LI32(d, i); } while(0) | ||
996 | #endif | ||
997 | |||
998 | -static inline bool is_nearbranch(int offset) | ||
999 | -{ | ||
1000 | - return (offset < 32768) && (offset >= -32768); | ||
1001 | -} | ||
1002 | - | ||
1003 | /* | ||
1004 | * The fly in the ointment of code size changing from pass to pass is | ||
1005 | * avoided by padding the short branch case with a NOP. If code size differs | ||
1006 | @@ -238,7 +247,7 @@ static inline bool is_nearbranch(int offset) | ||
1007 | * state. | ||
1008 | */ | ||
1009 | #define PPC_BCC(cond, dest) do { \ | ||
1010 | - if (is_nearbranch((dest) - (ctx->idx * 4))) { \ | ||
1011 | + if (is_offset_in_cond_branch_range((long)(dest) - (ctx->idx * 4))) { \ | ||
1012 | PPC_BCC_SHORT(cond, dest); \ | ||
1013 | PPC_NOP(); \ | ||
1014 | } else { \ | ||
1015 | diff --git a/arch/powerpc/net/bpf_jit64.h b/arch/powerpc/net/bpf_jit64.h | ||
1016 | index cf3a7e337f025..68ddf3502ab03 100644 | ||
1017 | --- a/arch/powerpc/net/bpf_jit64.h | ||
1018 | +++ b/arch/powerpc/net/bpf_jit64.h | ||
1019 | @@ -16,18 +16,18 @@ | ||
1020 | * with our redzone usage. | ||
1021 | * | ||
1022 | * [ prev sp ] <------------- | ||
1023 | - * [ nv gpr save area ] 6*8 | | ||
1024 | + * [ nv gpr save area ] 5*8 | | ||
1025 | * [ tail_call_cnt ] 8 | | ||
1026 | - * [ local_tmp_var ] 8 | | ||
1027 | + * [ local_tmp_var ] 16 | | ||
1028 | * fp (r31) --> [ ebpf stack space ] upto 512 | | ||
1029 | * [ frame header ] 32/112 | | ||
1030 | * sp (r1) ---> [ stack pointer ] -------------- | ||
1031 | */ | ||
1032 | |||
1033 | /* for gpr non volatile registers BPG_REG_6 to 10 */ | ||
1034 | -#define BPF_PPC_STACK_SAVE (6*8) | ||
1035 | +#define BPF_PPC_STACK_SAVE (5*8) | ||
1036 | /* for bpf JIT code internal usage */ | ||
1037 | -#define BPF_PPC_STACK_LOCALS 16 | ||
1038 | +#define BPF_PPC_STACK_LOCALS 24 | ||
1039 | /* stack frame excluding BPF stack, ensure this is quadword aligned */ | ||
1040 | #define BPF_PPC_STACKFRAME (STACK_FRAME_MIN_SIZE + \ | ||
1041 | BPF_PPC_STACK_LOCALS + BPF_PPC_STACK_SAVE) | ||
1042 | diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c | ||
1043 | index 81e6279c9874f..687cd352648aa 100644 | ||
1044 | --- a/arch/powerpc/net/bpf_jit_comp64.c | ||
1045 | +++ b/arch/powerpc/net/bpf_jit_comp64.c | ||
1046 | @@ -15,6 +15,7 @@ | ||
1047 | #include <linux/if_vlan.h> | ||
1048 | #include <asm/kprobes.h> | ||
1049 | #include <linux/bpf.h> | ||
1050 | +#include <asm/security_features.h> | ||
1051 | |||
1052 | #include "bpf_jit64.h" | ||
1053 | |||
1054 | @@ -56,9 +57,9 @@ static inline bool bpf_has_stack_frame(struct codegen_context *ctx) | ||
1055 | * [ prev sp ] <------------- | ||
1056 | * [ ... ] | | ||
1057 | * sp (r1) ---> [ stack pointer ] -------------- | ||
1058 | - * [ nv gpr save area ] 6*8 | ||
1059 | + * [ nv gpr save area ] 5*8 | ||
1060 | * [ tail_call_cnt ] 8 | ||
1061 | - * [ local_tmp_var ] 8 | ||
1062 | + * [ local_tmp_var ] 16 | ||
1063 | * [ unused red zone ] 208 bytes protected | ||
1064 | */ | ||
1065 | static int bpf_jit_stack_local(struct codegen_context *ctx) | ||
1066 | @@ -66,12 +67,12 @@ static int bpf_jit_stack_local(struct codegen_context *ctx) | ||
1067 | if (bpf_has_stack_frame(ctx)) | ||
1068 | return STACK_FRAME_MIN_SIZE + ctx->stack_size; | ||
1069 | else | ||
1070 | - return -(BPF_PPC_STACK_SAVE + 16); | ||
1071 | + return -(BPF_PPC_STACK_SAVE + 24); | ||
1072 | } | ||
1073 | |||
1074 | static int bpf_jit_stack_tailcallcnt(struct codegen_context *ctx) | ||
1075 | { | ||
1076 | - return bpf_jit_stack_local(ctx) + 8; | ||
1077 | + return bpf_jit_stack_local(ctx) + 16; | ||
1078 | } | ||
1079 | |||
1080 | static int bpf_jit_stack_offsetof(struct codegen_context *ctx, int reg) | ||
1081 | @@ -224,7 +225,7 @@ static void bpf_jit_emit_func_call_rel(u32 *image, struct codegen_context *ctx, | ||
1082 | PPC_BLRL(); | ||
1083 | } | ||
1084 | |||
1085 | -static void bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 out) | ||
1086 | +static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 out) | ||
1087 | { | ||
1088 | /* | ||
1089 | * By now, the eBPF program has already setup parameters in r3, r4 and r5 | ||
1090 | @@ -285,14 +286,39 @@ static void bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 | ||
1091 | bpf_jit_emit_common_epilogue(image, ctx); | ||
1092 | |||
1093 | PPC_BCTR(); | ||
1094 | + | ||
1095 | /* out: */ | ||
1096 | + return 0; | ||
1097 | } | ||
1098 | |||
1099 | +/* | ||
1100 | + * We spill into the redzone always, even if the bpf program has its own stackframe. | ||
1101 | + * Offsets hardcoded based on BPF_PPC_STACK_SAVE -- see bpf_jit_stack_local() | ||
1102 | + */ | ||
1103 | +void bpf_stf_barrier(void); | ||
1104 | + | ||
1105 | +asm ( | ||
1106 | +" .global bpf_stf_barrier ;" | ||
1107 | +" bpf_stf_barrier: ;" | ||
1108 | +" std 21,-64(1) ;" | ||
1109 | +" std 22,-56(1) ;" | ||
1110 | +" sync ;" | ||
1111 | +" ld 21,-64(1) ;" | ||
1112 | +" ld 22,-56(1) ;" | ||
1113 | +" ori 31,31,0 ;" | ||
1114 | +" .rept 14 ;" | ||
1115 | +" b 1f ;" | ||
1116 | +" 1: ;" | ||
1117 | +" .endr ;" | ||
1118 | +" blr ;" | ||
1119 | +); | ||
1120 | + | ||
1121 | /* Assemble the body code between the prologue & epilogue */ | ||
1122 | static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, | ||
1123 | struct codegen_context *ctx, | ||
1124 | u32 *addrs, bool extra_pass) | ||
1125 | { | ||
1126 | + enum stf_barrier_type stf_barrier = stf_barrier_type_get(); | ||
1127 | const struct bpf_insn *insn = fp->insnsi; | ||
1128 | int flen = fp->len; | ||
1129 | int i, ret; | ||
1130 | @@ -347,18 +373,25 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, | ||
1131 | PPC_SUB(dst_reg, dst_reg, src_reg); | ||
1132 | goto bpf_alu32_trunc; | ||
1133 | case BPF_ALU | BPF_ADD | BPF_K: /* (u32) dst += (u32) imm */ | ||
1134 | - case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */ | ||
1135 | case BPF_ALU64 | BPF_ADD | BPF_K: /* dst += imm */ | ||
1136 | + if (!imm) { | ||
1137 | + goto bpf_alu32_trunc; | ||
1138 | + } else if (imm >= -32768 && imm < 32768) { | ||
1139 | + PPC_ADDI(dst_reg, dst_reg, IMM_L(imm)); | ||
1140 | + } else { | ||
1141 | + PPC_LI32(b2p[TMP_REG_1], imm); | ||
1142 | + PPC_ADD(dst_reg, dst_reg, b2p[TMP_REG_1]); | ||
1143 | + } | ||
1144 | + goto bpf_alu32_trunc; | ||
1145 | + case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */ | ||
1146 | case BPF_ALU64 | BPF_SUB | BPF_K: /* dst -= imm */ | ||
1147 | - if (BPF_OP(code) == BPF_SUB) | ||
1148 | - imm = -imm; | ||
1149 | - if (imm) { | ||
1150 | - if (imm >= -32768 && imm < 32768) | ||
1151 | - PPC_ADDI(dst_reg, dst_reg, IMM_L(imm)); | ||
1152 | - else { | ||
1153 | - PPC_LI32(b2p[TMP_REG_1], imm); | ||
1154 | - PPC_ADD(dst_reg, dst_reg, b2p[TMP_REG_1]); | ||
1155 | - } | ||
1156 | + if (!imm) { | ||
1157 | + goto bpf_alu32_trunc; | ||
1158 | + } else if (imm > -32768 && imm <= 32768) { | ||
1159 | + PPC_ADDI(dst_reg, dst_reg, IMM_L(-imm)); | ||
1160 | + } else { | ||
1161 | + PPC_LI32(b2p[TMP_REG_1], imm); | ||
1162 | + PPC_SUB(dst_reg, dst_reg, b2p[TMP_REG_1]); | ||
1163 | } | ||
1164 | goto bpf_alu32_trunc; | ||
1165 | case BPF_ALU | BPF_MUL | BPF_X: /* (u32) dst *= (u32) src */ | ||
1166 | @@ -654,6 +687,30 @@ emit_clear: | ||
1167 | * BPF_ST NOSPEC (speculation barrier) | ||
1168 | */ | ||
1169 | case BPF_ST | BPF_NOSPEC: | ||
1170 | + if (!security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) || | ||
1171 | + (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR) && | ||
1172 | + (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) || !cpu_has_feature(CPU_FTR_HVMODE)))) | ||
1173 | + break; | ||
1174 | + | ||
1175 | + switch (stf_barrier) { | ||
1176 | + case STF_BARRIER_EIEIO: | ||
1177 | + EMIT(0x7c0006ac | 0x02000000); | ||
1178 | + break; | ||
1179 | + case STF_BARRIER_SYNC_ORI: | ||
1180 | + EMIT(PPC_INST_SYNC); | ||
1181 | + PPC_LD(b2p[TMP_REG_1], 13, 0); | ||
1182 | + PPC_ORI(31, 31, 0); | ||
1183 | + break; | ||
1184 | + case STF_BARRIER_FALLBACK: | ||
1185 | + EMIT(PPC_INST_MFLR | ___PPC_RT(b2p[TMP_REG_1])); | ||
1186 | + PPC_LI64(12, dereference_kernel_function_descriptor(bpf_stf_barrier)); | ||
1187 | + PPC_MTCTR(12); | ||
1188 | + EMIT(PPC_INST_BCTR | 0x1); | ||
1189 | + PPC_MTLR(b2p[TMP_REG_1]); | ||
1190 | + break; | ||
1191 | + case STF_BARRIER_NONE: | ||
1192 | + break; | ||
1193 | + } | ||
1194 | break; | ||
1195 | |||
1196 | /* | ||
1197 | @@ -1001,7 +1058,9 @@ cond_branch: | ||
1198 | */ | ||
1199 | case BPF_JMP | BPF_TAIL_CALL: | ||
1200 | ctx->seen |= SEEN_TAILCALL; | ||
1201 | - bpf_jit_emit_tail_call(image, ctx, addrs[i + 1]); | ||
1202 | + ret = bpf_jit_emit_tail_call(image, ctx, addrs[i + 1]); | ||
1203 | + if (ret < 0) | ||
1204 | + return ret; | ||
1205 | break; | ||
1206 | |||
1207 | default: | ||
1208 | diff --git a/arch/powerpc/platforms/44x/fsp2.c b/arch/powerpc/platforms/44x/fsp2.c | ||
1209 | index b299e43f5ef94..823397c802def 100644 | ||
1210 | --- a/arch/powerpc/platforms/44x/fsp2.c | ||
1211 | +++ b/arch/powerpc/platforms/44x/fsp2.c | ||
1212 | @@ -208,6 +208,7 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler) | ||
1213 | if (irq == NO_IRQ) { | ||
1214 | pr_err("device tree node %pOFn is missing a interrupt", | ||
1215 | np); | ||
1216 | + of_node_put(np); | ||
1217 | return; | ||
1218 | } | ||
1219 | |||
1220 | @@ -215,6 +216,7 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler) | ||
1221 | if (rc) { | ||
1222 | pr_err("fsp_of_probe: request_irq failed: np=%pOF rc=%d", | ||
1223 | np, rc); | ||
1224 | + of_node_put(np); | ||
1225 | return; | ||
1226 | } | ||
1227 | } | ||
1228 | diff --git a/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c b/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c | ||
1229 | index 7c0133f558d02..ffa8a7a6a2db7 100644 | ||
1230 | --- a/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c | ||
1231 | +++ b/arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c | ||
1232 | @@ -94,9 +94,8 @@ int __init mpc85xx_setup_pmc(void) | ||
1233 | pr_err("Could not map guts node address\n"); | ||
1234 | return -ENOMEM; | ||
1235 | } | ||
1236 | + qoriq_pm_ops = &mpc85xx_pm_ops; | ||
1237 | } | ||
1238 | |||
1239 | - qoriq_pm_ops = &mpc85xx_pm_ops; | ||
1240 | - | ||
1241 | return 0; | ||
1242 | } | ||
1243 | diff --git a/arch/powerpc/platforms/powernv/opal-prd.c b/arch/powerpc/platforms/powernv/opal-prd.c | ||
1244 | index 45f4223a790f2..6ebc906e07b0a 100644 | ||
1245 | --- a/arch/powerpc/platforms/powernv/opal-prd.c | ||
1246 | +++ b/arch/powerpc/platforms/powernv/opal-prd.c | ||
1247 | @@ -372,6 +372,12 @@ static struct notifier_block opal_prd_event_nb = { | ||
1248 | .priority = 0, | ||
1249 | }; | ||
1250 | |||
1251 | +static struct notifier_block opal_prd_event_nb2 = { | ||
1252 | + .notifier_call = opal_prd_msg_notifier, | ||
1253 | + .next = NULL, | ||
1254 | + .priority = 0, | ||
1255 | +}; | ||
1256 | + | ||
1257 | static int opal_prd_probe(struct platform_device *pdev) | ||
1258 | { | ||
1259 | int rc; | ||
1260 | @@ -393,9 +399,10 @@ static int opal_prd_probe(struct platform_device *pdev) | ||
1261 | return rc; | ||
1262 | } | ||
1263 | |||
1264 | - rc = opal_message_notifier_register(OPAL_MSG_PRD2, &opal_prd_event_nb); | ||
1265 | + rc = opal_message_notifier_register(OPAL_MSG_PRD2, &opal_prd_event_nb2); | ||
1266 | if (rc) { | ||
1267 | pr_err("Couldn't register PRD2 event notifier\n"); | ||
1268 | + opal_message_notifier_unregister(OPAL_MSG_PRD, &opal_prd_event_nb); | ||
1269 | return rc; | ||
1270 | } | ||
1271 | |||
1272 | @@ -404,6 +411,8 @@ static int opal_prd_probe(struct platform_device *pdev) | ||
1273 | pr_err("failed to register miscdev\n"); | ||
1274 | opal_message_notifier_unregister(OPAL_MSG_PRD, | ||
1275 | &opal_prd_event_nb); | ||
1276 | + opal_message_notifier_unregister(OPAL_MSG_PRD2, | ||
1277 | + &opal_prd_event_nb2); | ||
1278 | return rc; | ||
1279 | } | ||
1280 | |||
1281 | @@ -414,6 +423,7 @@ static int opal_prd_remove(struct platform_device *pdev) | ||
1282 | { | ||
1283 | misc_deregister(&opal_prd_dev); | ||
1284 | opal_message_notifier_unregister(OPAL_MSG_PRD, &opal_prd_event_nb); | ||
1285 | + opal_message_notifier_unregister(OPAL_MSG_PRD2, &opal_prd_event_nb2); | ||
1286 | return 0; | ||
1287 | } | ||
1288 | |||
1289 | diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c | ||
1290 | index 560310e29e275..fa69610fe6b12 100644 | ||
1291 | --- a/arch/s390/kvm/priv.c | ||
1292 | +++ b/arch/s390/kvm/priv.c | ||
1293 | @@ -398,6 +398,8 @@ static int handle_sske(struct kvm_vcpu *vcpu) | ||
1294 | up_read(¤t->mm->mmap_sem); | ||
1295 | if (rc == -EFAULT) | ||
1296 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | ||
1297 | + if (rc == -EAGAIN) | ||
1298 | + continue; | ||
1299 | if (rc < 0) | ||
1300 | return rc; | ||
1301 | start += PAGE_SIZE; | ||
1302 | diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c | ||
1303 | index 4fa7a562c6fc1..5e5a4e1f0e6cf 100644 | ||
1304 | --- a/arch/s390/mm/gmap.c | ||
1305 | +++ b/arch/s390/mm/gmap.c | ||
1306 | @@ -684,9 +684,10 @@ void __gmap_zap(struct gmap *gmap, unsigned long gaddr) | ||
1307 | vmaddr |= gaddr & ~PMD_MASK; | ||
1308 | /* Get pointer to the page table entry */ | ||
1309 | ptep = get_locked_pte(gmap->mm, vmaddr, &ptl); | ||
1310 | - if (likely(ptep)) | ||
1311 | + if (likely(ptep)) { | ||
1312 | ptep_zap_unused(gmap->mm, vmaddr, ptep, 0); | ||
1313 | - pte_unmap_unlock(ptep, ptl); | ||
1314 | + pte_unmap_unlock(ptep, ptl); | ||
1315 | + } | ||
1316 | } | ||
1317 | } | ||
1318 | EXPORT_SYMBOL_GPL(__gmap_zap); | ||
1319 | diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c | ||
1320 | index ae354a2931e7e..fd6db0ab19288 100644 | ||
1321 | --- a/arch/sh/kernel/cpu/fpu.c | ||
1322 | +++ b/arch/sh/kernel/cpu/fpu.c | ||
1323 | @@ -62,18 +62,20 @@ void fpu_state_restore(struct pt_regs *regs) | ||
1324 | } | ||
1325 | |||
1326 | if (!tsk_used_math(tsk)) { | ||
1327 | - local_irq_enable(); | ||
1328 | + int ret; | ||
1329 | /* | ||
1330 | * does a slab alloc which can sleep | ||
1331 | */ | ||
1332 | - if (init_fpu(tsk)) { | ||
1333 | + local_irq_enable(); | ||
1334 | + ret = init_fpu(tsk); | ||
1335 | + local_irq_disable(); | ||
1336 | + if (ret) { | ||
1337 | /* | ||
1338 | * ran out of memory! | ||
1339 | */ | ||
1340 | - do_group_exit(SIGKILL); | ||
1341 | + force_sig(SIGKILL); | ||
1342 | return; | ||
1343 | } | ||
1344 | - local_irq_disable(); | ||
1345 | } | ||
1346 | |||
1347 | grab_fpu(regs); | ||
1348 | diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c | ||
1349 | index 79583bac9ac4a..812db1ac8cb11 100644 | ||
1350 | --- a/arch/x86/hyperv/hv_init.c | ||
1351 | +++ b/arch/x86/hyperv/hv_init.c | ||
1352 | @@ -155,7 +155,6 @@ void set_hv_tscchange_cb(void (*cb)(void)) | ||
1353 | struct hv_reenlightenment_control re_ctrl = { | ||
1354 | .vector = HYPERV_REENLIGHTENMENT_VECTOR, | ||
1355 | .enabled = 1, | ||
1356 | - .target_vp = hv_vp_index[smp_processor_id()] | ||
1357 | }; | ||
1358 | struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1}; | ||
1359 | |||
1360 | @@ -169,8 +168,12 @@ void set_hv_tscchange_cb(void (*cb)(void)) | ||
1361 | /* Make sure callback is registered before we write to MSRs */ | ||
1362 | wmb(); | ||
1363 | |||
1364 | + re_ctrl.target_vp = hv_vp_index[get_cpu()]; | ||
1365 | + | ||
1366 | wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl)); | ||
1367 | wrmsrl(HV_X64_MSR_TSC_EMULATION_CONTROL, *((u64 *)&emu_ctrl)); | ||
1368 | + | ||
1369 | + put_cpu(); | ||
1370 | } | ||
1371 | EXPORT_SYMBOL_GPL(set_hv_tscchange_cb); | ||
1372 | |||
1373 | diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h | ||
1374 | index 288b065955b72..9d0b479452720 100644 | ||
1375 | --- a/arch/x86/include/asm/page_64_types.h | ||
1376 | +++ b/arch/x86/include/asm/page_64_types.h | ||
1377 | @@ -15,7 +15,7 @@ | ||
1378 | #define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER) | ||
1379 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) | ||
1380 | |||
1381 | -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER) | ||
1382 | +#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER) | ||
1383 | #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) | ||
1384 | |||
1385 | #define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER) | ||
1386 | diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c | ||
1387 | index 753f3dfbc9c91..88cef978380bf 100644 | ||
1388 | --- a/arch/x86/kernel/cpu/amd.c | ||
1389 | +++ b/arch/x86/kernel/cpu/amd.c | ||
1390 | @@ -987,6 +987,8 @@ static void init_amd(struct cpuinfo_x86 *c) | ||
1391 | if (cpu_has(c, X86_FEATURE_IRPERF) && | ||
1392 | !cpu_has_amd_erratum(c, amd_erratum_1054)) | ||
1393 | msr_set_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT); | ||
1394 | + | ||
1395 | + check_null_seg_clears_base(c); | ||
1396 | } | ||
1397 | |||
1398 | #ifdef CONFIG_X86_32 | ||
1399 | diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c | ||
1400 | index f961a56e9da3f..4c85ca112a2a9 100644 | ||
1401 | --- a/arch/x86/kernel/cpu/common.c | ||
1402 | +++ b/arch/x86/kernel/cpu/common.c | ||
1403 | @@ -1336,9 +1336,8 @@ void __init early_cpu_init(void) | ||
1404 | early_identify_cpu(&boot_cpu_data); | ||
1405 | } | ||
1406 | |||
1407 | -static void detect_null_seg_behavior(struct cpuinfo_x86 *c) | ||
1408 | +static bool detect_null_seg_behavior(void) | ||
1409 | { | ||
1410 | -#ifdef CONFIG_X86_64 | ||
1411 | /* | ||
1412 | * Empirically, writing zero to a segment selector on AMD does | ||
1413 | * not clear the base, whereas writing zero to a segment | ||
1414 | @@ -1359,10 +1358,43 @@ static void detect_null_seg_behavior(struct cpuinfo_x86 *c) | ||
1415 | wrmsrl(MSR_FS_BASE, 1); | ||
1416 | loadsegment(fs, 0); | ||
1417 | rdmsrl(MSR_FS_BASE, tmp); | ||
1418 | - if (tmp != 0) | ||
1419 | - set_cpu_bug(c, X86_BUG_NULL_SEG); | ||
1420 | wrmsrl(MSR_FS_BASE, old_base); | ||
1421 | -#endif | ||
1422 | + return tmp == 0; | ||
1423 | +} | ||
1424 | + | ||
1425 | +void check_null_seg_clears_base(struct cpuinfo_x86 *c) | ||
1426 | +{ | ||
1427 | + /* BUG_NULL_SEG is only relevant with 64bit userspace */ | ||
1428 | + if (!IS_ENABLED(CONFIG_X86_64)) | ||
1429 | + return; | ||
1430 | + | ||
1431 | + /* Zen3 CPUs advertise Null Selector Clears Base in CPUID. */ | ||
1432 | + if (c->extended_cpuid_level >= 0x80000021 && | ||
1433 | + cpuid_eax(0x80000021) & BIT(6)) | ||
1434 | + return; | ||
1435 | + | ||
1436 | + /* | ||
1437 | + * CPUID bit above wasn't set. If this kernel is still running | ||
1438 | + * as a HV guest, then the HV has decided not to advertize | ||
1439 | + * that CPUID bit for whatever reason. For example, one | ||
1440 | + * member of the migration pool might be vulnerable. Which | ||
1441 | + * means, the bug is present: set the BUG flag and return. | ||
1442 | + */ | ||
1443 | + if (cpu_has(c, X86_FEATURE_HYPERVISOR)) { | ||
1444 | + set_cpu_bug(c, X86_BUG_NULL_SEG); | ||
1445 | + return; | ||
1446 | + } | ||
1447 | + | ||
1448 | + /* | ||
1449 | + * Zen2 CPUs also have this behaviour, but no CPUID bit. | ||
1450 | + * 0x18 is the respective family for Hygon. | ||
1451 | + */ | ||
1452 | + if ((c->x86 == 0x17 || c->x86 == 0x18) && | ||
1453 | + detect_null_seg_behavior()) | ||
1454 | + return; | ||
1455 | + | ||
1456 | + /* All the remaining ones are affected */ | ||
1457 | + set_cpu_bug(c, X86_BUG_NULL_SEG); | ||
1458 | } | ||
1459 | |||
1460 | static void generic_identify(struct cpuinfo_x86 *c) | ||
1461 | @@ -1398,8 +1430,6 @@ static void generic_identify(struct cpuinfo_x86 *c) | ||
1462 | |||
1463 | get_model_name(c); /* Default name */ | ||
1464 | |||
1465 | - detect_null_seg_behavior(c); | ||
1466 | - | ||
1467 | /* | ||
1468 | * ESPFIX is a strange bug. All real CPUs have it. Paravirt | ||
1469 | * systems that run Linux at CPL > 0 may or may not have the | ||
1470 | diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h | ||
1471 | index 9d033693519aa..4d04c127c4a79 100644 | ||
1472 | --- a/arch/x86/kernel/cpu/cpu.h | ||
1473 | +++ b/arch/x86/kernel/cpu/cpu.h | ||
1474 | @@ -73,6 +73,7 @@ extern int detect_extended_topology_early(struct cpuinfo_x86 *c); | ||
1475 | extern int detect_extended_topology(struct cpuinfo_x86 *c); | ||
1476 | extern int detect_ht_early(struct cpuinfo_x86 *c); | ||
1477 | extern void detect_ht(struct cpuinfo_x86 *c); | ||
1478 | +extern void check_null_seg_clears_base(struct cpuinfo_x86 *c); | ||
1479 | |||
1480 | unsigned int aperfmperf_get_khz(int cpu); | ||
1481 | |||
1482 | diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c | ||
1483 | index 62e9a982adaf9..b232bd0be78d6 100644 | ||
1484 | --- a/arch/x86/kernel/cpu/hygon.c | ||
1485 | +++ b/arch/x86/kernel/cpu/hygon.c | ||
1486 | @@ -350,6 +350,8 @@ static void init_hygon(struct cpuinfo_x86 *c) | ||
1487 | /* Hygon CPUs don't reset SS attributes on SYSRET, Xen does. */ | ||
1488 | if (!cpu_has(c, X86_FEATURE_XENPV)) | ||
1489 | set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); | ||
1490 | + | ||
1491 | + check_null_seg_clears_base(c); | ||
1492 | } | ||
1493 | |||
1494 | static void cpu_detect_tlb_hygon(struct cpuinfo_x86 *c) | ||
1495 | diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c | ||
1496 | index 21efee32e2b12..7dfd0185767cc 100644 | ||
1497 | --- a/arch/x86/kernel/irq.c | ||
1498 | +++ b/arch/x86/kernel/irq.c | ||
1499 | @@ -295,8 +295,10 @@ void kvm_set_posted_intr_wakeup_handler(void (*handler)(void)) | ||
1500 | { | ||
1501 | if (handler) | ||
1502 | kvm_posted_intr_wakeup_handler = handler; | ||
1503 | - else | ||
1504 | + else { | ||
1505 | kvm_posted_intr_wakeup_handler = dummy_handler; | ||
1506 | + synchronize_rcu(); | ||
1507 | + } | ||
1508 | } | ||
1509 | EXPORT_SYMBOL_GPL(kvm_set_posted_intr_wakeup_handler); | ||
1510 | |||
1511 | diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c | ||
1512 | index e177848a36313..0f7c051984062 100644 | ||
1513 | --- a/arch/x86/kvm/vmx/vmx.c | ||
1514 | +++ b/arch/x86/kvm/vmx/vmx.c | ||
1515 | @@ -785,15 +785,15 @@ void update_exception_bitmap(struct kvm_vcpu *vcpu) | ||
1516 | /* | ||
1517 | * Check if MSR is intercepted for currently loaded MSR bitmap. | ||
1518 | */ | ||
1519 | -static bool msr_write_intercepted(struct kvm_vcpu *vcpu, u32 msr) | ||
1520 | +static bool msr_write_intercepted(struct vcpu_vmx *vmx, u32 msr) | ||
1521 | { | ||
1522 | unsigned long *msr_bitmap; | ||
1523 | int f = sizeof(unsigned long); | ||
1524 | |||
1525 | - if (!cpu_has_vmx_msr_bitmap()) | ||
1526 | + if (!(exec_controls_get(vmx) & CPU_BASED_USE_MSR_BITMAPS)) | ||
1527 | return true; | ||
1528 | |||
1529 | - msr_bitmap = to_vmx(vcpu)->loaded_vmcs->msr_bitmap; | ||
1530 | + msr_bitmap = vmx->loaded_vmcs->msr_bitmap; | ||
1531 | |||
1532 | if (msr <= 0x1fff) { | ||
1533 | return !!test_bit(msr, msr_bitmap + 0x800 / f); | ||
1534 | @@ -6579,7 +6579,7 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | ||
1535 | * If the L02 MSR bitmap does not intercept the MSR, then we need to | ||
1536 | * save it. | ||
1537 | */ | ||
1538 | - if (unlikely(!msr_write_intercepted(vcpu, MSR_IA32_SPEC_CTRL))) | ||
1539 | + if (unlikely(!msr_write_intercepted(vmx, MSR_IA32_SPEC_CTRL))) | ||
1540 | vmx->spec_ctrl = native_read_msr(MSR_IA32_SPEC_CTRL); | ||
1541 | |||
1542 | x86_spec_ctrl_restore_host(vmx->spec_ctrl, 0); | ||
1543 | diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c | ||
1544 | index 84cda5dc03870..ebc8e3af1c675 100644 | ||
1545 | --- a/arch/x86/mm/mem_encrypt_identity.c | ||
1546 | +++ b/arch/x86/mm/mem_encrypt_identity.c | ||
1547 | @@ -27,6 +27,15 @@ | ||
1548 | #undef CONFIG_PARAVIRT_XXL | ||
1549 | #undef CONFIG_PARAVIRT_SPINLOCKS | ||
1550 | |||
1551 | +/* | ||
1552 | + * This code runs before CPU feature bits are set. By default, the | ||
1553 | + * pgtable_l5_enabled() function uses bit X86_FEATURE_LA57 to determine if | ||
1554 | + * 5-level paging is active, so that won't work here. USE_EARLY_PGTABLE_L5 | ||
1555 | + * is provided to handle this situation and, instead, use a variable that | ||
1556 | + * has been set by the early boot code. | ||
1557 | + */ | ||
1558 | +#define USE_EARLY_PGTABLE_L5 | ||
1559 | + | ||
1560 | #include <linux/kernel.h> | ||
1561 | #include <linux/mm.h> | ||
1562 | #include <linux/mem_encrypt.h> | ||
1563 | diff --git a/block/blk-mq.c b/block/blk-mq.c | ||
1564 | index 0674f53c60528..84798d09ca464 100644 | ||
1565 | --- a/block/blk-mq.c | ||
1566 | +++ b/block/blk-mq.c | ||
1567 | @@ -733,7 +733,6 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list) | ||
1568 | /* this request will be re-inserted to io scheduler queue */ | ||
1569 | blk_mq_sched_requeue_request(rq); | ||
1570 | |||
1571 | - BUG_ON(!list_empty(&rq->queuelist)); | ||
1572 | blk_mq_add_to_requeue_list(rq, true, kick_requeue_list); | ||
1573 | } | ||
1574 | EXPORT_SYMBOL(blk_mq_requeue_request); | ||
1575 | diff --git a/crypto/Kconfig b/crypto/Kconfig | ||
1576 | index b2cc0ad3792ad..ce60ec30e78df 100644 | ||
1577 | --- a/crypto/Kconfig | ||
1578 | +++ b/crypto/Kconfig | ||
1579 | @@ -242,12 +242,12 @@ config CRYPTO_DH | ||
1580 | |||
1581 | config CRYPTO_ECC | ||
1582 | tristate | ||
1583 | + select CRYPTO_RNG_DEFAULT | ||
1584 | |||
1585 | config CRYPTO_ECDH | ||
1586 | tristate "ECDH algorithm" | ||
1587 | select CRYPTO_ECC | ||
1588 | select CRYPTO_KPP | ||
1589 | - select CRYPTO_RNG_DEFAULT | ||
1590 | help | ||
1591 | Generic implementation of the ECDH algorithm | ||
1592 | |||
1593 | diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c | ||
1594 | index a4f3b3f342c8d..276d2fd9e911c 100644 | ||
1595 | --- a/crypto/pcrypt.c | ||
1596 | +++ b/crypto/pcrypt.c | ||
1597 | @@ -79,12 +79,14 @@ static void pcrypt_aead_enc(struct padata_priv *padata) | ||
1598 | { | ||
1599 | struct pcrypt_request *preq = pcrypt_padata_request(padata); | ||
1600 | struct aead_request *req = pcrypt_request_ctx(preq); | ||
1601 | + int ret; | ||
1602 | |||
1603 | - padata->info = crypto_aead_encrypt(req); | ||
1604 | + ret = crypto_aead_encrypt(req); | ||
1605 | |||
1606 | - if (padata->info == -EINPROGRESS) | ||
1607 | + if (ret == -EINPROGRESS) | ||
1608 | return; | ||
1609 | |||
1610 | + padata->info = ret; | ||
1611 | padata_do_serial(padata); | ||
1612 | } | ||
1613 | |||
1614 | @@ -124,12 +126,14 @@ static void pcrypt_aead_dec(struct padata_priv *padata) | ||
1615 | { | ||
1616 | struct pcrypt_request *preq = pcrypt_padata_request(padata); | ||
1617 | struct aead_request *req = pcrypt_request_ctx(preq); | ||
1618 | + int ret; | ||
1619 | |||
1620 | - padata->info = crypto_aead_decrypt(req); | ||
1621 | + ret = crypto_aead_decrypt(req); | ||
1622 | |||
1623 | - if (padata->info == -EINPROGRESS) | ||
1624 | + if (ret == -EINPROGRESS) | ||
1625 | return; | ||
1626 | |||
1627 | + padata->info = ret; | ||
1628 | padata_do_serial(padata); | ||
1629 | } | ||
1630 | |||
1631 | diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h | ||
1632 | index fd3beea934213..42c4bfd796f42 100644 | ||
1633 | --- a/drivers/acpi/acpica/acglobal.h | ||
1634 | +++ b/drivers/acpi/acpica/acglobal.h | ||
1635 | @@ -220,6 +220,8 @@ extern struct acpi_bit_register_info | ||
1636 | acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; | ||
1637 | ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a); | ||
1638 | ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b); | ||
1639 | +ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a_s0); | ||
1640 | +ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b_s0); | ||
1641 | |||
1642 | /***************************************************************************** | ||
1643 | * | ||
1644 | diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c | ||
1645 | index dee3affaca491..aa502ae3b6b31 100644 | ||
1646 | --- a/drivers/acpi/acpica/hwesleep.c | ||
1647 | +++ b/drivers/acpi/acpica/hwesleep.c | ||
1648 | @@ -147,17 +147,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) | ||
1649 | |||
1650 | acpi_status acpi_hw_extended_wake_prep(u8 sleep_state) | ||
1651 | { | ||
1652 | - acpi_status status; | ||
1653 | u8 sleep_type_value; | ||
1654 | |||
1655 | ACPI_FUNCTION_TRACE(hw_extended_wake_prep); | ||
1656 | |||
1657 | - status = acpi_get_sleep_type_data(ACPI_STATE_S0, | ||
1658 | - &acpi_gbl_sleep_type_a, | ||
1659 | - &acpi_gbl_sleep_type_b); | ||
1660 | - if (ACPI_SUCCESS(status)) { | ||
1661 | + if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) { | ||
1662 | sleep_type_value = | ||
1663 | - ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & | ||
1664 | + ((acpi_gbl_sleep_type_a_s0 << ACPI_X_SLEEP_TYPE_POSITION) & | ||
1665 | ACPI_X_SLEEP_TYPE_MASK); | ||
1666 | |||
1667 | (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE), | ||
1668 | diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c | ||
1669 | index b62db8ec446fa..5f7d63badbe9d 100644 | ||
1670 | --- a/drivers/acpi/acpica/hwsleep.c | ||
1671 | +++ b/drivers/acpi/acpica/hwsleep.c | ||
1672 | @@ -179,7 +179,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) | ||
1673 | |||
1674 | acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state) | ||
1675 | { | ||
1676 | - acpi_status status; | ||
1677 | + acpi_status status = AE_OK; | ||
1678 | struct acpi_bit_register_info *sleep_type_reg_info; | ||
1679 | struct acpi_bit_register_info *sleep_enable_reg_info; | ||
1680 | u32 pm1a_control; | ||
1681 | @@ -192,10 +192,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state) | ||
1682 | * This is unclear from the ACPI Spec, but it is required | ||
1683 | * by some machines. | ||
1684 | */ | ||
1685 | - status = acpi_get_sleep_type_data(ACPI_STATE_S0, | ||
1686 | - &acpi_gbl_sleep_type_a, | ||
1687 | - &acpi_gbl_sleep_type_b); | ||
1688 | - if (ACPI_SUCCESS(status)) { | ||
1689 | + if (acpi_gbl_sleep_type_a_s0 != ACPI_SLEEP_TYPE_INVALID) { | ||
1690 | sleep_type_reg_info = | ||
1691 | acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE); | ||
1692 | sleep_enable_reg_info = | ||
1693 | @@ -216,9 +213,9 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state) | ||
1694 | |||
1695 | /* Insert the SLP_TYP bits */ | ||
1696 | |||
1697 | - pm1a_control |= (acpi_gbl_sleep_type_a << | ||
1698 | + pm1a_control |= (acpi_gbl_sleep_type_a_s0 << | ||
1699 | sleep_type_reg_info->bit_position); | ||
1700 | - pm1b_control |= (acpi_gbl_sleep_type_b << | ||
1701 | + pm1b_control |= (acpi_gbl_sleep_type_b_s0 << | ||
1702 | sleep_type_reg_info->bit_position); | ||
1703 | |||
1704 | /* Write the control registers and ignore any errors */ | ||
1705 | diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c | ||
1706 | index abbf9702aa7f2..79731efbe8fe2 100644 | ||
1707 | --- a/drivers/acpi/acpica/hwxfsleep.c | ||
1708 | +++ b/drivers/acpi/acpica/hwxfsleep.c | ||
1709 | @@ -214,6 +214,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | ||
1710 | return_ACPI_STATUS(status); | ||
1711 | } | ||
1712 | |||
1713 | + status = acpi_get_sleep_type_data(ACPI_STATE_S0, | ||
1714 | + &acpi_gbl_sleep_type_a_s0, | ||
1715 | + &acpi_gbl_sleep_type_b_s0); | ||
1716 | + if (ACPI_FAILURE(status)) { | ||
1717 | + acpi_gbl_sleep_type_a_s0 = ACPI_SLEEP_TYPE_INVALID; | ||
1718 | + } | ||
1719 | + | ||
1720 | /* Execute the _PTS method (Prepare To Sleep) */ | ||
1721 | |||
1722 | arg_list.count = 1; | ||
1723 | diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c | ||
1724 | index 254a7d98b9d4c..6e96ed68b3379 100644 | ||
1725 | --- a/drivers/acpi/battery.c | ||
1726 | +++ b/drivers/acpi/battery.c | ||
1727 | @@ -185,7 +185,7 @@ static int acpi_battery_is_charged(struct acpi_battery *battery) | ||
1728 | return 1; | ||
1729 | |||
1730 | /* fallback to using design values for broken batteries */ | ||
1731 | - if (battery->design_capacity == battery->capacity_now) | ||
1732 | + if (battery->design_capacity <= battery->capacity_now) | ||
1733 | return 1; | ||
1734 | |||
1735 | /* we don't do any sort of metric based on percentages */ | ||
1736 | diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c | ||
1737 | index 452041398b347..36d5a5d50b2ff 100644 | ||
1738 | --- a/drivers/acpi/pmic/intel_pmic.c | ||
1739 | +++ b/drivers/acpi/pmic/intel_pmic.c | ||
1740 | @@ -211,31 +211,36 @@ static acpi_status intel_pmic_regs_handler(u32 function, | ||
1741 | void *handler_context, void *region_context) | ||
1742 | { | ||
1743 | struct intel_pmic_opregion *opregion = region_context; | ||
1744 | - int result = 0; | ||
1745 | + int result = -EINVAL; | ||
1746 | + | ||
1747 | + if (function == ACPI_WRITE) { | ||
1748 | + switch (address) { | ||
1749 | + case 0: | ||
1750 | + return AE_OK; | ||
1751 | + case 1: | ||
1752 | + opregion->ctx.addr |= (*value64 & 0xff) << 8; | ||
1753 | + return AE_OK; | ||
1754 | + case 2: | ||
1755 | + opregion->ctx.addr |= *value64 & 0xff; | ||
1756 | + return AE_OK; | ||
1757 | + case 3: | ||
1758 | + opregion->ctx.val = *value64 & 0xff; | ||
1759 | + return AE_OK; | ||
1760 | + case 4: | ||
1761 | + if (*value64) { | ||
1762 | + result = regmap_write(opregion->regmap, opregion->ctx.addr, | ||
1763 | + opregion->ctx.val); | ||
1764 | + } else { | ||
1765 | + result = regmap_read(opregion->regmap, opregion->ctx.addr, | ||
1766 | + &opregion->ctx.val); | ||
1767 | + } | ||
1768 | + opregion->ctx.addr = 0; | ||
1769 | + } | ||
1770 | + } | ||
1771 | |||
1772 | - switch (address) { | ||
1773 | - case 0: | ||
1774 | - return AE_OK; | ||
1775 | - case 1: | ||
1776 | - opregion->ctx.addr |= (*value64 & 0xff) << 8; | ||
1777 | - return AE_OK; | ||
1778 | - case 2: | ||
1779 | - opregion->ctx.addr |= *value64 & 0xff; | ||
1780 | + if (function == ACPI_READ && address == 3) { | ||
1781 | + *value64 = opregion->ctx.val; | ||
1782 | return AE_OK; | ||
1783 | - case 3: | ||
1784 | - opregion->ctx.val = *value64 & 0xff; | ||
1785 | - return AE_OK; | ||
1786 | - case 4: | ||
1787 | - if (*value64) { | ||
1788 | - result = regmap_write(opregion->regmap, opregion->ctx.addr, | ||
1789 | - opregion->ctx.val); | ||
1790 | - } else { | ||
1791 | - result = regmap_read(opregion->regmap, opregion->ctx.addr, | ||
1792 | - &opregion->ctx.val); | ||
1793 | - if (result == 0) | ||
1794 | - *value64 = opregion->ctx.val; | ||
1795 | - } | ||
1796 | - memset(&opregion->ctx, 0x00, sizeof(opregion->ctx)); | ||
1797 | } | ||
1798 | |||
1799 | if (result < 0) { | ||
1800 | diff --git a/drivers/android/binder.c b/drivers/android/binder.c | ||
1801 | index 2be6687c0148f..47f839bc0234f 100644 | ||
1802 | --- a/drivers/android/binder.c | ||
1803 | +++ b/drivers/android/binder.c | ||
1804 | @@ -424,6 +424,9 @@ enum binder_deferred_state { | ||
1805 | * (invariant after initialized) | ||
1806 | * @tsk task_struct for group_leader of process | ||
1807 | * (invariant after initialized) | ||
1808 | + * @cred struct cred associated with the `struct file` | ||
1809 | + * in binder_open() | ||
1810 | + * (invariant after initialized) | ||
1811 | * @deferred_work_node: element for binder_deferred_list | ||
1812 | * (protected by binder_deferred_lock) | ||
1813 | * @deferred_work: bitmap of deferred work to perform | ||
1814 | @@ -469,6 +472,7 @@ struct binder_proc { | ||
1815 | struct list_head waiting_threads; | ||
1816 | int pid; | ||
1817 | struct task_struct *tsk; | ||
1818 | + const struct cred *cred; | ||
1819 | struct hlist_node deferred_work_node; | ||
1820 | int deferred_work; | ||
1821 | bool is_dead; | ||
1822 | @@ -2442,7 +2446,7 @@ static int binder_translate_binder(struct flat_binder_object *fp, | ||
1823 | ret = -EINVAL; | ||
1824 | goto done; | ||
1825 | } | ||
1826 | - if (security_binder_transfer_binder(proc->tsk, target_proc->tsk)) { | ||
1827 | + if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { | ||
1828 | ret = -EPERM; | ||
1829 | goto done; | ||
1830 | } | ||
1831 | @@ -2488,7 +2492,7 @@ static int binder_translate_handle(struct flat_binder_object *fp, | ||
1832 | proc->pid, thread->pid, fp->handle); | ||
1833 | return -EINVAL; | ||
1834 | } | ||
1835 | - if (security_binder_transfer_binder(proc->tsk, target_proc->tsk)) { | ||
1836 | + if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { | ||
1837 | ret = -EPERM; | ||
1838 | goto done; | ||
1839 | } | ||
1840 | @@ -2576,7 +2580,7 @@ static int binder_translate_fd(u32 fd, binder_size_t fd_offset, | ||
1841 | ret = -EBADF; | ||
1842 | goto err_fget; | ||
1843 | } | ||
1844 | - ret = security_binder_transfer_file(proc->tsk, target_proc->tsk, file); | ||
1845 | + ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); | ||
1846 | if (ret < 0) { | ||
1847 | ret = -EPERM; | ||
1848 | goto err_security; | ||
1849 | @@ -2975,8 +2979,8 @@ static void binder_transaction(struct binder_proc *proc, | ||
1850 | return_error_line = __LINE__; | ||
1851 | goto err_invalid_target_handle; | ||
1852 | } | ||
1853 | - if (security_binder_transaction(proc->tsk, | ||
1854 | - target_proc->tsk) < 0) { | ||
1855 | + if (security_binder_transaction(proc->cred, | ||
1856 | + target_proc->cred) < 0) { | ||
1857 | return_error = BR_FAILED_REPLY; | ||
1858 | return_error_param = -EPERM; | ||
1859 | return_error_line = __LINE__; | ||
1860 | @@ -3091,7 +3095,7 @@ static void binder_transaction(struct binder_proc *proc, | ||
1861 | t->from = thread; | ||
1862 | else | ||
1863 | t->from = NULL; | ||
1864 | - t->sender_euid = task_euid(proc->tsk); | ||
1865 | + t->sender_euid = proc->cred->euid; | ||
1866 | t->to_proc = target_proc; | ||
1867 | t->to_thread = target_thread; | ||
1868 | t->code = tr->code; | ||
1869 | @@ -3102,7 +3106,7 @@ static void binder_transaction(struct binder_proc *proc, | ||
1870 | u32 secid; | ||
1871 | size_t added_size; | ||
1872 | |||
1873 | - security_task_getsecid(proc->tsk, &secid); | ||
1874 | + security_cred_getsecid(proc->cred, &secid); | ||
1875 | ret = security_secid_to_secctx(secid, &secctx, &secctx_sz); | ||
1876 | if (ret) { | ||
1877 | return_error = BR_FAILED_REPLY; | ||
1878 | @@ -4707,6 +4711,7 @@ static void binder_free_proc(struct binder_proc *proc) | ||
1879 | } | ||
1880 | binder_alloc_deferred_release(&proc->alloc); | ||
1881 | put_task_struct(proc->tsk); | ||
1882 | + put_cred(proc->cred); | ||
1883 | binder_stats_deleted(BINDER_STAT_PROC); | ||
1884 | kfree(proc); | ||
1885 | } | ||
1886 | @@ -4917,7 +4922,7 @@ static int binder_ioctl_set_ctx_mgr(struct file *filp, | ||
1887 | ret = -EBUSY; | ||
1888 | goto out; | ||
1889 | } | ||
1890 | - ret = security_binder_set_context_mgr(proc->tsk); | ||
1891 | + ret = security_binder_set_context_mgr(proc->cred); | ||
1892 | if (ret < 0) | ||
1893 | goto out; | ||
1894 | if (uid_valid(context->binder_context_mgr_uid)) { | ||
1895 | @@ -5234,6 +5239,7 @@ static int binder_open(struct inode *nodp, struct file *filp) | ||
1896 | spin_lock_init(&proc->outer_lock); | ||
1897 | get_task_struct(current->group_leader); | ||
1898 | proc->tsk = current->group_leader; | ||
1899 | + proc->cred = get_cred(filp->f_cred); | ||
1900 | INIT_LIST_HEAD(&proc->todo); | ||
1901 | proc->default_priority = task_nice(current); | ||
1902 | /* binderfs stashes devices in i_private */ | ||
1903 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
1904 | index 7c6c05fd5dfc3..bed433fd9c700 100644 | ||
1905 | --- a/drivers/ata/libata-core.c | ||
1906 | +++ b/drivers/ata/libata-core.c | ||
1907 | @@ -2057,7 +2057,7 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log, | ||
1908 | |||
1909 | retry: | ||
1910 | ata_tf_init(dev, &tf); | ||
1911 | - if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id) && | ||
1912 | + if (ata_dma_enabled(dev) && ata_id_has_read_log_dma_ext(dev->id) && | ||
1913 | !(dev->horkage & ATA_HORKAGE_NO_DMA_LOG)) { | ||
1914 | tf.command = ATA_CMD_READ_LOG_DMA_EXT; | ||
1915 | tf.protocol = ATA_PROT_DMA; | ||
1916 | diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c | ||
1917 | index 3bfd9da584734..c6a21a784ec65 100644 | ||
1918 | --- a/drivers/ata/libata-eh.c | ||
1919 | +++ b/drivers/ata/libata-eh.c | ||
1920 | @@ -97,6 +97,12 @@ static const unsigned long ata_eh_identify_timeouts[] = { | ||
1921 | ULONG_MAX, | ||
1922 | }; | ||
1923 | |||
1924 | +static const unsigned long ata_eh_revalidate_timeouts[] = { | ||
1925 | + 15000, /* Some drives are slow to read log pages when waking-up */ | ||
1926 | + 15000, /* combined time till here is enough even for media access */ | ||
1927 | + ULONG_MAX, | ||
1928 | +}; | ||
1929 | + | ||
1930 | static const unsigned long ata_eh_flush_timeouts[] = { | ||
1931 | 15000, /* be generous with flush */ | ||
1932 | 15000, /* ditto */ | ||
1933 | @@ -133,6 +139,8 @@ static const struct ata_eh_cmd_timeout_ent | ||
1934 | ata_eh_cmd_timeout_table[ATA_EH_CMD_TIMEOUT_TABLE_SIZE] = { | ||
1935 | { .commands = CMDS(ATA_CMD_ID_ATA, ATA_CMD_ID_ATAPI), | ||
1936 | .timeouts = ata_eh_identify_timeouts, }, | ||
1937 | + { .commands = CMDS(ATA_CMD_READ_LOG_EXT, ATA_CMD_READ_LOG_DMA_EXT), | ||
1938 | + .timeouts = ata_eh_revalidate_timeouts, }, | ||
1939 | { .commands = CMDS(ATA_CMD_READ_NATIVE_MAX, ATA_CMD_READ_NATIVE_MAX_EXT), | ||
1940 | .timeouts = ata_eh_other_timeouts, }, | ||
1941 | { .commands = CMDS(ATA_CMD_SET_MAX, ATA_CMD_SET_MAX_EXT), | ||
1942 | diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c | ||
1943 | index 33b887b389061..59109b410c67f 100644 | ||
1944 | --- a/drivers/auxdisplay/ht16k33.c | ||
1945 | +++ b/drivers/auxdisplay/ht16k33.c | ||
1946 | @@ -219,6 +219,15 @@ static const struct backlight_ops ht16k33_bl_ops = { | ||
1947 | .check_fb = ht16k33_bl_check_fb, | ||
1948 | }; | ||
1949 | |||
1950 | +/* | ||
1951 | + * Blank events will be passed to the actual device handling the backlight when | ||
1952 | + * we return zero here. | ||
1953 | + */ | ||
1954 | +static int ht16k33_blank(int blank, struct fb_info *info) | ||
1955 | +{ | ||
1956 | + return 0; | ||
1957 | +} | ||
1958 | + | ||
1959 | static int ht16k33_mmap(struct fb_info *info, struct vm_area_struct *vma) | ||
1960 | { | ||
1961 | struct ht16k33_priv *priv = info->par; | ||
1962 | @@ -231,6 +240,7 @@ static struct fb_ops ht16k33_fb_ops = { | ||
1963 | .owner = THIS_MODULE, | ||
1964 | .fb_read = fb_sys_read, | ||
1965 | .fb_write = fb_sys_write, | ||
1966 | + .fb_blank = ht16k33_blank, | ||
1967 | .fb_fillrect = sys_fillrect, | ||
1968 | .fb_copyarea = sys_copyarea, | ||
1969 | .fb_imageblit = sys_imageblit, | ||
1970 | @@ -418,6 +428,33 @@ static int ht16k33_probe(struct i2c_client *client, | ||
1971 | if (err) | ||
1972 | return err; | ||
1973 | |||
1974 | + /* Backlight */ | ||
1975 | + memset(&bl_props, 0, sizeof(struct backlight_properties)); | ||
1976 | + bl_props.type = BACKLIGHT_RAW; | ||
1977 | + bl_props.max_brightness = MAX_BRIGHTNESS; | ||
1978 | + | ||
1979 | + bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl", | ||
1980 | + &client->dev, priv, | ||
1981 | + &ht16k33_bl_ops, &bl_props); | ||
1982 | + if (IS_ERR(bl)) { | ||
1983 | + dev_err(&client->dev, "failed to register backlight\n"); | ||
1984 | + return PTR_ERR(bl); | ||
1985 | + } | ||
1986 | + | ||
1987 | + err = of_property_read_u32(node, "default-brightness-level", | ||
1988 | + &dft_brightness); | ||
1989 | + if (err) { | ||
1990 | + dft_brightness = MAX_BRIGHTNESS; | ||
1991 | + } else if (dft_brightness > MAX_BRIGHTNESS) { | ||
1992 | + dev_warn(&client->dev, | ||
1993 | + "invalid default brightness level: %u, using %u\n", | ||
1994 | + dft_brightness, MAX_BRIGHTNESS); | ||
1995 | + dft_brightness = MAX_BRIGHTNESS; | ||
1996 | + } | ||
1997 | + | ||
1998 | + bl->props.brightness = dft_brightness; | ||
1999 | + ht16k33_bl_update_status(bl); | ||
2000 | + | ||
2001 | /* Framebuffer (2 bytes per column) */ | ||
2002 | BUILD_BUG_ON(PAGE_SIZE < HT16K33_FB_SIZE); | ||
2003 | fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL); | ||
2004 | @@ -450,6 +487,7 @@ static int ht16k33_probe(struct i2c_client *client, | ||
2005 | fbdev->info->screen_size = HT16K33_FB_SIZE; | ||
2006 | fbdev->info->fix = ht16k33_fb_fix; | ||
2007 | fbdev->info->var = ht16k33_fb_var; | ||
2008 | + fbdev->info->bl_dev = bl; | ||
2009 | fbdev->info->pseudo_palette = NULL; | ||
2010 | fbdev->info->flags = FBINFO_FLAG_DEFAULT; | ||
2011 | fbdev->info->par = priv; | ||
2012 | @@ -462,34 +500,6 @@ static int ht16k33_probe(struct i2c_client *client, | ||
2013 | if (err) | ||
2014 | goto err_fbdev_unregister; | ||
2015 | |||
2016 | - /* Backlight */ | ||
2017 | - memset(&bl_props, 0, sizeof(struct backlight_properties)); | ||
2018 | - bl_props.type = BACKLIGHT_RAW; | ||
2019 | - bl_props.max_brightness = MAX_BRIGHTNESS; | ||
2020 | - | ||
2021 | - bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl", | ||
2022 | - &client->dev, priv, | ||
2023 | - &ht16k33_bl_ops, &bl_props); | ||
2024 | - if (IS_ERR(bl)) { | ||
2025 | - dev_err(&client->dev, "failed to register backlight\n"); | ||
2026 | - err = PTR_ERR(bl); | ||
2027 | - goto err_fbdev_unregister; | ||
2028 | - } | ||
2029 | - | ||
2030 | - err = of_property_read_u32(node, "default-brightness-level", | ||
2031 | - &dft_brightness); | ||
2032 | - if (err) { | ||
2033 | - dft_brightness = MAX_BRIGHTNESS; | ||
2034 | - } else if (dft_brightness > MAX_BRIGHTNESS) { | ||
2035 | - dev_warn(&client->dev, | ||
2036 | - "invalid default brightness level: %u, using %u\n", | ||
2037 | - dft_brightness, MAX_BRIGHTNESS); | ||
2038 | - dft_brightness = MAX_BRIGHTNESS; | ||
2039 | - } | ||
2040 | - | ||
2041 | - bl->props.brightness = dft_brightness; | ||
2042 | - ht16k33_bl_update_status(bl); | ||
2043 | - | ||
2044 | ht16k33_fb_queue(priv); | ||
2045 | return 0; | ||
2046 | |||
2047 | diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c | ||
2048 | index efb928e25aef3..9556d6827f005 100644 | ||
2049 | --- a/drivers/auxdisplay/img-ascii-lcd.c | ||
2050 | +++ b/drivers/auxdisplay/img-ascii-lcd.c | ||
2051 | @@ -280,6 +280,16 @@ static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx, | ||
2052 | if (msg[count - 1] == '\n') | ||
2053 | count--; | ||
2054 | |||
2055 | + if (!count) { | ||
2056 | + /* clear the LCD */ | ||
2057 | + devm_kfree(&ctx->pdev->dev, ctx->message); | ||
2058 | + ctx->message = NULL; | ||
2059 | + ctx->message_len = 0; | ||
2060 | + memset(ctx->curr, ' ', ctx->cfg->num_chars); | ||
2061 | + ctx->cfg->update(ctx); | ||
2062 | + return 0; | ||
2063 | + } | ||
2064 | + | ||
2065 | new_msg = devm_kmalloc(&ctx->pdev->dev, count + 1, GFP_KERNEL); | ||
2066 | if (!new_msg) | ||
2067 | return -ENOMEM; | ||
2068 | diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c | ||
2069 | index bd7d3bb8b890b..ad4cf10749100 100644 | ||
2070 | --- a/drivers/block/ataflop.c | ||
2071 | +++ b/drivers/block/ataflop.c | ||
2072 | @@ -653,9 +653,6 @@ static inline void copy_buffer(void *from, void *to) | ||
2073 | *p2++ = *p1++; | ||
2074 | } | ||
2075 | |||
2076 | - | ||
2077 | - | ||
2078 | - | ||
2079 | /* General Interrupt Handling */ | ||
2080 | |||
2081 | static void (*FloppyIRQHandler)( int status ) = NULL; | ||
2082 | @@ -1225,6 +1222,7 @@ static void fd_rwsec_done1(int status) | ||
2083 | } | ||
2084 | else { | ||
2085 | /* all sectors finished */ | ||
2086 | + finish_fdc(); | ||
2087 | fd_end_request_cur(BLK_STS_OK); | ||
2088 | } | ||
2089 | return; | ||
2090 | @@ -1472,15 +1470,6 @@ static void setup_req_params( int drive ) | ||
2091 | ReqTrack, ReqSector, (unsigned long)ReqData )); | ||
2092 | } | ||
2093 | |||
2094 | -static void ataflop_commit_rqs(struct blk_mq_hw_ctx *hctx) | ||
2095 | -{ | ||
2096 | - spin_lock_irq(&ataflop_lock); | ||
2097 | - atari_disable_irq(IRQ_MFP_FDC); | ||
2098 | - finish_fdc(); | ||
2099 | - atari_enable_irq(IRQ_MFP_FDC); | ||
2100 | - spin_unlock_irq(&ataflop_lock); | ||
2101 | -} | ||
2102 | - | ||
2103 | static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx, | ||
2104 | const struct blk_mq_queue_data *bd) | ||
2105 | { | ||
2106 | @@ -1488,6 +1477,8 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx, | ||
2107 | int drive = floppy - unit; | ||
2108 | int type = floppy->type; | ||
2109 | |||
2110 | + DPRINT(("Queue request: drive %d type %d last %d\n", drive, type, bd->last)); | ||
2111 | + | ||
2112 | spin_lock_irq(&ataflop_lock); | ||
2113 | if (fd_request) { | ||
2114 | spin_unlock_irq(&ataflop_lock); | ||
2115 | @@ -1547,8 +1538,6 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx, | ||
2116 | setup_req_params( drive ); | ||
2117 | do_fd_action( drive ); | ||
2118 | |||
2119 | - if (bd->last) | ||
2120 | - finish_fdc(); | ||
2121 | atari_enable_irq( IRQ_MFP_FDC ); | ||
2122 | |||
2123 | out: | ||
2124 | @@ -1958,7 +1947,6 @@ static const struct block_device_operations floppy_fops = { | ||
2125 | |||
2126 | static const struct blk_mq_ops ataflop_mq_ops = { | ||
2127 | .queue_rq = ataflop_queue_rq, | ||
2128 | - .commit_rqs = ataflop_commit_rqs, | ||
2129 | }; | ||
2130 | |||
2131 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) | ||
2132 | diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c | ||
2133 | index 719c6b7741afa..1cc9b67e9bcaa 100644 | ||
2134 | --- a/drivers/block/zram/zram_drv.c | ||
2135 | +++ b/drivers/block/zram/zram_drv.c | ||
2136 | @@ -901,7 +901,7 @@ static ssize_t read_block_state(struct file *file, char __user *buf, | ||
2137 | zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.', | ||
2138 | zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.'); | ||
2139 | |||
2140 | - if (count < copied) { | ||
2141 | + if (count <= copied) { | ||
2142 | zram_slot_unlock(zram, index); | ||
2143 | break; | ||
2144 | } | ||
2145 | diff --git a/drivers/bluetooth/btmtkuart.c b/drivers/bluetooth/btmtkuart.c | ||
2146 | index 8a81fbca5c9d8..2beb2321825e3 100644 | ||
2147 | --- a/drivers/bluetooth/btmtkuart.c | ||
2148 | +++ b/drivers/bluetooth/btmtkuart.c | ||
2149 | @@ -158,8 +158,10 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, | ||
2150 | int err; | ||
2151 | |||
2152 | hlen = sizeof(*hdr) + wmt_params->dlen; | ||
2153 | - if (hlen > 255) | ||
2154 | - return -EINVAL; | ||
2155 | + if (hlen > 255) { | ||
2156 | + err = -EINVAL; | ||
2157 | + goto err_free_skb; | ||
2158 | + } | ||
2159 | |||
2160 | hdr = (struct mtk_wmt_hdr *)&wc; | ||
2161 | hdr->dir = 1; | ||
2162 | @@ -173,7 +175,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, | ||
2163 | err = __hci_cmd_send(hdev, 0xfc6f, hlen, &wc); | ||
2164 | if (err < 0) { | ||
2165 | clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state); | ||
2166 | - return err; | ||
2167 | + goto err_free_skb; | ||
2168 | } | ||
2169 | |||
2170 | /* The vendor specific WMT commands are all answered by a vendor | ||
2171 | @@ -190,13 +192,14 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, | ||
2172 | if (err == -EINTR) { | ||
2173 | bt_dev_err(hdev, "Execution of wmt command interrupted"); | ||
2174 | clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state); | ||
2175 | - return err; | ||
2176 | + goto err_free_skb; | ||
2177 | } | ||
2178 | |||
2179 | if (err) { | ||
2180 | bt_dev_err(hdev, "Execution of wmt command timed out"); | ||
2181 | clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state); | ||
2182 | - return -ETIMEDOUT; | ||
2183 | + err = -ETIMEDOUT; | ||
2184 | + goto err_free_skb; | ||
2185 | } | ||
2186 | |||
2187 | /* Parse and handle the return WMT event */ | ||
2188 | diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c | ||
2189 | index e649be5a5f132..6670516fa194d 100644 | ||
2190 | --- a/drivers/char/hw_random/mtk-rng.c | ||
2191 | +++ b/drivers/char/hw_random/mtk-rng.c | ||
2192 | @@ -173,8 +173,13 @@ static int mtk_rng_runtime_resume(struct device *dev) | ||
2193 | return mtk_rng_init(&priv->rng); | ||
2194 | } | ||
2195 | |||
2196 | -static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend, | ||
2197 | - mtk_rng_runtime_resume, NULL); | ||
2198 | +static const struct dev_pm_ops mtk_rng_pm_ops = { | ||
2199 | + SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend, | ||
2200 | + mtk_rng_runtime_resume, NULL) | ||
2201 | + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | ||
2202 | + pm_runtime_force_resume) | ||
2203 | +}; | ||
2204 | + | ||
2205 | #define MTK_RNG_PM_OPS (&mtk_rng_pm_ops) | ||
2206 | #else /* CONFIG_PM */ | ||
2207 | #define MTK_RNG_PM_OPS NULL | ||
2208 | diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c | ||
2209 | index ac656a6d5daf1..bd3c9fb029fa5 100644 | ||
2210 | --- a/drivers/char/ipmi/ipmi_msghandler.c | ||
2211 | +++ b/drivers/char/ipmi/ipmi_msghandler.c | ||
2212 | @@ -4797,7 +4797,9 @@ static atomic_t recv_msg_inuse_count = ATOMIC_INIT(0); | ||
2213 | static void free_smi_msg(struct ipmi_smi_msg *msg) | ||
2214 | { | ||
2215 | atomic_dec(&smi_msg_inuse_count); | ||
2216 | - kfree(msg); | ||
2217 | + /* Try to keep as much stuff out of the panic path as possible. */ | ||
2218 | + if (!oops_in_progress) | ||
2219 | + kfree(msg); | ||
2220 | } | ||
2221 | |||
2222 | struct ipmi_smi_msg *ipmi_alloc_smi_msg(void) | ||
2223 | @@ -4816,7 +4818,9 @@ EXPORT_SYMBOL(ipmi_alloc_smi_msg); | ||
2224 | static void free_recv_msg(struct ipmi_recv_msg *msg) | ||
2225 | { | ||
2226 | atomic_dec(&recv_msg_inuse_count); | ||
2227 | - kfree(msg); | ||
2228 | + /* Try to keep as much stuff out of the panic path as possible. */ | ||
2229 | + if (!oops_in_progress) | ||
2230 | + kfree(msg); | ||
2231 | } | ||
2232 | |||
2233 | static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void) | ||
2234 | @@ -4834,7 +4838,7 @@ static struct ipmi_recv_msg *ipmi_alloc_recv_msg(void) | ||
2235 | |||
2236 | void ipmi_free_recv_msg(struct ipmi_recv_msg *msg) | ||
2237 | { | ||
2238 | - if (msg->user) | ||
2239 | + if (msg->user && !oops_in_progress) | ||
2240 | kref_put(&msg->user->refcount, free_user); | ||
2241 | msg->done(msg); | ||
2242 | } | ||
2243 | diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c | ||
2244 | index ae06e5402e9d5..72ad7fff64a7a 100644 | ||
2245 | --- a/drivers/char/ipmi/ipmi_watchdog.c | ||
2246 | +++ b/drivers/char/ipmi/ipmi_watchdog.c | ||
2247 | @@ -337,13 +337,17 @@ static atomic_t msg_tofree = ATOMIC_INIT(0); | ||
2248 | static DECLARE_COMPLETION(msg_wait); | ||
2249 | static void msg_free_smi(struct ipmi_smi_msg *msg) | ||
2250 | { | ||
2251 | - if (atomic_dec_and_test(&msg_tofree)) | ||
2252 | - complete(&msg_wait); | ||
2253 | + if (atomic_dec_and_test(&msg_tofree)) { | ||
2254 | + if (!oops_in_progress) | ||
2255 | + complete(&msg_wait); | ||
2256 | + } | ||
2257 | } | ||
2258 | static void msg_free_recv(struct ipmi_recv_msg *msg) | ||
2259 | { | ||
2260 | - if (atomic_dec_and_test(&msg_tofree)) | ||
2261 | - complete(&msg_wait); | ||
2262 | + if (atomic_dec_and_test(&msg_tofree)) { | ||
2263 | + if (!oops_in_progress) | ||
2264 | + complete(&msg_wait); | ||
2265 | + } | ||
2266 | } | ||
2267 | static struct ipmi_smi_msg smi_msg = { | ||
2268 | .done = msg_free_smi | ||
2269 | @@ -429,8 +433,10 @@ static int _ipmi_set_timeout(int do_heartbeat) | ||
2270 | rv = __ipmi_set_timeout(&smi_msg, | ||
2271 | &recv_msg, | ||
2272 | &send_heartbeat_now); | ||
2273 | - if (rv) | ||
2274 | + if (rv) { | ||
2275 | + atomic_set(&msg_tofree, 0); | ||
2276 | return rv; | ||
2277 | + } | ||
2278 | |||
2279 | wait_for_completion(&msg_wait); | ||
2280 | |||
2281 | @@ -575,6 +581,7 @@ restart: | ||
2282 | &recv_msg, | ||
2283 | 1); | ||
2284 | if (rv) { | ||
2285 | + atomic_set(&msg_tofree, 0); | ||
2286 | pr_warn("heartbeat send failure: %d\n", rv); | ||
2287 | return rv; | ||
2288 | } | ||
2289 | diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c | ||
2290 | index 784b8b3cb903f..97e916856cf3e 100644 | ||
2291 | --- a/drivers/char/tpm/tpm2-space.c | ||
2292 | +++ b/drivers/char/tpm/tpm2-space.c | ||
2293 | @@ -455,6 +455,9 @@ static int tpm2_map_response_body(struct tpm_chip *chip, u32 cc, u8 *rsp, | ||
2294 | if (be32_to_cpu(data->capability) != TPM2_CAP_HANDLES) | ||
2295 | return 0; | ||
2296 | |||
2297 | + if (be32_to_cpu(data->count) > (UINT_MAX - TPM_HEADER_SIZE - 9) / 4) | ||
2298 | + return -EFAULT; | ||
2299 | + | ||
2300 | if (len != TPM_HEADER_SIZE + 9 + 4 * be32_to_cpu(data->count)) | ||
2301 | return -EFAULT; | ||
2302 | |||
2303 | diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c | ||
2304 | index b71515acdec1f..976ca41e9157e 100644 | ||
2305 | --- a/drivers/clk/at91/pmc.c | ||
2306 | +++ b/drivers/clk/at91/pmc.c | ||
2307 | @@ -275,6 +275,11 @@ static int __init pmc_register_ops(void) | ||
2308 | |||
2309 | np = of_find_matching_node(NULL, sama5d2_pmc_dt_ids); | ||
2310 | |||
2311 | + if (!of_device_is_available(np)) { | ||
2312 | + of_node_put(np); | ||
2313 | + return -ENODEV; | ||
2314 | + } | ||
2315 | + | ||
2316 | pmcreg = device_node_to_regmap(np); | ||
2317 | if (IS_ERR(pmcreg)) | ||
2318 | return PTR_ERR(pmcreg); | ||
2319 | diff --git a/drivers/clk/mvebu/ap-cpu-clk.c b/drivers/clk/mvebu/ap-cpu-clk.c | ||
2320 | index af5e5acad3706..bde4a7d6a1d33 100644 | ||
2321 | --- a/drivers/clk/mvebu/ap-cpu-clk.c | ||
2322 | +++ b/drivers/clk/mvebu/ap-cpu-clk.c | ||
2323 | @@ -256,12 +256,15 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) | ||
2324 | int cpu, err; | ||
2325 | |||
2326 | err = of_property_read_u32(dn, "reg", &cpu); | ||
2327 | - if (WARN_ON(err)) | ||
2328 | + if (WARN_ON(err)) { | ||
2329 | + of_node_put(dn); | ||
2330 | return err; | ||
2331 | + } | ||
2332 | |||
2333 | /* If cpu2 or cpu3 is enabled */ | ||
2334 | if (cpu & APN806_CLUSTER_NUM_MASK) { | ||
2335 | nclusters = 2; | ||
2336 | + of_node_put(dn); | ||
2337 | break; | ||
2338 | } | ||
2339 | } | ||
2340 | @@ -288,8 +291,10 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) | ||
2341 | int cpu, err; | ||
2342 | |||
2343 | err = of_property_read_u32(dn, "reg", &cpu); | ||
2344 | - if (WARN_ON(err)) | ||
2345 | + if (WARN_ON(err)) { | ||
2346 | + of_node_put(dn); | ||
2347 | return err; | ||
2348 | + } | ||
2349 | |||
2350 | cluster_index = cpu & APN806_CLUSTER_NUM_MASK; | ||
2351 | cluster_index >>= APN806_CLUSTER_NUM_OFFSET; | ||
2352 | @@ -301,6 +306,7 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) | ||
2353 | parent = of_clk_get(np, cluster_index); | ||
2354 | if (IS_ERR(parent)) { | ||
2355 | dev_err(dev, "Could not get the clock parent\n"); | ||
2356 | + of_node_put(dn); | ||
2357 | return -EINVAL; | ||
2358 | } | ||
2359 | parent_name = __clk_get_name(parent); | ||
2360 | @@ -319,8 +325,10 @@ static int ap_cpu_clock_probe(struct platform_device *pdev) | ||
2361 | init.parent_names = &parent_name; | ||
2362 | |||
2363 | ret = devm_clk_hw_register(dev, &ap_cpu_clk[cluster_index].hw); | ||
2364 | - if (ret) | ||
2365 | + if (ret) { | ||
2366 | + of_node_put(dn); | ||
2367 | return ret; | ||
2368 | + } | ||
2369 | ap_cpu_data->hws[cluster_index] = &ap_cpu_clk[cluster_index].hw; | ||
2370 | } | ||
2371 | |||
2372 | diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig | ||
2373 | index 3bb5625504e2f..9bfe4c5af87e3 100644 | ||
2374 | --- a/drivers/clocksource/Kconfig | ||
2375 | +++ b/drivers/clocksource/Kconfig | ||
2376 | @@ -24,6 +24,7 @@ config I8253_LOCK | ||
2377 | |||
2378 | config OMAP_DM_TIMER | ||
2379 | bool | ||
2380 | + select TIMER_OF | ||
2381 | |||
2382 | config CLKBLD_I8253 | ||
2383 | def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK | ||
2384 | diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c | ||
2385 | index f8747322b3c70..e591f56f98c03 100644 | ||
2386 | --- a/drivers/cpuidle/sysfs.c | ||
2387 | +++ b/drivers/cpuidle/sysfs.c | ||
2388 | @@ -481,6 +481,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) | ||
2389 | &kdev->kobj, "state%d", i); | ||
2390 | if (ret) { | ||
2391 | kobject_put(&kobj->kobj); | ||
2392 | + kfree(kobj); | ||
2393 | goto error_state; | ||
2394 | } | ||
2395 | cpuidle_add_s2idle_attr_group(kobj); | ||
2396 | @@ -612,6 +613,7 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev) | ||
2397 | &kdev->kobj, "driver"); | ||
2398 | if (ret) { | ||
2399 | kobject_put(&kdrv->kobj); | ||
2400 | + kfree(kdrv); | ||
2401 | return ret; | ||
2402 | } | ||
2403 | |||
2404 | @@ -698,7 +700,6 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev) | ||
2405 | if (!kdev) | ||
2406 | return -ENOMEM; | ||
2407 | kdev->dev = dev; | ||
2408 | - dev->kobj_dev = kdev; | ||
2409 | |||
2410 | init_completion(&kdev->kobj_unregister); | ||
2411 | |||
2412 | @@ -706,9 +707,11 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev) | ||
2413 | "cpuidle"); | ||
2414 | if (error) { | ||
2415 | kobject_put(&kdev->kobj); | ||
2416 | + kfree(kdev); | ||
2417 | return error; | ||
2418 | } | ||
2419 | |||
2420 | + dev->kobj_dev = kdev; | ||
2421 | kobject_uevent(&kdev->kobj, KOBJ_ADD); | ||
2422 | |||
2423 | return 0; | ||
2424 | diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c | ||
2425 | index 83f96d4f86e03..30e3f41ed8721 100644 | ||
2426 | --- a/drivers/crypto/caam/caampkc.c | ||
2427 | +++ b/drivers/crypto/caam/caampkc.c | ||
2428 | @@ -1087,16 +1087,27 @@ static struct caam_akcipher_alg caam_rsa = { | ||
2429 | int caam_pkc_init(struct device *ctrldev) | ||
2430 | { | ||
2431 | struct caam_drv_private *priv = dev_get_drvdata(ctrldev); | ||
2432 | - u32 pk_inst; | ||
2433 | + u32 pk_inst, pkha; | ||
2434 | int err; | ||
2435 | init_done = false; | ||
2436 | |||
2437 | /* Determine public key hardware accelerator presence. */ | ||
2438 | - if (priv->era < 10) | ||
2439 | + if (priv->era < 10) { | ||
2440 | pk_inst = (rd_reg32(&priv->ctrl->perfmon.cha_num_ls) & | ||
2441 | CHA_ID_LS_PK_MASK) >> CHA_ID_LS_PK_SHIFT; | ||
2442 | - else | ||
2443 | - pk_inst = rd_reg32(&priv->ctrl->vreg.pkha) & CHA_VER_NUM_MASK; | ||
2444 | + } else { | ||
2445 | + pkha = rd_reg32(&priv->ctrl->vreg.pkha); | ||
2446 | + pk_inst = pkha & CHA_VER_NUM_MASK; | ||
2447 | + | ||
2448 | + /* | ||
2449 | + * Newer CAAMs support partially disabled functionality. If this is the | ||
2450 | + * case, the number is non-zero, but this bit is set to indicate that | ||
2451 | + * no encryption or decryption is supported. Only signing and verifying | ||
2452 | + * is supported. | ||
2453 | + */ | ||
2454 | + if (pkha & CHA_VER_MISC_PKHA_NO_CRYPT) | ||
2455 | + pk_inst = 0; | ||
2456 | + } | ||
2457 | |||
2458 | /* Do not register algorithms if PKHA is not present. */ | ||
2459 | if (!pk_inst) | ||
2460 | diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h | ||
2461 | index 05127b70527d7..43975f01465d2 100644 | ||
2462 | --- a/drivers/crypto/caam/regs.h | ||
2463 | +++ b/drivers/crypto/caam/regs.h | ||
2464 | @@ -317,6 +317,9 @@ struct version_regs { | ||
2465 | /* CHA Miscellaneous Information - AESA_MISC specific */ | ||
2466 | #define CHA_VER_MISC_AES_GCM BIT(1 + CHA_VER_MISC_SHIFT) | ||
2467 | |||
2468 | +/* CHA Miscellaneous Information - PKHA_MISC specific */ | ||
2469 | +#define CHA_VER_MISC_PKHA_NO_CRYPT BIT(7 + CHA_VER_MISC_SHIFT) | ||
2470 | + | ||
2471 | /* | ||
2472 | * caam_perfmon - Performance Monitor/Secure Memory Status/ | ||
2473 | * CAAM Global Status/Component Version IDs | ||
2474 | diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | ||
2475 | index c64481160b711..180016e157771 100644 | ||
2476 | --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | ||
2477 | +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | ||
2478 | @@ -195,6 +195,13 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) | ||
2479 | val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); | ||
2480 | } while ((val & int_bit) && (count++ < ADF_IOV_MSG_ACK_MAX_RETRY)); | ||
2481 | |||
2482 | + if (val != msg) { | ||
2483 | + dev_dbg(&GET_DEV(accel_dev), | ||
2484 | + "Collision - PFVF CSR overwritten by remote function\n"); | ||
2485 | + ret = -EIO; | ||
2486 | + goto out; | ||
2487 | + } | ||
2488 | + | ||
2489 | if (val & int_bit) { | ||
2490 | dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); | ||
2491 | val &= ~int_bit; | ||
2492 | @@ -243,6 +250,11 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info) | ||
2493 | |||
2494 | /* Read message from the VF */ | ||
2495 | msg = ADF_CSR_RD(pmisc_addr, hw_data->get_pf2vf_offset(vf_nr)); | ||
2496 | + if (!(msg & ADF_VF2PF_INT)) { | ||
2497 | + dev_info(&GET_DEV(accel_dev), | ||
2498 | + "Spurious VF2PF interrupt, msg %X. Ignored\n", msg); | ||
2499 | + goto out; | ||
2500 | + } | ||
2501 | |||
2502 | /* To ACK, clear the VF2PFINT bit */ | ||
2503 | msg &= ~ADF_VF2PF_INT; | ||
2504 | @@ -326,6 +338,7 @@ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info) | ||
2505 | if (resp && adf_iov_putmsg(accel_dev, resp, vf_nr)) | ||
2506 | dev_err(&GET_DEV(accel_dev), "Failed to send response to VF\n"); | ||
2507 | |||
2508 | +out: | ||
2509 | /* re-enable interrupt on PF from this VF */ | ||
2510 | adf_enable_vf2pf_interrupts(accel_dev, (1 << vf_nr)); | ||
2511 | return; | ||
2512 | diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c | ||
2513 | index ef90902c8200d..86274e3c6781d 100644 | ||
2514 | --- a/drivers/crypto/qat/qat_common/adf_vf_isr.c | ||
2515 | +++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c | ||
2516 | @@ -123,6 +123,11 @@ static void adf_pf2vf_bh_handler(void *data) | ||
2517 | |||
2518 | /* Read the message from PF */ | ||
2519 | msg = ADF_CSR_RD(pmisc_bar_addr, hw_data->get_pf2vf_offset(0)); | ||
2520 | + if (!(msg & ADF_PF2VF_INT)) { | ||
2521 | + dev_info(&GET_DEV(accel_dev), | ||
2522 | + "Spurious PF2VF interrupt, msg %X. Ignored\n", msg); | ||
2523 | + goto out; | ||
2524 | + } | ||
2525 | |||
2526 | if (!(msg & ADF_PF2VF_MSGORIGIN_SYSTEM)) | ||
2527 | /* Ignore legacy non-system (non-kernel) PF2VF messages */ | ||
2528 | @@ -171,6 +176,7 @@ static void adf_pf2vf_bh_handler(void *data) | ||
2529 | msg &= ~ADF_PF2VF_INT; | ||
2530 | ADF_CSR_WR(pmisc_bar_addr, hw_data->get_pf2vf_offset(0), msg); | ||
2531 | |||
2532 | +out: | ||
2533 | /* Re-enable PF2VF interrupts */ | ||
2534 | adf_enable_pf2vf_interrupts(accel_dev); | ||
2535 | return; | ||
2536 | diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c | ||
2537 | index 010f1bb20dada..86a13b738c2de 100644 | ||
2538 | --- a/drivers/crypto/s5p-sss.c | ||
2539 | +++ b/drivers/crypto/s5p-sss.c | ||
2540 | @@ -2208,6 +2208,8 @@ static int s5p_aes_probe(struct platform_device *pdev) | ||
2541 | |||
2542 | variant = find_s5p_sss_version(pdev); | ||
2543 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
2544 | + if (!res) | ||
2545 | + return -EINVAL; | ||
2546 | |||
2547 | /* | ||
2548 | * Note: HASH and PRNG uses the same registers in secss, avoid | ||
2549 | diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c | ||
2550 | index 758de0e9b2ddc..16bbc9bc9e6d1 100644 | ||
2551 | --- a/drivers/dma-buf/dma-buf.c | ||
2552 | +++ b/drivers/dma-buf/dma-buf.c | ||
2553 | @@ -79,6 +79,7 @@ static void dma_buf_release(struct dentry *dentry) | ||
2554 | if (dmabuf->resv == (struct dma_resv *)&dmabuf[1]) | ||
2555 | dma_resv_fini(dmabuf->resv); | ||
2556 | |||
2557 | + WARN_ON(!list_empty(&dmabuf->attachments)); | ||
2558 | module_put(dmabuf->owner); | ||
2559 | kfree(dmabuf->name); | ||
2560 | kfree(dmabuf); | ||
2561 | diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c | ||
2562 | index b58ac720d9a12..6f1e97ba3e786 100644 | ||
2563 | --- a/drivers/dma/at_xdmac.c | ||
2564 | +++ b/drivers/dma/at_xdmac.c | ||
2565 | @@ -145,7 +145,7 @@ | ||
2566 | #define AT_XDMAC_CC_WRIP (0x1 << 23) /* Write in Progress (read only) */ | ||
2567 | #define AT_XDMAC_CC_WRIP_DONE (0x0 << 23) | ||
2568 | #define AT_XDMAC_CC_WRIP_IN_PROGRESS (0x1 << 23) | ||
2569 | -#define AT_XDMAC_CC_PERID(i) (0x7f & (i) << 24) /* Channel Peripheral Identifier */ | ||
2570 | +#define AT_XDMAC_CC_PERID(i) ((0x7f & (i)) << 24) /* Channel Peripheral Identifier */ | ||
2571 | #define AT_XDMAC_CDS_MSP 0x2C /* Channel Data Stride Memory Set Pattern */ | ||
2572 | #define AT_XDMAC_CSUS 0x30 /* Channel Source Microblock Stride */ | ||
2573 | #define AT_XDMAC_CDUS 0x34 /* Channel Destination Microblock Stride */ | ||
2574 | diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h | ||
2575 | index 501c0b063f852..302f13efd35d9 100644 | ||
2576 | --- a/drivers/dma/dmaengine.h | ||
2577 | +++ b/drivers/dma/dmaengine.h | ||
2578 | @@ -168,7 +168,7 @@ dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx, | ||
2579 | static inline bool | ||
2580 | dmaengine_desc_callback_valid(struct dmaengine_desc_callback *cb) | ||
2581 | { | ||
2582 | - return (cb->callback) ? true : false; | ||
2583 | + return cb->callback || cb->callback_result; | ||
2584 | } | ||
2585 | |||
2586 | #endif | ||
2587 | diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c | ||
2588 | index aed0f26c9af5d..ac4a5015c146b 100644 | ||
2589 | --- a/drivers/edac/amd64_edac.c | ||
2590 | +++ b/drivers/edac/amd64_edac.c | ||
2591 | @@ -797,12 +797,14 @@ static void debug_dump_dramcfg_low(struct amd64_pvt *pvt, u32 dclr, int chan) | ||
2592 | #define CS_ODD_PRIMARY BIT(1) | ||
2593 | #define CS_EVEN_SECONDARY BIT(2) | ||
2594 | #define CS_ODD_SECONDARY BIT(3) | ||
2595 | +#define CS_3R_INTERLEAVE BIT(4) | ||
2596 | |||
2597 | #define CS_EVEN (CS_EVEN_PRIMARY | CS_EVEN_SECONDARY) | ||
2598 | #define CS_ODD (CS_ODD_PRIMARY | CS_ODD_SECONDARY) | ||
2599 | |||
2600 | static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) | ||
2601 | { | ||
2602 | + u8 base, count = 0; | ||
2603 | int cs_mode = 0; | ||
2604 | |||
2605 | if (csrow_enabled(2 * dimm, ctrl, pvt)) | ||
2606 | @@ -815,6 +817,20 @@ static int f17_get_cs_mode(int dimm, u8 ctrl, struct amd64_pvt *pvt) | ||
2607 | if (csrow_sec_enabled(2 * dimm + 1, ctrl, pvt)) | ||
2608 | cs_mode |= CS_ODD_SECONDARY; | ||
2609 | |||
2610 | + /* | ||
2611 | + * 3 Rank inteleaving support. | ||
2612 | + * There should be only three bases enabled and their two masks should | ||
2613 | + * be equal. | ||
2614 | + */ | ||
2615 | + for_each_chip_select(base, ctrl, pvt) | ||
2616 | + count += csrow_enabled(base, ctrl, pvt); | ||
2617 | + | ||
2618 | + if (count == 3 && | ||
2619 | + pvt->csels[ctrl].csmasks[0] == pvt->csels[ctrl].csmasks[1]) { | ||
2620 | + edac_dbg(1, "3R interleaving in use.\n"); | ||
2621 | + cs_mode |= CS_3R_INTERLEAVE; | ||
2622 | + } | ||
2623 | + | ||
2624 | return cs_mode; | ||
2625 | } | ||
2626 | |||
2627 | @@ -1623,10 +1639,14 @@ static int f17_addr_mask_to_cs_size(struct amd64_pvt *pvt, u8 umc, | ||
2628 | * | ||
2629 | * The MSB is the number of bits in the full mask because BIT[0] is | ||
2630 | * always 0. | ||
2631 | + * | ||
2632 | + * In the special 3 Rank interleaving case, a single bit is flipped | ||
2633 | + * without swapping with the most significant bit. This can be handled | ||
2634 | + * by keeping the MSB where it is and ignoring the single zero bit. | ||
2635 | */ | ||
2636 | msb = fls(addr_mask_orig) - 1; | ||
2637 | weight = hweight_long(addr_mask_orig); | ||
2638 | - num_zero_bits = msb - weight; | ||
2639 | + num_zero_bits = msb - weight - !!(cs_mode & CS_3R_INTERLEAVE); | ||
2640 | |||
2641 | /* Take the number of zero bits off from the top of the mask. */ | ||
2642 | addr_mask_deinterleaved = GENMASK_ULL(msb - num_zero_bits, 1); | ||
2643 | diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c | ||
2644 | index d39f5bfb8bd92..b0b280eef1d00 100644 | ||
2645 | --- a/drivers/edac/sb_edac.c | ||
2646 | +++ b/drivers/edac/sb_edac.c | ||
2647 | @@ -1055,7 +1055,7 @@ static u64 haswell_get_tohm(struct sbridge_pvt *pvt) | ||
2648 | pci_read_config_dword(pvt->info.pci_vtd, HASWELL_TOHM_1, ®); | ||
2649 | rc = ((reg << 6) | rc) << 26; | ||
2650 | |||
2651 | - return rc | 0x1ffffff; | ||
2652 | + return rc | 0x3ffffff; | ||
2653 | } | ||
2654 | |||
2655 | static u64 knl_get_tolm(struct sbridge_pvt *pvt) | ||
2656 | diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c | ||
2657 | index 03eb798ad3ed9..250b7232f9816 100644 | ||
2658 | --- a/drivers/firmware/psci/psci_checker.c | ||
2659 | +++ b/drivers/firmware/psci/psci_checker.c | ||
2660 | @@ -155,7 +155,7 @@ static int alloc_init_cpu_groups(cpumask_var_t **pcpu_groups) | ||
2661 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) | ||
2662 | return -ENOMEM; | ||
2663 | |||
2664 | - cpu_groups = kcalloc(nb_available_cpus, sizeof(cpu_groups), | ||
2665 | + cpu_groups = kcalloc(nb_available_cpus, sizeof(*cpu_groups), | ||
2666 | GFP_KERNEL); | ||
2667 | if (!cpu_groups) { | ||
2668 | free_cpumask_var(tmp); | ||
2669 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | ||
2670 | index 85b0515c0fdcf..e0d2f79571ef5 100644 | ||
2671 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | ||
2672 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | ||
2673 | @@ -61,7 +61,7 @@ static void amdgpu_bo_list_free(struct kref *ref) | ||
2674 | |||
2675 | int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, | ||
2676 | struct drm_amdgpu_bo_list_entry *info, | ||
2677 | - unsigned num_entries, struct amdgpu_bo_list **result) | ||
2678 | + size_t num_entries, struct amdgpu_bo_list **result) | ||
2679 | { | ||
2680 | unsigned last_entry = 0, first_userptr = num_entries; | ||
2681 | struct amdgpu_bo_list_entry *array; | ||
2682 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h | ||
2683 | index a130e766cbdbe..529d52a204cf4 100644 | ||
2684 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h | ||
2685 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h | ||
2686 | @@ -60,7 +60,7 @@ int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in, | ||
2687 | int amdgpu_bo_list_create(struct amdgpu_device *adev, | ||
2688 | struct drm_file *filp, | ||
2689 | struct drm_amdgpu_bo_list_entry *info, | ||
2690 | - unsigned num_entries, | ||
2691 | + size_t num_entries, | ||
2692 | struct amdgpu_bo_list **list); | ||
2693 | |||
2694 | static inline struct amdgpu_bo_list_entry * | ||
2695 | diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | ||
2696 | index 9fb1765e92d15..e9f5de35f7953 100644 | ||
2697 | --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | ||
2698 | +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | ||
2699 | @@ -863,12 +863,12 @@ static int gmc_v6_0_sw_init(void *handle) | ||
2700 | |||
2701 | adev->gmc.mc_mask = 0xffffffffffULL; | ||
2702 | |||
2703 | - r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44)); | ||
2704 | + r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40)); | ||
2705 | if (r) { | ||
2706 | dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n"); | ||
2707 | return r; | ||
2708 | } | ||
2709 | - adev->need_swiotlb = drm_need_swiotlb(44); | ||
2710 | + adev->need_swiotlb = drm_need_swiotlb(40); | ||
2711 | |||
2712 | r = gmc_v6_0_init_microcode(adev); | ||
2713 | if (r) { | ||
2714 | diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c | ||
2715 | index f6bdec7fa9253..a950d5db211c5 100644 | ||
2716 | --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c | ||
2717 | +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c | ||
2718 | @@ -109,6 +109,12 @@ static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { | ||
2719 | .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, | ||
2720 | }; | ||
2721 | |||
2722 | +static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = { | ||
2723 | + .width = 1280, | ||
2724 | + .height = 1920, | ||
2725 | + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, | ||
2726 | +}; | ||
2727 | + | ||
2728 | static const struct dmi_system_id orientation_data[] = { | ||
2729 | { /* Acer One 10 (S1003) */ | ||
2730 | .matches = { | ||
2731 | @@ -134,6 +140,12 @@ static const struct dmi_system_id orientation_data[] = { | ||
2732 | DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), | ||
2733 | }, | ||
2734 | .driver_data = (void *)&lcd800x1280_rightside_up, | ||
2735 | + }, { /* AYA NEO 2021 */ | ||
2736 | + .matches = { | ||
2737 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYADEVICE"), | ||
2738 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"), | ||
2739 | + }, | ||
2740 | + .driver_data = (void *)&lcd800x1280_rightside_up, | ||
2741 | }, { /* GPD MicroPC (generic strings, also match on bios date) */ | ||
2742 | .matches = { | ||
2743 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), | ||
2744 | @@ -185,6 +197,12 @@ static const struct dmi_system_id orientation_data[] = { | ||
2745 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), | ||
2746 | }, | ||
2747 | .driver_data = (void *)&gpd_win2, | ||
2748 | + }, { /* GPD Win 3 */ | ||
2749 | + .matches = { | ||
2750 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"), | ||
2751 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "G1618-03") | ||
2752 | + }, | ||
2753 | + .driver_data = (void *)&lcd720x1280_rightside_up, | ||
2754 | }, { /* I.T.Works TW891 */ | ||
2755 | .matches = { | ||
2756 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."), | ||
2757 | @@ -193,6 +211,13 @@ static const struct dmi_system_id orientation_data[] = { | ||
2758 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "TW891"), | ||
2759 | }, | ||
2760 | .driver_data = (void *)&itworks_tw891, | ||
2761 | + }, { /* KD Kurio Smart C15200 2-in-1 */ | ||
2762 | + .matches = { | ||
2763 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "KD Interactive"), | ||
2764 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Kurio Smart"), | ||
2765 | + DMI_EXACT_MATCH(DMI_BOARD_NAME, "KDM960BCP"), | ||
2766 | + }, | ||
2767 | + .driver_data = (void *)&lcd800x1280_rightside_up, | ||
2768 | }, { /* | ||
2769 | * Lenovo Ideapad Miix 310 laptop, only some production batches | ||
2770 | * have a portrait screen, the resolution checks makes the quirk | ||
2771 | @@ -211,10 +236,15 @@ static const struct dmi_system_id orientation_data[] = { | ||
2772 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), | ||
2773 | }, | ||
2774 | .driver_data = (void *)&lcd800x1280_rightside_up, | ||
2775 | - }, { /* Lenovo Ideapad D330 */ | ||
2776 | + }, { /* Lenovo Ideapad D330-10IGM (HD) */ | ||
2777 | + .matches = { | ||
2778 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
2779 | + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), | ||
2780 | + }, | ||
2781 | + .driver_data = (void *)&lcd800x1280_rightside_up, | ||
2782 | + }, { /* Lenovo Ideapad D330-10IGM (FHD) */ | ||
2783 | .matches = { | ||
2784 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
2785 | - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "81H3"), | ||
2786 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), | ||
2787 | }, | ||
2788 | .driver_data = (void *)&lcd1200x1920_rightside_up, | ||
2789 | @@ -225,6 +255,19 @@ static const struct dmi_system_id orientation_data[] = { | ||
2790 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), | ||
2791 | }, | ||
2792 | .driver_data = (void *)&onegx1_pro, | ||
2793 | + }, { /* Samsung GalaxyBook 10.6 */ | ||
2794 | + .matches = { | ||
2795 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
2796 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"), | ||
2797 | + }, | ||
2798 | + .driver_data = (void *)&lcd1280x1920_rightside_up, | ||
2799 | + }, { /* Valve Steam Deck */ | ||
2800 | + .matches = { | ||
2801 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"), | ||
2802 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"), | ||
2803 | + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"), | ||
2804 | + }, | ||
2805 | + .driver_data = (void *)&lcd800x1280_rightside_up, | ||
2806 | }, { /* VIOS LTH17 */ | ||
2807 | .matches = { | ||
2808 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"), | ||
2809 | diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c | ||
2810 | index 3aae7ea522f23..c3f2292dc93d5 100644 | ||
2811 | --- a/drivers/gpu/drm/drm_plane_helper.c | ||
2812 | +++ b/drivers/gpu/drm/drm_plane_helper.c | ||
2813 | @@ -123,7 +123,6 @@ static int drm_plane_helper_check_update(struct drm_plane *plane, | ||
2814 | .crtc_w = drm_rect_width(dst), | ||
2815 | .crtc_h = drm_rect_height(dst), | ||
2816 | .rotation = rotation, | ||
2817 | - .visible = *visible, | ||
2818 | }; | ||
2819 | struct drm_crtc_state crtc_state = { | ||
2820 | .crtc = crtc, | ||
2821 | diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | ||
2822 | index 4f8b813aab810..8256f06218d0f 100644 | ||
2823 | --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | ||
2824 | +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | ||
2825 | @@ -137,11 +137,13 @@ static int _sspp_subblk_offset(struct dpu_hw_pipe *ctx, | ||
2826 | u32 *idx) | ||
2827 | { | ||
2828 | int rc = 0; | ||
2829 | - const struct dpu_sspp_sub_blks *sblk = ctx->cap->sblk; | ||
2830 | + const struct dpu_sspp_sub_blks *sblk; | ||
2831 | |||
2832 | - if (!ctx) | ||
2833 | + if (!ctx || !ctx->cap || !ctx->cap->sblk) | ||
2834 | return -EINVAL; | ||
2835 | |||
2836 | + sblk = ctx->cap->sblk; | ||
2837 | + | ||
2838 | switch (s_id) { | ||
2839 | case DPU_SSPP_SRC: | ||
2840 | *idx = sblk->src_blk.base; | ||
2841 | @@ -404,7 +406,7 @@ static void _dpu_hw_sspp_setup_scaler3(struct dpu_hw_pipe *ctx, | ||
2842 | |||
2843 | (void)pe; | ||
2844 | if (_sspp_subblk_offset(ctx, DPU_SSPP_SCALER_QSEED3, &idx) || !sspp | ||
2845 | - || !scaler3_cfg || !ctx || !ctx->cap || !ctx->cap->sblk) | ||
2846 | + || !scaler3_cfg) | ||
2847 | return; | ||
2848 | |||
2849 | dpu_hw_setup_scaler3(&ctx->hw, scaler3_cfg, idx, | ||
2850 | diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c | ||
2851 | index d92a0ffe2a767..8e6a4d5f3a405 100644 | ||
2852 | --- a/drivers/gpu/drm/msm/msm_gem.c | ||
2853 | +++ b/drivers/gpu/drm/msm/msm_gem.c | ||
2854 | @@ -1036,7 +1036,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, | ||
2855 | |||
2856 | ret = msm_gem_new_impl(dev, size, flags, &obj); | ||
2857 | if (ret) | ||
2858 | - goto fail; | ||
2859 | + return ERR_PTR(ret); | ||
2860 | |||
2861 | msm_obj = to_msm_bo(obj); | ||
2862 | |||
2863 | @@ -1124,7 +1124,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, | ||
2864 | |||
2865 | ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj); | ||
2866 | if (ret) | ||
2867 | - goto fail; | ||
2868 | + return ERR_PTR(ret); | ||
2869 | |||
2870 | drm_gem_private_object_init(dev, obj, size); | ||
2871 | |||
2872 | diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c | ||
2873 | index 19c092d75266b..1609a85429cef 100644 | ||
2874 | --- a/drivers/gpu/drm/v3d/v3d_gem.c | ||
2875 | +++ b/drivers/gpu/drm/v3d/v3d_gem.c | ||
2876 | @@ -195,8 +195,8 @@ v3d_clean_caches(struct v3d_dev *v3d) | ||
2877 | |||
2878 | V3D_CORE_WRITE(core, V3D_CTL_L2TCACTL, V3D_L2TCACTL_TMUWCF); | ||
2879 | if (wait_for(!(V3D_CORE_READ(core, V3D_CTL_L2TCACTL) & | ||
2880 | - V3D_L2TCACTL_L2TFLS), 100)) { | ||
2881 | - DRM_ERROR("Timeout waiting for L1T write combiner flush\n"); | ||
2882 | + V3D_L2TCACTL_TMUWCF), 100)) { | ||
2883 | + DRM_ERROR("Timeout waiting for TMU write combiner flush\n"); | ||
2884 | } | ||
2885 | |||
2886 | mutex_lock(&v3d->cache_clean_lock); | ||
2887 | diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c | ||
2888 | index bb46e7a0f1b5d..0ca996e6fd5cb 100644 | ||
2889 | --- a/drivers/gpu/drm/virtio/virtgpu_vq.c | ||
2890 | +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c | ||
2891 | @@ -80,9 +80,7 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev, | ||
2892 | { | ||
2893 | struct virtio_gpu_vbuffer *vbuf; | ||
2894 | |||
2895 | - vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL); | ||
2896 | - if (!vbuf) | ||
2897 | - return ERR_PTR(-ENOMEM); | ||
2898 | + vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL | __GFP_NOFAIL); | ||
2899 | |||
2900 | BUG_ON(size > MAX_INLINE_CMD_SIZE); | ||
2901 | vbuf->buf = (void *)vbuf + sizeof(*vbuf); | ||
2902 | @@ -142,10 +140,6 @@ static void *virtio_gpu_alloc_cmd_resp(struct virtio_gpu_device *vgdev, | ||
2903 | |||
2904 | vbuf = virtio_gpu_get_vbuf(vgdev, cmd_size, | ||
2905 | resp_size, resp_buf, cb); | ||
2906 | - if (IS_ERR(vbuf)) { | ||
2907 | - *vbuffer_p = NULL; | ||
2908 | - return ERR_CAST(vbuf); | ||
2909 | - } | ||
2910 | *vbuffer_p = vbuf; | ||
2911 | return (struct virtio_gpu_command *)vbuf->buf; | ||
2912 | } | ||
2913 | diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c | ||
2914 | index d70cd3d7f583b..67ae2b18e33ac 100644 | ||
2915 | --- a/drivers/hid/hid-u2fzero.c | ||
2916 | +++ b/drivers/hid/hid-u2fzero.c | ||
2917 | @@ -132,7 +132,7 @@ static int u2fzero_recv(struct u2fzero_device *dev, | ||
2918 | |||
2919 | ret = (wait_for_completion_timeout( | ||
2920 | &ctx.done, msecs_to_jiffies(USB_CTRL_SET_TIMEOUT))); | ||
2921 | - if (ret < 0) { | ||
2922 | + if (ret == 0) { | ||
2923 | usb_kill_urb(dev->urb); | ||
2924 | hid_err(hdev, "urb submission timed out"); | ||
2925 | } else { | ||
2926 | @@ -191,6 +191,8 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data, | ||
2927 | struct u2f_hid_msg resp; | ||
2928 | int ret; | ||
2929 | size_t actual_length; | ||
2930 | + /* valid packets must have a correct header */ | ||
2931 | + int min_length = offsetof(struct u2f_hid_msg, init.data); | ||
2932 | |||
2933 | if (!dev->present) { | ||
2934 | hid_dbg(dev->hdev, "device not present"); | ||
2935 | @@ -200,12 +202,12 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data, | ||
2936 | ret = u2fzero_recv(dev, &req, &resp); | ||
2937 | |||
2938 | /* ignore errors or packets without data */ | ||
2939 | - if (ret < offsetof(struct u2f_hid_msg, init.data)) | ||
2940 | + if (ret < min_length) | ||
2941 | return 0; | ||
2942 | |||
2943 | /* only take the minimum amount of data it is safe to take */ | ||
2944 | - actual_length = min3((size_t)ret - offsetof(struct u2f_hid_msg, | ||
2945 | - init.data), U2F_HID_MSG_LEN(resp), max); | ||
2946 | + actual_length = min3((size_t)ret - min_length, | ||
2947 | + U2F_HID_MSG_LEN(resp), max); | ||
2948 | |||
2949 | memcpy(data, resp.init.data, actual_length); | ||
2950 | |||
2951 | diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h | ||
2952 | index cabcb66e7c5ef..356382a340b2c 100644 | ||
2953 | --- a/drivers/hv/hyperv_vmbus.h | ||
2954 | +++ b/drivers/hv/hyperv_vmbus.h | ||
2955 | @@ -13,6 +13,7 @@ | ||
2956 | #define _HYPERV_VMBUS_H | ||
2957 | |||
2958 | #include <linux/list.h> | ||
2959 | +#include <linux/bitops.h> | ||
2960 | #include <asm/sync_bitops.h> | ||
2961 | #include <asm/hyperv-tlfs.h> | ||
2962 | #include <linux/atomic.h> | ||
2963 | diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c | ||
2964 | index d018b20089ecd..a2175394cd253 100644 | ||
2965 | --- a/drivers/hwmon/hwmon.c | ||
2966 | +++ b/drivers/hwmon/hwmon.c | ||
2967 | @@ -645,8 +645,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, | ||
2968 | dev_set_drvdata(hdev, drvdata); | ||
2969 | dev_set_name(hdev, HWMON_ID_FORMAT, id); | ||
2970 | err = device_register(hdev); | ||
2971 | - if (err) | ||
2972 | - goto free_hwmon; | ||
2973 | + if (err) { | ||
2974 | + put_device(hdev); | ||
2975 | + goto ida_remove; | ||
2976 | + } | ||
2977 | |||
2978 | if (dev && dev->of_node && chip && chip->ops->read && | ||
2979 | chip->info[0]->type == hwmon_chip && | ||
2980 | diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c | ||
2981 | index 05fce86f1f817..41c4bbb9c0572 100644 | ||
2982 | --- a/drivers/hwmon/pmbus/lm25066.c | ||
2983 | +++ b/drivers/hwmon/pmbus/lm25066.c | ||
2984 | @@ -51,26 +51,31 @@ struct __coeff { | ||
2985 | #define PSC_CURRENT_IN_L (PSC_NUM_CLASSES) | ||
2986 | #define PSC_POWER_L (PSC_NUM_CLASSES + 1) | ||
2987 | |||
2988 | -static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { | ||
2989 | +static struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { | ||
2990 | [lm25056] = { | ||
2991 | [PSC_VOLTAGE_IN] = { | ||
2992 | .m = 16296, | ||
2993 | + .b = 1343, | ||
2994 | .R = -2, | ||
2995 | }, | ||
2996 | [PSC_CURRENT_IN] = { | ||
2997 | .m = 13797, | ||
2998 | + .b = -1833, | ||
2999 | .R = -2, | ||
3000 | }, | ||
3001 | [PSC_CURRENT_IN_L] = { | ||
3002 | .m = 6726, | ||
3003 | + .b = -537, | ||
3004 | .R = -2, | ||
3005 | }, | ||
3006 | [PSC_POWER] = { | ||
3007 | .m = 5501, | ||
3008 | + .b = -2908, | ||
3009 | .R = -3, | ||
3010 | }, | ||
3011 | [PSC_POWER_L] = { | ||
3012 | .m = 26882, | ||
3013 | + .b = -5646, | ||
3014 | .R = -4, | ||
3015 | }, | ||
3016 | [PSC_TEMPERATURE] = { | ||
3017 | @@ -82,26 +87,32 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { | ||
3018 | [lm25066] = { | ||
3019 | [PSC_VOLTAGE_IN] = { | ||
3020 | .m = 22070, | ||
3021 | + .b = -1800, | ||
3022 | .R = -2, | ||
3023 | }, | ||
3024 | [PSC_VOLTAGE_OUT] = { | ||
3025 | .m = 22070, | ||
3026 | + .b = -1800, | ||
3027 | .R = -2, | ||
3028 | }, | ||
3029 | [PSC_CURRENT_IN] = { | ||
3030 | .m = 13661, | ||
3031 | + .b = -5200, | ||
3032 | .R = -2, | ||
3033 | }, | ||
3034 | [PSC_CURRENT_IN_L] = { | ||
3035 | .m = 6852, | ||
3036 | + .b = -3100, | ||
3037 | .R = -2, | ||
3038 | }, | ||
3039 | [PSC_POWER] = { | ||
3040 | .m = 736, | ||
3041 | + .b = -3300, | ||
3042 | .R = -2, | ||
3043 | }, | ||
3044 | [PSC_POWER_L] = { | ||
3045 | .m = 369, | ||
3046 | + .b = -1900, | ||
3047 | .R = -2, | ||
3048 | }, | ||
3049 | [PSC_TEMPERATURE] = { | ||
3050 | @@ -111,26 +122,32 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { | ||
3051 | [lm5064] = { | ||
3052 | [PSC_VOLTAGE_IN] = { | ||
3053 | .m = 4611, | ||
3054 | + .b = -642, | ||
3055 | .R = -2, | ||
3056 | }, | ||
3057 | [PSC_VOLTAGE_OUT] = { | ||
3058 | .m = 4621, | ||
3059 | + .b = 423, | ||
3060 | .R = -2, | ||
3061 | }, | ||
3062 | [PSC_CURRENT_IN] = { | ||
3063 | .m = 10742, | ||
3064 | + .b = 1552, | ||
3065 | .R = -2, | ||
3066 | }, | ||
3067 | [PSC_CURRENT_IN_L] = { | ||
3068 | .m = 5456, | ||
3069 | + .b = 2118, | ||
3070 | .R = -2, | ||
3071 | }, | ||
3072 | [PSC_POWER] = { | ||
3073 | .m = 1204, | ||
3074 | + .b = 8524, | ||
3075 | .R = -3, | ||
3076 | }, | ||
3077 | [PSC_POWER_L] = { | ||
3078 | .m = 612, | ||
3079 | + .b = 11202, | ||
3080 | .R = -3, | ||
3081 | }, | ||
3082 | [PSC_TEMPERATURE] = { | ||
3083 | @@ -140,26 +157,32 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { | ||
3084 | [lm5066] = { | ||
3085 | [PSC_VOLTAGE_IN] = { | ||
3086 | .m = 4587, | ||
3087 | + .b = -1200, | ||
3088 | .R = -2, | ||
3089 | }, | ||
3090 | [PSC_VOLTAGE_OUT] = { | ||
3091 | .m = 4587, | ||
3092 | + .b = -2400, | ||
3093 | .R = -2, | ||
3094 | }, | ||
3095 | [PSC_CURRENT_IN] = { | ||
3096 | .m = 10753, | ||
3097 | + .b = -1200, | ||
3098 | .R = -2, | ||
3099 | }, | ||
3100 | [PSC_CURRENT_IN_L] = { | ||
3101 | .m = 5405, | ||
3102 | + .b = -600, | ||
3103 | .R = -2, | ||
3104 | }, | ||
3105 | [PSC_POWER] = { | ||
3106 | .m = 1204, | ||
3107 | + .b = -6000, | ||
3108 | .R = -3, | ||
3109 | }, | ||
3110 | [PSC_POWER_L] = { | ||
3111 | .m = 605, | ||
3112 | + .b = -8000, | ||
3113 | .R = -3, | ||
3114 | }, | ||
3115 | [PSC_TEMPERATURE] = { | ||
3116 | diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c | ||
3117 | index 34cd4b3085402..dda6cb848405b 100644 | ||
3118 | --- a/drivers/i2c/busses/i2c-xlr.c | ||
3119 | +++ b/drivers/i2c/busses/i2c-xlr.c | ||
3120 | @@ -433,11 +433,15 @@ static int xlr_i2c_probe(struct platform_device *pdev) | ||
3121 | i2c_set_adapdata(&priv->adap, priv); | ||
3122 | ret = i2c_add_numbered_adapter(&priv->adap); | ||
3123 | if (ret < 0) | ||
3124 | - return ret; | ||
3125 | + goto err_unprepare_clk; | ||
3126 | |||
3127 | platform_set_drvdata(pdev, priv); | ||
3128 | dev_info(&priv->adap.dev, "Added I2C Bus.\n"); | ||
3129 | return 0; | ||
3130 | + | ||
3131 | +err_unprepare_clk: | ||
3132 | + clk_unprepare(clk); | ||
3133 | + return ret; | ||
3134 | } | ||
3135 | |||
3136 | static int xlr_i2c_remove(struct platform_device *pdev) | ||
3137 | diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c | ||
3138 | index 61c670f7fc5f1..1f55cd8abb558 100644 | ||
3139 | --- a/drivers/iio/dac/ad5446.c | ||
3140 | +++ b/drivers/iio/dac/ad5446.c | ||
3141 | @@ -527,8 +527,15 @@ static int ad5622_write(struct ad5446_state *st, unsigned val) | ||
3142 | { | ||
3143 | struct i2c_client *client = to_i2c_client(st->dev); | ||
3144 | __be16 data = cpu_to_be16(val); | ||
3145 | + int ret; | ||
3146 | + | ||
3147 | + ret = i2c_master_send(client, (char *)&data, sizeof(data)); | ||
3148 | + if (ret < 0) | ||
3149 | + return ret; | ||
3150 | + if (ret != sizeof(data)) | ||
3151 | + return -EIO; | ||
3152 | |||
3153 | - return i2c_master_send(client, (char *)&data, sizeof(data)); | ||
3154 | + return 0; | ||
3155 | } | ||
3156 | |||
3157 | /** | ||
3158 | diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c | ||
3159 | index 4d07d22bfa7b1..5fc5ab7813c0f 100644 | ||
3160 | --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c | ||
3161 | +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c | ||
3162 | @@ -642,12 +642,13 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res, | ||
3163 | int rc = 0; | ||
3164 | |||
3165 | RCFW_CMD_PREP(req, QUERY_SRQ, cmd_flags); | ||
3166 | - req.srq_cid = cpu_to_le32(srq->id); | ||
3167 | |||
3168 | /* Configure the request */ | ||
3169 | sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); | ||
3170 | if (!sbuf) | ||
3171 | return -ENOMEM; | ||
3172 | + req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS; | ||
3173 | + req.srq_cid = cpu_to_le32(srq->id); | ||
3174 | sb = sbuf->sb; | ||
3175 | rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | ||
3176 | (void *)sbuf, 0); | ||
3177 | diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c | ||
3178 | index 17ce928e41bde..bca5358f3ef29 100644 | ||
3179 | --- a/drivers/infiniband/hw/mlx4/qp.c | ||
3180 | +++ b/drivers/infiniband/hw/mlx4/qp.c | ||
3181 | @@ -1149,8 +1149,10 @@ static int create_qp_common(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, | ||
3182 | if (dev->steering_support == | ||
3183 | MLX4_STEERING_MODE_DEVICE_MANAGED) | ||
3184 | qp->flags |= MLX4_IB_QP_NETIF; | ||
3185 | - else | ||
3186 | + else { | ||
3187 | + err = -EINVAL; | ||
3188 | goto err; | ||
3189 | + } | ||
3190 | } | ||
3191 | |||
3192 | err = set_kernel_sq_size(dev, &init_attr->cap, qp_type, qp); | ||
3193 | diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c | ||
3194 | index 4408d33646647..717f174647647 100644 | ||
3195 | --- a/drivers/infiniband/hw/qedr/verbs.c | ||
3196 | +++ b/drivers/infiniband/hw/qedr/verbs.c | ||
3197 | @@ -2383,15 +2383,18 @@ int qedr_query_qp(struct ib_qp *ibqp, | ||
3198 | int rc = 0; | ||
3199 | |||
3200 | memset(¶ms, 0, sizeof(params)); | ||
3201 | - | ||
3202 | - rc = dev->ops->rdma_query_qp(dev->rdma_ctx, qp->qed_qp, ¶ms); | ||
3203 | - if (rc) | ||
3204 | - goto err; | ||
3205 | - | ||
3206 | memset(qp_attr, 0, sizeof(*qp_attr)); | ||
3207 | memset(qp_init_attr, 0, sizeof(*qp_init_attr)); | ||
3208 | |||
3209 | - qp_attr->qp_state = qedr_get_ibqp_state(params.state); | ||
3210 | + if (qp->qp_type != IB_QPT_GSI) { | ||
3211 | + rc = dev->ops->rdma_query_qp(dev->rdma_ctx, qp->qed_qp, ¶ms); | ||
3212 | + if (rc) | ||
3213 | + goto err; | ||
3214 | + qp_attr->qp_state = qedr_get_ibqp_state(params.state); | ||
3215 | + } else { | ||
3216 | + qp_attr->qp_state = qedr_get_ibqp_state(QED_ROCE_QP_STATE_RTS); | ||
3217 | + } | ||
3218 | + | ||
3219 | qp_attr->cur_qp_state = qedr_get_ibqp_state(params.state); | ||
3220 | qp_attr->path_mtu = ib_mtu_int_to_enum(params.mtu); | ||
3221 | qp_attr->path_mig_state = IB_MIG_MIGRATED; | ||
3222 | diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h | ||
3223 | index fe52073867006..8d3f6d93dfb8d 100644 | ||
3224 | --- a/drivers/infiniband/sw/rxe/rxe_param.h | ||
3225 | +++ b/drivers/infiniband/sw/rxe/rxe_param.h | ||
3226 | @@ -140,7 +140,7 @@ enum rxe_device_param { | ||
3227 | /* default/initial rxe port parameters */ | ||
3228 | enum rxe_port_param { | ||
3229 | RXE_PORT_GID_TBL_LEN = 1024, | ||
3230 | - RXE_PORT_PORT_CAP_FLAGS = RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP, | ||
3231 | + RXE_PORT_PORT_CAP_FLAGS = IB_PORT_CM_SUP, | ||
3232 | RXE_PORT_MAX_MSG_SZ = 0x800000, | ||
3233 | RXE_PORT_BAD_PKEY_CNTR = 0, | ||
3234 | RXE_PORT_QKEY_VIOL_CNTR = 0, | ||
3235 | diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c | ||
3236 | index 6c554c11a7ac3..ea58805c480fa 100644 | ||
3237 | --- a/drivers/input/joystick/iforce/iforce-usb.c | ||
3238 | +++ b/drivers/input/joystick/iforce/iforce-usb.c | ||
3239 | @@ -92,7 +92,7 @@ static int iforce_usb_get_id(struct iforce *iforce, u8 id, | ||
3240 | id, | ||
3241 | USB_TYPE_VENDOR | USB_DIR_IN | | ||
3242 | USB_RECIP_INTERFACE, | ||
3243 | - 0, 0, buf, IFORCE_MAX_LENGTH, HZ); | ||
3244 | + 0, 0, buf, IFORCE_MAX_LENGTH, 1000); | ||
3245 | if (status < 0) { | ||
3246 | dev_err(&iforce_usb->intf->dev, | ||
3247 | "usb_submit_urb failed: %d\n", status); | ||
3248 | diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c | ||
3249 | index 053fe2da1e08f..0b5ed963cb0e1 100644 | ||
3250 | --- a/drivers/input/mouse/elantech.c | ||
3251 | +++ b/drivers/input/mouse/elantech.c | ||
3252 | @@ -517,6 +517,19 @@ static void elantech_report_trackpoint(struct psmouse *psmouse, | ||
3253 | case 0x16008020U: | ||
3254 | case 0x26800010U: | ||
3255 | case 0x36808000U: | ||
3256 | + | ||
3257 | + /* | ||
3258 | + * This firmware misreport coordinates for trackpoint | ||
3259 | + * occasionally. Discard packets outside of [-127, 127] range | ||
3260 | + * to prevent cursor jumps. | ||
3261 | + */ | ||
3262 | + if (packet[4] == 0x80 || packet[5] == 0x80 || | ||
3263 | + packet[1] >> 7 == packet[4] >> 7 || | ||
3264 | + packet[2] >> 7 == packet[5] >> 7) { | ||
3265 | + elantech_debug("discarding packet [%6ph]\n", packet); | ||
3266 | + break; | ||
3267 | + | ||
3268 | + } | ||
3269 | x = packet[4] - (int)((packet[1]^0x80) << 1); | ||
3270 | y = (int)((packet[2]^0x80) << 1) - packet[5]; | ||
3271 | |||
3272 | diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h | ||
3273 | index 23442a144b834..202e43a6ffae2 100644 | ||
3274 | --- a/drivers/input/serio/i8042-x86ia64io.h | ||
3275 | +++ b/drivers/input/serio/i8042-x86ia64io.h | ||
3276 | @@ -272,6 +272,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | ||
3277 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"), | ||
3278 | }, | ||
3279 | }, | ||
3280 | + { | ||
3281 | + /* Fujitsu Lifebook T725 laptop */ | ||
3282 | + .matches = { | ||
3283 | + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
3284 | + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"), | ||
3285 | + }, | ||
3286 | + }, | ||
3287 | { | ||
3288 | /* Fujitsu Lifebook U745 */ | ||
3289 | .matches = { | ||
3290 | @@ -840,6 +847,13 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { | ||
3291 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"), | ||
3292 | }, | ||
3293 | }, | ||
3294 | + { | ||
3295 | + /* Fujitsu Lifebook T725 laptop */ | ||
3296 | + .matches = { | ||
3297 | + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
3298 | + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"), | ||
3299 | + }, | ||
3300 | + }, | ||
3301 | { | ||
3302 | /* Fujitsu U574 laptop */ | ||
3303 | /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ | ||
3304 | diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c | ||
3305 | index e3483789f4df3..1bd0621c4ce2a 100644 | ||
3306 | --- a/drivers/irqchip/irq-bcm6345-l1.c | ||
3307 | +++ b/drivers/irqchip/irq-bcm6345-l1.c | ||
3308 | @@ -140,7 +140,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc) | ||
3309 | for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) { | ||
3310 | irq = irq_linear_revmap(intc->domain, base + hwirq); | ||
3311 | if (irq) | ||
3312 | - do_IRQ(irq); | ||
3313 | + generic_handle_irq(irq); | ||
3314 | else | ||
3315 | spurious_interrupt(); | ||
3316 | } | ||
3317 | diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c | ||
3318 | index d2031fecc3861..5e97ae54782d6 100644 | ||
3319 | --- a/drivers/irqchip/irq-s3c24xx.c | ||
3320 | +++ b/drivers/irqchip/irq-s3c24xx.c | ||
3321 | @@ -359,11 +359,25 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc, | ||
3322 | asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs) | ||
3323 | { | ||
3324 | do { | ||
3325 | - if (likely(s3c_intc[0])) | ||
3326 | - if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) | ||
3327 | - continue; | ||
3328 | + /* | ||
3329 | + * For platform based machines, neither ERR nor NULL can happen here. | ||
3330 | + * The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds: | ||
3331 | + * | ||
3332 | + * s3c_intc[0] = s3c24xx_init_intc() | ||
3333 | + * | ||
3334 | + * If this fails, the next calls to s3c24xx_init_intc() won't be executed. | ||
3335 | + * | ||
3336 | + * For DT machine, s3c_init_intc_of() could set the IRQ handler without | ||
3337 | + * setting s3c_intc[0] only if it was called with num_ctrl=0. There is no | ||
3338 | + * such code path, so again the s3c_intc[0] will have a valid pointer if | ||
3339 | + * set_handle_irq() is called. | ||
3340 | + * | ||
3341 | + * Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something. | ||
3342 | + */ | ||
3343 | + if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) | ||
3344 | + continue; | ||
3345 | |||
3346 | - if (s3c_intc[2]) | ||
3347 | + if (!IS_ERR_OR_NULL(s3c_intc[2])) | ||
3348 | if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) | ||
3349 | continue; | ||
3350 | |||
3351 | diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c | ||
3352 | index 7d0a12fe2714a..7cd7b140dfe97 100644 | ||
3353 | --- a/drivers/irqchip/irq-sifive-plic.c | ||
3354 | +++ b/drivers/irqchip/irq-sifive-plic.c | ||
3355 | @@ -138,7 +138,13 @@ static void plic_irq_eoi(struct irq_data *d) | ||
3356 | { | ||
3357 | struct plic_handler *handler = this_cpu_ptr(&plic_handlers); | ||
3358 | |||
3359 | - writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); | ||
3360 | + if (irqd_irq_masked(d)) { | ||
3361 | + plic_irq_unmask(d); | ||
3362 | + writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); | ||
3363 | + plic_irq_mask(d); | ||
3364 | + } else { | ||
3365 | + writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); | ||
3366 | + } | ||
3367 | } | ||
3368 | |||
3369 | static struct irq_chip plic_chip = { | ||
3370 | diff --git a/drivers/media/dvb-frontends/mn88443x.c b/drivers/media/dvb-frontends/mn88443x.c | ||
3371 | index e4528784f8477..fff212c0bf3b5 100644 | ||
3372 | --- a/drivers/media/dvb-frontends/mn88443x.c | ||
3373 | +++ b/drivers/media/dvb-frontends/mn88443x.c | ||
3374 | @@ -204,11 +204,18 @@ struct mn88443x_priv { | ||
3375 | struct regmap *regmap_t; | ||
3376 | }; | ||
3377 | |||
3378 | -static void mn88443x_cmn_power_on(struct mn88443x_priv *chip) | ||
3379 | +static int mn88443x_cmn_power_on(struct mn88443x_priv *chip) | ||
3380 | { | ||
3381 | + struct device *dev = &chip->client_s->dev; | ||
3382 | struct regmap *r_t = chip->regmap_t; | ||
3383 | + int ret; | ||
3384 | |||
3385 | - clk_prepare_enable(chip->mclk); | ||
3386 | + ret = clk_prepare_enable(chip->mclk); | ||
3387 | + if (ret) { | ||
3388 | + dev_err(dev, "Failed to prepare and enable mclk: %d\n", | ||
3389 | + ret); | ||
3390 | + return ret; | ||
3391 | + } | ||
3392 | |||
3393 | gpiod_set_value_cansleep(chip->reset_gpio, 1); | ||
3394 | usleep_range(100, 1000); | ||
3395 | @@ -222,6 +229,8 @@ static void mn88443x_cmn_power_on(struct mn88443x_priv *chip) | ||
3396 | } else { | ||
3397 | regmap_write(r_t, HIZSET3, 0x8f); | ||
3398 | } | ||
3399 | + | ||
3400 | + return 0; | ||
3401 | } | ||
3402 | |||
3403 | static void mn88443x_cmn_power_off(struct mn88443x_priv *chip) | ||
3404 | @@ -738,7 +747,10 @@ static int mn88443x_probe(struct i2c_client *client, | ||
3405 | chip->fe.demodulator_priv = chip; | ||
3406 | i2c_set_clientdata(client, chip); | ||
3407 | |||
3408 | - mn88443x_cmn_power_on(chip); | ||
3409 | + ret = mn88443x_cmn_power_on(chip); | ||
3410 | + if (ret) | ||
3411 | + goto err_i2c_t; | ||
3412 | + | ||
3413 | mn88443x_s_sleep(chip); | ||
3414 | mn88443x_t_sleep(chip); | ||
3415 | |||
3416 | diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c | ||
3417 | index 92376592455ee..56674173524fd 100644 | ||
3418 | --- a/drivers/media/i2c/ir-kbd-i2c.c | ||
3419 | +++ b/drivers/media/i2c/ir-kbd-i2c.c | ||
3420 | @@ -791,6 +791,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
3421 | rc_proto = RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC6_MCE | | ||
3422 | RC_PROTO_BIT_RC6_6A_32; | ||
3423 | ir_codes = RC_MAP_HAUPPAUGE; | ||
3424 | + ir->polling_interval = 125; | ||
3425 | probe_tx = true; | ||
3426 | break; | ||
3427 | } | ||
3428 | diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c | ||
3429 | index dc23b9ed510a4..18440c5104ad9 100644 | ||
3430 | --- a/drivers/media/i2c/mt9p031.c | ||
3431 | +++ b/drivers/media/i2c/mt9p031.c | ||
3432 | @@ -78,7 +78,9 @@ | ||
3433 | #define MT9P031_PIXEL_CLOCK_INVERT (1 << 15) | ||
3434 | #define MT9P031_PIXEL_CLOCK_SHIFT(n) ((n) << 8) | ||
3435 | #define MT9P031_PIXEL_CLOCK_DIVIDE(n) ((n) << 0) | ||
3436 | -#define MT9P031_FRAME_RESTART 0x0b | ||
3437 | +#define MT9P031_RESTART 0x0b | ||
3438 | +#define MT9P031_FRAME_PAUSE_RESTART (1 << 1) | ||
3439 | +#define MT9P031_FRAME_RESTART (1 << 0) | ||
3440 | #define MT9P031_SHUTTER_DELAY 0x0c | ||
3441 | #define MT9P031_RST 0x0d | ||
3442 | #define MT9P031_RST_ENABLE 1 | ||
3443 | @@ -445,9 +447,23 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031) | ||
3444 | static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable) | ||
3445 | { | ||
3446 | struct mt9p031 *mt9p031 = to_mt9p031(subdev); | ||
3447 | + struct i2c_client *client = v4l2_get_subdevdata(subdev); | ||
3448 | + int val; | ||
3449 | int ret; | ||
3450 | |||
3451 | if (!enable) { | ||
3452 | + /* enable pause restart */ | ||
3453 | + val = MT9P031_FRAME_PAUSE_RESTART; | ||
3454 | + ret = mt9p031_write(client, MT9P031_RESTART, val); | ||
3455 | + if (ret < 0) | ||
3456 | + return ret; | ||
3457 | + | ||
3458 | + /* enable restart + keep pause restart set */ | ||
3459 | + val |= MT9P031_FRAME_RESTART; | ||
3460 | + ret = mt9p031_write(client, MT9P031_RESTART, val); | ||
3461 | + if (ret < 0) | ||
3462 | + return ret; | ||
3463 | + | ||
3464 | /* Stop sensor readout */ | ||
3465 | ret = mt9p031_set_output_control(mt9p031, | ||
3466 | MT9P031_OUTPUT_CONTROL_CEN, 0); | ||
3467 | @@ -467,6 +483,16 @@ static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable) | ||
3468 | if (ret < 0) | ||
3469 | return ret; | ||
3470 | |||
3471 | + /* | ||
3472 | + * - clear pause restart | ||
3473 | + * - don't clear restart as clearing restart manually can cause | ||
3474 | + * undefined behavior | ||
3475 | + */ | ||
3476 | + val = MT9P031_FRAME_RESTART; | ||
3477 | + ret = mt9p031_write(client, MT9P031_RESTART, val); | ||
3478 | + if (ret < 0) | ||
3479 | + return ret; | ||
3480 | + | ||
3481 | return mt9p031_pll_enable(mt9p031); | ||
3482 | } | ||
3483 | |||
3484 | diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c | ||
3485 | index 18a2027ba1450..5faffedb0feba 100644 | ||
3486 | --- a/drivers/media/i2c/tda1997x.c | ||
3487 | +++ b/drivers/media/i2c/tda1997x.c | ||
3488 | @@ -1247,13 +1247,13 @@ tda1997x_parse_infoframe(struct tda1997x_state *state, u16 addr) | ||
3489 | { | ||
3490 | struct v4l2_subdev *sd = &state->sd; | ||
3491 | union hdmi_infoframe frame; | ||
3492 | - u8 buffer[40]; | ||
3493 | + u8 buffer[40] = { 0 }; | ||
3494 | u8 reg; | ||
3495 | int len, err; | ||
3496 | |||
3497 | /* read data */ | ||
3498 | len = io_readn(sd, addr, sizeof(buffer), buffer); | ||
3499 | - err = hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer)); | ||
3500 | + err = hdmi_infoframe_unpack(&frame, buffer, len); | ||
3501 | if (err) { | ||
3502 | v4l_err(state->client, | ||
3503 | "failed parsing %d byte infoframe: 0x%04x/0x%02x\n", | ||
3504 | @@ -1927,13 +1927,13 @@ static int tda1997x_log_infoframe(struct v4l2_subdev *sd, int addr) | ||
3505 | { | ||
3506 | struct tda1997x_state *state = to_state(sd); | ||
3507 | union hdmi_infoframe frame; | ||
3508 | - u8 buffer[40]; | ||
3509 | + u8 buffer[40] = { 0 }; | ||
3510 | int len, err; | ||
3511 | |||
3512 | /* read data */ | ||
3513 | len = io_readn(sd, addr, sizeof(buffer), buffer); | ||
3514 | v4l2_dbg(1, debug, sd, "infoframe: addr=%d len=%d\n", addr, len); | ||
3515 | - err = hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer)); | ||
3516 | + err = hdmi_infoframe_unpack(&frame, buffer, len); | ||
3517 | if (err) { | ||
3518 | v4l_err(state->client, | ||
3519 | "failed parsing %d byte infoframe: 0x%04x/0x%02x\n", | ||
3520 | diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c | ||
3521 | index a8e980c6dacb9..50772c2611cad 100644 | ||
3522 | --- a/drivers/media/pci/cx23885/cx23885-alsa.c | ||
3523 | +++ b/drivers/media/pci/cx23885/cx23885-alsa.c | ||
3524 | @@ -550,7 +550,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev) | ||
3525 | SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, | ||
3526 | THIS_MODULE, sizeof(struct cx23885_audio_dev), &card); | ||
3527 | if (err < 0) | ||
3528 | - goto error; | ||
3529 | + goto error_msg; | ||
3530 | |||
3531 | chip = (struct cx23885_audio_dev *) card->private_data; | ||
3532 | chip->dev = dev; | ||
3533 | @@ -576,6 +576,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev) | ||
3534 | |||
3535 | error: | ||
3536 | snd_card_free(card); | ||
3537 | +error_msg: | ||
3538 | pr_err("%s(): Failed to register analog audio adapter\n", | ||
3539 | __func__); | ||
3540 | |||
3541 | diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c | ||
3542 | index 80a7c41baa901..eb5621c9ebf85 100644 | ||
3543 | --- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c | ||
3544 | +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c | ||
3545 | @@ -258,19 +258,24 @@ static irqreturn_t netup_unidvb_isr(int irq, void *dev_id) | ||
3546 | if ((reg40 & AVL_IRQ_ASSERTED) != 0) { | ||
3547 | /* IRQ is being signaled */ | ||
3548 | reg_isr = readw(ndev->bmmio0 + REG_ISR); | ||
3549 | - if (reg_isr & NETUP_UNIDVB_IRQ_I2C0) { | ||
3550 | - iret = netup_i2c_interrupt(&ndev->i2c[0]); | ||
3551 | - } else if (reg_isr & NETUP_UNIDVB_IRQ_I2C1) { | ||
3552 | - iret = netup_i2c_interrupt(&ndev->i2c[1]); | ||
3553 | - } else if (reg_isr & NETUP_UNIDVB_IRQ_SPI) { | ||
3554 | + if (reg_isr & NETUP_UNIDVB_IRQ_SPI) | ||
3555 | iret = netup_spi_interrupt(ndev->spi); | ||
3556 | - } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA1) { | ||
3557 | - iret = netup_dma_interrupt(&ndev->dma[0]); | ||
3558 | - } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA2) { | ||
3559 | - iret = netup_dma_interrupt(&ndev->dma[1]); | ||
3560 | - } else if (reg_isr & NETUP_UNIDVB_IRQ_CI) { | ||
3561 | - iret = netup_ci_interrupt(ndev); | ||
3562 | + else if (!ndev->old_fw) { | ||
3563 | + if (reg_isr & NETUP_UNIDVB_IRQ_I2C0) { | ||
3564 | + iret = netup_i2c_interrupt(&ndev->i2c[0]); | ||
3565 | + } else if (reg_isr & NETUP_UNIDVB_IRQ_I2C1) { | ||
3566 | + iret = netup_i2c_interrupt(&ndev->i2c[1]); | ||
3567 | + } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA1) { | ||
3568 | + iret = netup_dma_interrupt(&ndev->dma[0]); | ||
3569 | + } else if (reg_isr & NETUP_UNIDVB_IRQ_DMA2) { | ||
3570 | + iret = netup_dma_interrupt(&ndev->dma[1]); | ||
3571 | + } else if (reg_isr & NETUP_UNIDVB_IRQ_CI) { | ||
3572 | + iret = netup_ci_interrupt(ndev); | ||
3573 | + } else { | ||
3574 | + goto err; | ||
3575 | + } | ||
3576 | } else { | ||
3577 | +err: | ||
3578 | dev_err(&pci_dev->dev, | ||
3579 | "%s(): unknown interrupt 0x%x\n", | ||
3580 | __func__, reg_isr); | ||
3581 | diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c | ||
3582 | index cc2ff40d060d1..acf64723f9381 100644 | ||
3583 | --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c | ||
3584 | +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c | ||
3585 | @@ -809,7 +809,8 @@ static int mtk_vpu_probe(struct platform_device *pdev) | ||
3586 | vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt"); | ||
3587 | if (!vpu->wdt.wq) { | ||
3588 | dev_err(dev, "initialize wdt workqueue failed\n"); | ||
3589 | - return -ENOMEM; | ||
3590 | + ret = -ENOMEM; | ||
3591 | + goto clk_unprepare; | ||
3592 | } | ||
3593 | INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func); | ||
3594 | mutex_init(&vpu->vpu_mutex); | ||
3595 | @@ -908,6 +909,8 @@ disable_vpu_clk: | ||
3596 | vpu_clock_disable(vpu); | ||
3597 | workqueue_destroy: | ||
3598 | destroy_workqueue(vpu->wdt.wq); | ||
3599 | +clk_unprepare: | ||
3600 | + clk_unprepare(vpu->clk); | ||
3601 | |||
3602 | return ret; | ||
3603 | } | ||
3604 | diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c | ||
3605 | index d27eccfa57cae..e01f22bf826d4 100644 | ||
3606 | --- a/drivers/media/platform/rcar-vin/rcar-csi2.c | ||
3607 | +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c | ||
3608 | @@ -488,6 +488,8 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv) | ||
3609 | |||
3610 | /* Code is validated in set_fmt. */ | ||
3611 | format = rcsi2_code_to_fmt(priv->mf.code); | ||
3612 | + if (!format) | ||
3613 | + return -EINVAL; | ||
3614 | |||
3615 | /* | ||
3616 | * Enable all supported CSI-2 channels with virtual channel and | ||
3617 | diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c | ||
3618 | index b776f83e395e0..9faecd049002f 100644 | ||
3619 | --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c | ||
3620 | +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c | ||
3621 | @@ -1279,11 +1279,15 @@ static int s5p_mfc_probe(struct platform_device *pdev) | ||
3622 | spin_lock_init(&dev->condlock); | ||
3623 | dev->plat_dev = pdev; | ||
3624 | if (!dev->plat_dev) { | ||
3625 | - dev_err(&pdev->dev, "No platform data specified\n"); | ||
3626 | + mfc_err("No platform data specified\n"); | ||
3627 | return -ENODEV; | ||
3628 | } | ||
3629 | |||
3630 | dev->variant = of_device_get_match_data(&pdev->dev); | ||
3631 | + if (!dev->variant) { | ||
3632 | + dev_err(&pdev->dev, "Failed to get device MFC hardware variant information\n"); | ||
3633 | + return -ENOENT; | ||
3634 | + } | ||
3635 | |||
3636 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
3637 | dev->regs_base = devm_ioremap_resource(&pdev->dev, res); | ||
3638 | diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c | ||
3639 | index d41475f56ab54..72798aae7a628 100644 | ||
3640 | --- a/drivers/media/platform/stm32/stm32-dcmi.c | ||
3641 | +++ b/drivers/media/platform/stm32/stm32-dcmi.c | ||
3642 | @@ -135,6 +135,7 @@ struct stm32_dcmi { | ||
3643 | int sequence; | ||
3644 | struct list_head buffers; | ||
3645 | struct dcmi_buf *active; | ||
3646 | + int irq; | ||
3647 | |||
3648 | struct v4l2_device v4l2_dev; | ||
3649 | struct video_device *vdev; | ||
3650 | @@ -1720,6 +1721,14 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier) | ||
3651 | return ret; | ||
3652 | } | ||
3653 | |||
3654 | + ret = devm_request_threaded_irq(dcmi->dev, dcmi->irq, dcmi_irq_callback, | ||
3655 | + dcmi_irq_thread, IRQF_ONESHOT, | ||
3656 | + dev_name(dcmi->dev), dcmi); | ||
3657 | + if (ret) { | ||
3658 | + dev_err(dcmi->dev, "Unable to request irq %d\n", dcmi->irq); | ||
3659 | + return ret; | ||
3660 | + } | ||
3661 | + | ||
3662 | return 0; | ||
3663 | } | ||
3664 | |||
3665 | @@ -1881,6 +1890,8 @@ static int dcmi_probe(struct platform_device *pdev) | ||
3666 | if (irq <= 0) | ||
3667 | return irq ? irq : -ENXIO; | ||
3668 | |||
3669 | + dcmi->irq = irq; | ||
3670 | + | ||
3671 | dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
3672 | if (!dcmi->res) { | ||
3673 | dev_err(&pdev->dev, "Could not get resource\n"); | ||
3674 | @@ -1893,14 +1904,6 @@ static int dcmi_probe(struct platform_device *pdev) | ||
3675 | return PTR_ERR(dcmi->regs); | ||
3676 | } | ||
3677 | |||
3678 | - ret = devm_request_threaded_irq(&pdev->dev, irq, dcmi_irq_callback, | ||
3679 | - dcmi_irq_thread, IRQF_ONESHOT, | ||
3680 | - dev_name(&pdev->dev), dcmi); | ||
3681 | - if (ret) { | ||
3682 | - dev_err(&pdev->dev, "Unable to request irq %d\n", irq); | ||
3683 | - return ret; | ||
3684 | - } | ||
3685 | - | ||
3686 | mclk = devm_clk_get(&pdev->dev, "mclk"); | ||
3687 | if (IS_ERR(mclk)) { | ||
3688 | if (PTR_ERR(mclk) != -EPROBE_DEFER) | ||
3689 | diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c | ||
3690 | index 1123768731676..484046471c03f 100644 | ||
3691 | --- a/drivers/media/radio/radio-wl1273.c | ||
3692 | +++ b/drivers/media/radio/radio-wl1273.c | ||
3693 | @@ -1279,7 +1279,7 @@ static int wl1273_fm_vidioc_querycap(struct file *file, void *priv, | ||
3694 | |||
3695 | strscpy(capability->driver, WL1273_FM_DRIVER_NAME, | ||
3696 | sizeof(capability->driver)); | ||
3697 | - strscpy(capability->card, "Texas Instruments Wl1273 FM Radio", | ||
3698 | + strscpy(capability->card, "TI Wl1273 FM Radio", | ||
3699 | sizeof(capability->card)); | ||
3700 | strscpy(capability->bus_info, radio->bus_type, | ||
3701 | sizeof(capability->bus_info)); | ||
3702 | diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c | ||
3703 | index f491420d7b538..a972c0705ac79 100644 | ||
3704 | --- a/drivers/media/radio/si470x/radio-si470x-i2c.c | ||
3705 | +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c | ||
3706 | @@ -11,7 +11,7 @@ | ||
3707 | |||
3708 | /* driver definitions */ | ||
3709 | #define DRIVER_AUTHOR "Joonyoung Shim <jy0922.shim@samsung.com>"; | ||
3710 | -#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" | ||
3711 | +#define DRIVER_CARD "Silicon Labs Si470x FM Radio" | ||
3712 | #define DRIVER_DESC "I2C radio driver for Si470x FM Radio Receivers" | ||
3713 | #define DRIVER_VERSION "1.0.2" | ||
3714 | |||
3715 | diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c | ||
3716 | index fedff68d8c496..3f8634a465730 100644 | ||
3717 | --- a/drivers/media/radio/si470x/radio-si470x-usb.c | ||
3718 | +++ b/drivers/media/radio/si470x/radio-si470x-usb.c | ||
3719 | @@ -16,7 +16,7 @@ | ||
3720 | |||
3721 | /* driver definitions */ | ||
3722 | #define DRIVER_AUTHOR "Tobias Lorenz <tobias.lorenz@gmx.net>" | ||
3723 | -#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" | ||
3724 | +#define DRIVER_CARD "Silicon Labs Si470x FM Radio" | ||
3725 | #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers" | ||
3726 | #define DRIVER_VERSION "1.0.10" | ||
3727 | |||
3728 | diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c | ||
3729 | index 4b8aee390518d..742b7f41b75f8 100644 | ||
3730 | --- a/drivers/media/rc/ite-cir.c | ||
3731 | +++ b/drivers/media/rc/ite-cir.c | ||
3732 | @@ -283,7 +283,7 @@ static irqreturn_t ite_cir_isr(int irq, void *data) | ||
3733 | } | ||
3734 | |||
3735 | /* check for the receive interrupt */ | ||
3736 | - if (iflags & ITE_IRQ_RX_FIFO) { | ||
3737 | + if (iflags & (ITE_IRQ_RX_FIFO | ITE_IRQ_RX_FIFO_OVERRUN)) { | ||
3738 | /* read the FIFO bytes */ | ||
3739 | rx_bytes = | ||
3740 | dev->params.get_rx_bytes(dev, rx_buf, | ||
3741 | diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c | ||
3742 | index c68e52c17ae13..31e56f4f34791 100644 | ||
3743 | --- a/drivers/media/rc/mceusb.c | ||
3744 | +++ b/drivers/media/rc/mceusb.c | ||
3745 | @@ -1386,6 +1386,7 @@ static void mceusb_dev_recv(struct urb *urb) | ||
3746 | case -ECONNRESET: | ||
3747 | case -ENOENT: | ||
3748 | case -EILSEQ: | ||
3749 | + case -EPROTO: | ||
3750 | case -ESHUTDOWN: | ||
3751 | usb_unlink_urb(urb); | ||
3752 | return; | ||
3753 | diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c | ||
3754 | index 93194f03764d2..11273be702b6e 100644 | ||
3755 | --- a/drivers/media/spi/cxd2880-spi.c | ||
3756 | +++ b/drivers/media/spi/cxd2880-spi.c | ||
3757 | @@ -618,7 +618,7 @@ fail_frontend: | ||
3758 | fail_attach: | ||
3759 | dvb_unregister_adapter(&dvb_spi->adapter); | ||
3760 | fail_adapter: | ||
3761 | - if (!dvb_spi->vcc_supply) | ||
3762 | + if (dvb_spi->vcc_supply) | ||
3763 | regulator_disable(dvb_spi->vcc_supply); | ||
3764 | fail_regulator: | ||
3765 | kfree(dvb_spi); | ||
3766 | diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c | ||
3767 | index 8de18da0c4bd1..5aa9c501ed9c9 100644 | ||
3768 | --- a/drivers/media/usb/dvb-usb/az6027.c | ||
3769 | +++ b/drivers/media/usb/dvb-usb/az6027.c | ||
3770 | @@ -391,6 +391,7 @@ static struct rc_map_table rc_map_az6027_table[] = { | ||
3771 | /* remote control stuff (does not work with my box) */ | ||
3772 | static int az6027_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
3773 | { | ||
3774 | + *state = REMOTE_NO_KEY_PRESSED; | ||
3775 | return 0; | ||
3776 | } | ||
3777 | |||
3778 | diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c | ||
3779 | index 59ce2dec11e98..9c1ebea68b544 100644 | ||
3780 | --- a/drivers/media/usb/dvb-usb/dibusb-common.c | ||
3781 | +++ b/drivers/media/usb/dvb-usb/dibusb-common.c | ||
3782 | @@ -223,7 +223,7 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) | ||
3783 | u8 *buf; | ||
3784 | int rc; | ||
3785 | |||
3786 | - buf = kmalloc(2, GFP_KERNEL); | ||
3787 | + buf = kzalloc(2, GFP_KERNEL); | ||
3788 | if (!buf) | ||
3789 | return -ENOMEM; | ||
3790 | |||
3791 | diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c | ||
3792 | index 5983e72a0622c..3e96b4b711d75 100644 | ||
3793 | --- a/drivers/media/usb/em28xx/em28xx-cards.c | ||
3794 | +++ b/drivers/media/usb/em28xx/em28xx-cards.c | ||
3795 | @@ -4029,8 +4029,11 @@ static void em28xx_usb_disconnect(struct usb_interface *intf) | ||
3796 | |||
3797 | em28xx_close_extension(dev); | ||
3798 | |||
3799 | - if (dev->dev_next) | ||
3800 | + if (dev->dev_next) { | ||
3801 | + em28xx_close_extension(dev->dev_next); | ||
3802 | em28xx_release_resources(dev->dev_next); | ||
3803 | + } | ||
3804 | + | ||
3805 | em28xx_release_resources(dev); | ||
3806 | |||
3807 | if (dev->dev_next) { | ||
3808 | diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c | ||
3809 | index 3daa64bb1e1d9..af9216278024f 100644 | ||
3810 | --- a/drivers/media/usb/em28xx/em28xx-core.c | ||
3811 | +++ b/drivers/media/usb/em28xx/em28xx-core.c | ||
3812 | @@ -1152,8 +1152,9 @@ int em28xx_suspend_extension(struct em28xx *dev) | ||
3813 | dev_info(&dev->intf->dev, "Suspending extensions\n"); | ||
3814 | mutex_lock(&em28xx_devlist_mutex); | ||
3815 | list_for_each_entry(ops, &em28xx_extension_devlist, next) { | ||
3816 | - if (ops->suspend) | ||
3817 | - ops->suspend(dev); | ||
3818 | + if (!ops->suspend) | ||
3819 | + continue; | ||
3820 | + ops->suspend(dev); | ||
3821 | if (dev->dev_next) | ||
3822 | ops->suspend(dev->dev_next); | ||
3823 | } | ||
3824 | diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c | ||
3825 | index c46cbcfafab3f..8874b0b922eee 100644 | ||
3826 | --- a/drivers/media/usb/tm6000/tm6000-video.c | ||
3827 | +++ b/drivers/media/usb/tm6000/tm6000-video.c | ||
3828 | @@ -854,8 +854,7 @@ static int vidioc_querycap(struct file *file, void *priv, | ||
3829 | struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev; | ||
3830 | |||
3831 | strscpy(cap->driver, "tm6000", sizeof(cap->driver)); | ||
3832 | - strscpy(cap->card, "Trident TVMaster TM5600/6000/6010", | ||
3833 | - sizeof(cap->card)); | ||
3834 | + strscpy(cap->card, "Trident TM5600/6000/6010", sizeof(cap->card)); | ||
3835 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); | ||
3836 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | ||
3837 | V4L2_CAP_DEVICE_CAPS; | ||
3838 | diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c | ||
3839 | index 40ca1d4e03483..378cfc46fc195 100644 | ||
3840 | --- a/drivers/media/usb/uvc/uvc_driver.c | ||
3841 | +++ b/drivers/media/usb/uvc/uvc_driver.c | ||
3842 | @@ -1972,6 +1972,7 @@ int uvc_register_video_device(struct uvc_device *dev, | ||
3843 | const struct v4l2_file_operations *fops, | ||
3844 | const struct v4l2_ioctl_ops *ioctl_ops) | ||
3845 | { | ||
3846 | + const char *name; | ||
3847 | int ret; | ||
3848 | |||
3849 | /* Initialize the video buffers queue. */ | ||
3850 | @@ -2000,16 +2001,20 @@ int uvc_register_video_device(struct uvc_device *dev, | ||
3851 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
3852 | default: | ||
3853 | vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | ||
3854 | + name = "Video Capture"; | ||
3855 | break; | ||
3856 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: | ||
3857 | vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; | ||
3858 | + name = "Video Output"; | ||
3859 | break; | ||
3860 | case V4L2_BUF_TYPE_META_CAPTURE: | ||
3861 | vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING; | ||
3862 | + name = "Metadata"; | ||
3863 | break; | ||
3864 | } | ||
3865 | |||
3866 | - strscpy(vdev->name, dev->name, sizeof(vdev->name)); | ||
3867 | + snprintf(vdev->name, sizeof(vdev->name), "%s %u", name, | ||
3868 | + stream->header.bTerminalLink); | ||
3869 | |||
3870 | /* | ||
3871 | * Set the driver data before calling video_register_device, otherwise | ||
3872 | diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c | ||
3873 | index db7f8f8ee2f9f..3126ee9e965c9 100644 | ||
3874 | --- a/drivers/media/usb/uvc/uvc_v4l2.c | ||
3875 | +++ b/drivers/media/usb/uvc/uvc_v4l2.c | ||
3876 | @@ -467,10 +467,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, | ||
3877 | uvc_simplify_fraction(&timeperframe.numerator, | ||
3878 | &timeperframe.denominator, 8, 333); | ||
3879 | |||
3880 | - if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
3881 | + if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
3882 | parm->parm.capture.timeperframe = timeperframe; | ||
3883 | - else | ||
3884 | + parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; | ||
3885 | + } else { | ||
3886 | parm->parm.output.timeperframe = timeperframe; | ||
3887 | + parm->parm.output.capability = V4L2_CAP_TIMEPERFRAME; | ||
3888 | + } | ||
3889 | |||
3890 | return 0; | ||
3891 | } | ||
3892 | diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c | ||
3893 | index 5d095b2a03464..96b85d66e7a87 100644 | ||
3894 | --- a/drivers/media/usb/uvc/uvc_video.c | ||
3895 | +++ b/drivers/media/usb/uvc/uvc_video.c | ||
3896 | @@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit, | ||
3897 | case 5: /* Invalid unit */ | ||
3898 | case 6: /* Invalid control */ | ||
3899 | case 7: /* Invalid Request */ | ||
3900 | + /* | ||
3901 | + * The firmware has not properly implemented | ||
3902 | + * the control or there has been a HW error. | ||
3903 | + */ | ||
3904 | + return -EIO; | ||
3905 | case 8: /* Invalid value within range */ | ||
3906 | return -EINVAL; | ||
3907 | default: /* reserved or unknown */ | ||
3908 | diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c | ||
3909 | index 24db33f803c06..98633fa5d46fd 100644 | ||
3910 | --- a/drivers/media/v4l2-core/v4l2-ioctl.c | ||
3911 | +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | ||
3912 | @@ -902,7 +902,7 @@ static void v4l_print_default(const void *arg, bool write_only) | ||
3913 | pr_cont("driver-specific ioctl\n"); | ||
3914 | } | ||
3915 | |||
3916 | -static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) | ||
3917 | +static bool check_ext_ctrls(struct v4l2_ext_controls *c, unsigned long ioctl) | ||
3918 | { | ||
3919 | __u32 i; | ||
3920 | |||
3921 | @@ -911,23 +911,41 @@ static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) | ||
3922 | for (i = 0; i < c->count; i++) | ||
3923 | c->controls[i].reserved2[0] = 0; | ||
3924 | |||
3925 | - /* V4L2_CID_PRIVATE_BASE cannot be used as control class | ||
3926 | - when using extended controls. | ||
3927 | - Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL | ||
3928 | - is it allowed for backwards compatibility. | ||
3929 | - */ | ||
3930 | - if (!allow_priv && c->which == V4L2_CID_PRIVATE_BASE) | ||
3931 | - return 0; | ||
3932 | - if (!c->which) | ||
3933 | - return 1; | ||
3934 | + switch (c->which) { | ||
3935 | + case V4L2_CID_PRIVATE_BASE: | ||
3936 | + /* | ||
3937 | + * V4L2_CID_PRIVATE_BASE cannot be used as control class | ||
3938 | + * when using extended controls. | ||
3939 | + * Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL | ||
3940 | + * is it allowed for backwards compatibility. | ||
3941 | + */ | ||
3942 | + if (ioctl == VIDIOC_G_CTRL || ioctl == VIDIOC_S_CTRL) | ||
3943 | + return false; | ||
3944 | + break; | ||
3945 | + case V4L2_CTRL_WHICH_DEF_VAL: | ||
3946 | + /* Default value cannot be changed */ | ||
3947 | + if (ioctl == VIDIOC_S_EXT_CTRLS || | ||
3948 | + ioctl == VIDIOC_TRY_EXT_CTRLS) { | ||
3949 | + c->error_idx = c->count; | ||
3950 | + return false; | ||
3951 | + } | ||
3952 | + return true; | ||
3953 | + case V4L2_CTRL_WHICH_CUR_VAL: | ||
3954 | + return true; | ||
3955 | + case V4L2_CTRL_WHICH_REQUEST_VAL: | ||
3956 | + c->error_idx = c->count; | ||
3957 | + return false; | ||
3958 | + } | ||
3959 | + | ||
3960 | /* Check that all controls are from the same control class. */ | ||
3961 | for (i = 0; i < c->count; i++) { | ||
3962 | if (V4L2_CTRL_ID2WHICH(c->controls[i].id) != c->which) { | ||
3963 | - c->error_idx = i; | ||
3964 | - return 0; | ||
3965 | + c->error_idx = ioctl == VIDIOC_TRY_EXT_CTRLS ? i : | ||
3966 | + c->count; | ||
3967 | + return false; | ||
3968 | } | ||
3969 | } | ||
3970 | - return 1; | ||
3971 | + return true; | ||
3972 | } | ||
3973 | |||
3974 | static int check_fmt(struct file *file, enum v4l2_buf_type type) | ||
3975 | @@ -2145,7 +2163,7 @@ static int v4l_g_ctrl(const struct v4l2_ioctl_ops *ops, | ||
3976 | ctrls.controls = &ctrl; | ||
3977 | ctrl.id = p->id; | ||
3978 | ctrl.value = p->value; | ||
3979 | - if (check_ext_ctrls(&ctrls, 1)) { | ||
3980 | + if (check_ext_ctrls(&ctrls, VIDIOC_G_CTRL)) { | ||
3981 | int ret = ops->vidioc_g_ext_ctrls(file, fh, &ctrls); | ||
3982 | |||
3983 | if (ret == 0) | ||
3984 | @@ -2179,7 +2197,7 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops, | ||
3985 | ctrls.controls = &ctrl; | ||
3986 | ctrl.id = p->id; | ||
3987 | ctrl.value = p->value; | ||
3988 | - if (check_ext_ctrls(&ctrls, 1)) | ||
3989 | + if (check_ext_ctrls(&ctrls, VIDIOC_S_CTRL)) | ||
3990 | return ops->vidioc_s_ext_ctrls(file, fh, &ctrls); | ||
3991 | return -EINVAL; | ||
3992 | } | ||
3993 | @@ -2201,8 +2219,8 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops *ops, | ||
3994 | vfd, vfd->v4l2_dev->mdev, p); | ||
3995 | if (ops->vidioc_g_ext_ctrls == NULL) | ||
3996 | return -ENOTTY; | ||
3997 | - return check_ext_ctrls(p, 0) ? ops->vidioc_g_ext_ctrls(file, fh, p) : | ||
3998 | - -EINVAL; | ||
3999 | + return check_ext_ctrls(p, VIDIOC_G_EXT_CTRLS) ? | ||
4000 | + ops->vidioc_g_ext_ctrls(file, fh, p) : -EINVAL; | ||
4001 | } | ||
4002 | |||
4003 | static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops, | ||
4004 | @@ -2222,8 +2240,8 @@ static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops, | ||
4005 | vfd, vfd->v4l2_dev->mdev, p); | ||
4006 | if (ops->vidioc_s_ext_ctrls == NULL) | ||
4007 | return -ENOTTY; | ||
4008 | - return check_ext_ctrls(p, 0) ? ops->vidioc_s_ext_ctrls(file, fh, p) : | ||
4009 | - -EINVAL; | ||
4010 | + return check_ext_ctrls(p, VIDIOC_S_EXT_CTRLS) ? | ||
4011 | + ops->vidioc_s_ext_ctrls(file, fh, p) : -EINVAL; | ||
4012 | } | ||
4013 | |||
4014 | static int v4l_try_ext_ctrls(const struct v4l2_ioctl_ops *ops, | ||
4015 | @@ -2243,8 +2261,8 @@ static int v4l_try_ext_ctrls(const struct v4l2_ioctl_ops *ops, | ||
4016 | vfd, vfd->v4l2_dev->mdev, p); | ||
4017 | if (ops->vidioc_try_ext_ctrls == NULL) | ||
4018 | return -ENOTTY; | ||
4019 | - return check_ext_ctrls(p, 0) ? ops->vidioc_try_ext_ctrls(file, fh, p) : | ||
4020 | - -EINVAL; | ||
4021 | + return check_ext_ctrls(p, VIDIOC_TRY_EXT_CTRLS) ? | ||
4022 | + ops->vidioc_try_ext_ctrls(file, fh, p) : -EINVAL; | ||
4023 | } | ||
4024 | |||
4025 | /* | ||
4026 | diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c | ||
4027 | index 2790258346070..84fa32f288c80 100644 | ||
4028 | --- a/drivers/memory/fsl_ifc.c | ||
4029 | +++ b/drivers/memory/fsl_ifc.c | ||
4030 | @@ -263,7 +263,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) | ||
4031 | |||
4032 | ret = fsl_ifc_ctrl_init(fsl_ifc_ctrl_dev); | ||
4033 | if (ret < 0) | ||
4034 | - goto err; | ||
4035 | + goto err_unmap_nandirq; | ||
4036 | |||
4037 | init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait); | ||
4038 | |||
4039 | @@ -272,7 +272,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) | ||
4040 | if (ret != 0) { | ||
4041 | dev_err(&dev->dev, "failed to install irq (%d)\n", | ||
4042 | fsl_ifc_ctrl_dev->irq); | ||
4043 | - goto err_irq; | ||
4044 | + goto err_unmap_nandirq; | ||
4045 | } | ||
4046 | |||
4047 | if (fsl_ifc_ctrl_dev->nand_irq) { | ||
4048 | @@ -281,17 +281,16 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) | ||
4049 | if (ret != 0) { | ||
4050 | dev_err(&dev->dev, "failed to install irq (%d)\n", | ||
4051 | fsl_ifc_ctrl_dev->nand_irq); | ||
4052 | - goto err_nandirq; | ||
4053 | + goto err_free_irq; | ||
4054 | } | ||
4055 | } | ||
4056 | |||
4057 | return 0; | ||
4058 | |||
4059 | -err_nandirq: | ||
4060 | - free_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev); | ||
4061 | - irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq); | ||
4062 | -err_irq: | ||
4063 | +err_free_irq: | ||
4064 | free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev); | ||
4065 | +err_unmap_nandirq: | ||
4066 | + irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq); | ||
4067 | irq_dispose_mapping(fsl_ifc_ctrl_dev->irq); | ||
4068 | err: | ||
4069 | iounmap(fsl_ifc_ctrl_dev->gregs); | ||
4070 | diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c | ||
4071 | index d9ee8e3dc72da..55907e4c36b18 100644 | ||
4072 | --- a/drivers/memstick/core/ms_block.c | ||
4073 | +++ b/drivers/memstick/core/ms_block.c | ||
4074 | @@ -1727,7 +1727,7 @@ static int msb_init_card(struct memstick_dev *card) | ||
4075 | msb->pages_in_block = boot_block->attr.block_size * 2; | ||
4076 | msb->block_size = msb->page_size * msb->pages_in_block; | ||
4077 | |||
4078 | - if (msb->page_size > PAGE_SIZE) { | ||
4079 | + if ((size_t)msb->page_size > PAGE_SIZE) { | ||
4080 | /* this isn't supported by linux at all, anyway*/ | ||
4081 | dbg("device page %d size isn't supported", msb->page_size); | ||
4082 | return -EINVAL; | ||
4083 | diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c | ||
4084 | index 64fff6abe60e8..74d6686b35f77 100644 | ||
4085 | --- a/drivers/memstick/host/jmb38x_ms.c | ||
4086 | +++ b/drivers/memstick/host/jmb38x_ms.c | ||
4087 | @@ -899,7 +899,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt) | ||
4088 | |||
4089 | iounmap(host->addr); | ||
4090 | err_out_free: | ||
4091 | - kfree(msh); | ||
4092 | + memstick_free_host(msh); | ||
4093 | return NULL; | ||
4094 | } | ||
4095 | |||
4096 | diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c | ||
4097 | index d2ef46337191c..eaa2a94d18be4 100644 | ||
4098 | --- a/drivers/memstick/host/r592.c | ||
4099 | +++ b/drivers/memstick/host/r592.c | ||
4100 | @@ -837,15 +837,15 @@ static void r592_remove(struct pci_dev *pdev) | ||
4101 | } | ||
4102 | memstick_remove_host(dev->host); | ||
4103 | |||
4104 | + if (dev->dummy_dma_page) | ||
4105 | + dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page, | ||
4106 | + dev->dummy_dma_page_physical_address); | ||
4107 | + | ||
4108 | free_irq(dev->irq, dev); | ||
4109 | iounmap(dev->mmio); | ||
4110 | pci_release_regions(pdev); | ||
4111 | pci_disable_device(pdev); | ||
4112 | memstick_free_host(dev->host); | ||
4113 | - | ||
4114 | - if (dev->dummy_dma_page) | ||
4115 | - dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page, | ||
4116 | - dev->dummy_dma_page_physical_address); | ||
4117 | } | ||
4118 | |||
4119 | #ifdef CONFIG_PM_SLEEP | ||
4120 | diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig | ||
4121 | index 49ea02c467bf1..1b4a40d910cfb 100644 | ||
4122 | --- a/drivers/mmc/host/Kconfig | ||
4123 | +++ b/drivers/mmc/host/Kconfig | ||
4124 | @@ -449,7 +449,7 @@ config MMC_OMAP_HS | ||
4125 | |||
4126 | config MMC_WBSD | ||
4127 | tristate "Winbond W83L51xD SD/MMC Card Interface support" | ||
4128 | - depends on ISA_DMA_API | ||
4129 | + depends on ISA_DMA_API && !M68K | ||
4130 | help | ||
4131 | This selects the Winbond(R) W83L51xD Secure digital and | ||
4132 | Multimedia card Interface. | ||
4133 | diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c | ||
4134 | index 7b280cb363271..ba37be8e423c2 100644 | ||
4135 | --- a/drivers/mmc/host/dw_mmc.c | ||
4136 | +++ b/drivers/mmc/host/dw_mmc.c | ||
4137 | @@ -2013,7 +2013,8 @@ static void dw_mci_tasklet_func(unsigned long priv) | ||
4138 | * delayed. Allowing the transfer to take place | ||
4139 | * avoids races and keeps things simple. | ||
4140 | */ | ||
4141 | - if (err != -ETIMEDOUT) { | ||
4142 | + if (err != -ETIMEDOUT && | ||
4143 | + host->dir_status == DW_MCI_RECV_STATUS) { | ||
4144 | state = STATE_SENDING_DATA; | ||
4145 | continue; | ||
4146 | } | ||
4147 | diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c | ||
4148 | index 52054931c3507..3a90037254a4d 100644 | ||
4149 | --- a/drivers/mmc/host/mxs-mmc.c | ||
4150 | +++ b/drivers/mmc/host/mxs-mmc.c | ||
4151 | @@ -565,6 +565,11 @@ static const struct of_device_id mxs_mmc_dt_ids[] = { | ||
4152 | }; | ||
4153 | MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids); | ||
4154 | |||
4155 | +static void mxs_mmc_regulator_disable(void *regulator) | ||
4156 | +{ | ||
4157 | + regulator_disable(regulator); | ||
4158 | +} | ||
4159 | + | ||
4160 | static int mxs_mmc_probe(struct platform_device *pdev) | ||
4161 | { | ||
4162 | const struct of_device_id *of_id = | ||
4163 | @@ -606,6 +611,11 @@ static int mxs_mmc_probe(struct platform_device *pdev) | ||
4164 | "Failed to enable vmmc regulator: %d\n", ret); | ||
4165 | goto out_mmc_free; | ||
4166 | } | ||
4167 | + | ||
4168 | + ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable, | ||
4169 | + reg_vmmc); | ||
4170 | + if (ret) | ||
4171 | + goto out_mmc_free; | ||
4172 | } | ||
4173 | |||
4174 | ssp->clk = devm_clk_get(&pdev->dev, NULL); | ||
4175 | diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c | ||
4176 | index d3135249b2e40..346ca41b28f8b 100644 | ||
4177 | --- a/drivers/mmc/host/sdhci-omap.c | ||
4178 | +++ b/drivers/mmc/host/sdhci-omap.c | ||
4179 | @@ -675,7 +675,8 @@ static void sdhci_omap_set_power(struct sdhci_host *host, unsigned char mode, | ||
4180 | { | ||
4181 | struct mmc_host *mmc = host->mmc; | ||
4182 | |||
4183 | - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); | ||
4184 | + if (!IS_ERR(mmc->supply.vmmc)) | ||
4185 | + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); | ||
4186 | } | ||
4187 | |||
4188 | static int sdhci_omap_enable_dma(struct sdhci_host *host) | ||
4189 | diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c | ||
4190 | index 32a76b8feaa5d..ac5d3b6db9b84 100644 | ||
4191 | --- a/drivers/mtd/mtdcore.c | ||
4192 | +++ b/drivers/mtd/mtdcore.c | ||
4193 | @@ -727,8 +727,6 @@ int del_mtd_device(struct mtd_info *mtd) | ||
4194 | |||
4195 | mutex_lock(&mtd_table_mutex); | ||
4196 | |||
4197 | - debugfs_remove_recursive(mtd->dbg.dfs_dir); | ||
4198 | - | ||
4199 | if (idr_find(&mtd_idr, mtd->index) != mtd) { | ||
4200 | ret = -ENODEV; | ||
4201 | goto out_error; | ||
4202 | @@ -744,6 +742,8 @@ int del_mtd_device(struct mtd_info *mtd) | ||
4203 | mtd->index, mtd->name, mtd->usecount); | ||
4204 | ret = -EBUSY; | ||
4205 | } else { | ||
4206 | + debugfs_remove_recursive(mtd->dbg.dfs_dir); | ||
4207 | + | ||
4208 | /* Try to remove the NVMEM provider */ | ||
4209 | if (mtd->nvmem) | ||
4210 | nvmem_unregister(mtd->nvmem); | ||
4211 | diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c | ||
4212 | index 8fcc48056a8bc..569cfd473c87b 100644 | ||
4213 | --- a/drivers/mtd/spi-nor/hisi-sfc.c | ||
4214 | +++ b/drivers/mtd/spi-nor/hisi-sfc.c | ||
4215 | @@ -474,7 +474,6 @@ static int hisi_spi_nor_remove(struct platform_device *pdev) | ||
4216 | |||
4217 | hisi_spi_nor_unregister_all(host); | ||
4218 | mutex_destroy(&host->lock); | ||
4219 | - clk_disable_unprepare(host->clk); | ||
4220 | return 0; | ||
4221 | } | ||
4222 | |||
4223 | diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c | ||
4224 | index fd07561da0348..6a6cdd0bb2585 100644 | ||
4225 | --- a/drivers/net/bonding/bond_sysfs_slave.c | ||
4226 | +++ b/drivers/net/bonding/bond_sysfs_slave.c | ||
4227 | @@ -108,15 +108,15 @@ static ssize_t ad_partner_oper_port_state_show(struct slave *slave, char *buf) | ||
4228 | } | ||
4229 | static SLAVE_ATTR_RO(ad_partner_oper_port_state); | ||
4230 | |||
4231 | -static const struct slave_attribute *slave_attrs[] = { | ||
4232 | - &slave_attr_state, | ||
4233 | - &slave_attr_mii_status, | ||
4234 | - &slave_attr_link_failure_count, | ||
4235 | - &slave_attr_perm_hwaddr, | ||
4236 | - &slave_attr_queue_id, | ||
4237 | - &slave_attr_ad_aggregator_id, | ||
4238 | - &slave_attr_ad_actor_oper_port_state, | ||
4239 | - &slave_attr_ad_partner_oper_port_state, | ||
4240 | +static const struct attribute *slave_attrs[] = { | ||
4241 | + &slave_attr_state.attr, | ||
4242 | + &slave_attr_mii_status.attr, | ||
4243 | + &slave_attr_link_failure_count.attr, | ||
4244 | + &slave_attr_perm_hwaddr.attr, | ||
4245 | + &slave_attr_queue_id.attr, | ||
4246 | + &slave_attr_ad_aggregator_id.attr, | ||
4247 | + &slave_attr_ad_actor_oper_port_state.attr, | ||
4248 | + &slave_attr_ad_partner_oper_port_state.attr, | ||
4249 | NULL | ||
4250 | }; | ||
4251 | |||
4252 | @@ -137,24 +137,10 @@ const struct sysfs_ops slave_sysfs_ops = { | ||
4253 | |||
4254 | int bond_sysfs_slave_add(struct slave *slave) | ||
4255 | { | ||
4256 | - const struct slave_attribute **a; | ||
4257 | - int err; | ||
4258 | - | ||
4259 | - for (a = slave_attrs; *a; ++a) { | ||
4260 | - err = sysfs_create_file(&slave->kobj, &((*a)->attr)); | ||
4261 | - if (err) { | ||
4262 | - kobject_put(&slave->kobj); | ||
4263 | - return err; | ||
4264 | - } | ||
4265 | - } | ||
4266 | - | ||
4267 | - return 0; | ||
4268 | + return sysfs_create_files(&slave->kobj, slave_attrs); | ||
4269 | } | ||
4270 | |||
4271 | void bond_sysfs_slave_del(struct slave *slave) | ||
4272 | { | ||
4273 | - const struct slave_attribute **a; | ||
4274 | - | ||
4275 | - for (a = slave_attrs; *a; ++a) | ||
4276 | - sysfs_remove_file(&slave->kobj, &((*a)->attr)); | ||
4277 | + sysfs_remove_files(&slave->kobj, slave_attrs); | ||
4278 | } | ||
4279 | diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c | ||
4280 | index 7f731bf369980..d047004360615 100644 | ||
4281 | --- a/drivers/net/dsa/rtl8366rb.c | ||
4282 | +++ b/drivers/net/dsa/rtl8366rb.c | ||
4283 | @@ -1264,7 +1264,7 @@ static int rtl8366rb_set_mc_index(struct realtek_smi *smi, int port, int index) | ||
4284 | |||
4285 | static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan) | ||
4286 | { | ||
4287 | - unsigned int max = RTL8366RB_NUM_VLANS; | ||
4288 | + unsigned int max = RTL8366RB_NUM_VLANS - 1; | ||
4289 | |||
4290 | if (smi->vlan4k_enabled) | ||
4291 | max = RTL8366RB_NUM_VIDS - 1; | ||
4292 | diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h | ||
4293 | index b2cd3bdba9f89..533b8519ec352 100644 | ||
4294 | --- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h | ||
4295 | +++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h | ||
4296 | @@ -1331,6 +1331,10 @@ | ||
4297 | #define MDIO_VEND2_PMA_CDR_CONTROL 0x8056 | ||
4298 | #endif | ||
4299 | |||
4300 | +#ifndef MDIO_VEND2_PMA_MISC_CTRL0 | ||
4301 | +#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090 | ||
4302 | +#endif | ||
4303 | + | ||
4304 | #ifndef MDIO_CTRL1_SPEED1G | ||
4305 | #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100) | ||
4306 | #endif | ||
4307 | @@ -1389,6 +1393,10 @@ | ||
4308 | #define XGBE_PMA_RX_RST_0_RESET_ON 0x10 | ||
4309 | #define XGBE_PMA_RX_RST_0_RESET_OFF 0x00 | ||
4310 | |||
4311 | +#define XGBE_PMA_PLL_CTRL_MASK BIT(15) | ||
4312 | +#define XGBE_PMA_PLL_CTRL_ENABLE BIT(15) | ||
4313 | +#define XGBE_PMA_PLL_CTRL_DISABLE 0x0000 | ||
4314 | + | ||
4315 | /* Bit setting and getting macros | ||
4316 | * The get macro will extract the current bit field value from within | ||
4317 | * the variable | ||
4318 | diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | ||
4319 | index d6f6afb67bcc6..0b325ae875b52 100644 | ||
4320 | --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | ||
4321 | +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | ||
4322 | @@ -1972,12 +1972,26 @@ static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) | ||
4323 | } | ||
4324 | } | ||
4325 | |||
4326 | +static void xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable) | ||
4327 | +{ | ||
4328 | + XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0, | ||
4329 | + XGBE_PMA_PLL_CTRL_MASK, | ||
4330 | + enable ? XGBE_PMA_PLL_CTRL_ENABLE | ||
4331 | + : XGBE_PMA_PLL_CTRL_DISABLE); | ||
4332 | + | ||
4333 | + /* Wait for command to complete */ | ||
4334 | + usleep_range(100, 200); | ||
4335 | +} | ||
4336 | + | ||
4337 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, | ||
4338 | unsigned int cmd, unsigned int sub_cmd) | ||
4339 | { | ||
4340 | unsigned int s0 = 0; | ||
4341 | unsigned int wait; | ||
4342 | |||
4343 | + /* Disable PLL re-initialization during FW command processing */ | ||
4344 | + xgbe_phy_pll_ctrl(pdata, false); | ||
4345 | + | ||
4346 | /* Log if a previous command did not complete */ | ||
4347 | if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) { | ||
4348 | netif_dbg(pdata, link, pdata->netdev, | ||
4349 | @@ -1998,7 +2012,7 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, | ||
4350 | wait = XGBE_RATECHANGE_COUNT; | ||
4351 | while (wait--) { | ||
4352 | if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) | ||
4353 | - return; | ||
4354 | + goto reenable_pll; | ||
4355 | |||
4356 | usleep_range(1000, 2000); | ||
4357 | } | ||
4358 | @@ -2008,6 +2022,10 @@ static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, | ||
4359 | |||
4360 | /* Reset on error */ | ||
4361 | xgbe_phy_rx_reset(pdata); | ||
4362 | + | ||
4363 | +reenable_pll: | ||
4364 | + /* Enable PLL re-initialization */ | ||
4365 | + xgbe_phy_pll_ctrl(pdata, true); | ||
4366 | } | ||
4367 | |||
4368 | static void xgbe_phy_rrc(struct xgbe_prv_data *pdata) | ||
4369 | diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c | ||
4370 | index 9361f964bb9b2..816453a4f8d6c 100644 | ||
4371 | --- a/drivers/net/ethernet/cavium/thunder/nic_main.c | ||
4372 | +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c | ||
4373 | @@ -1193,7 +1193,7 @@ static int nic_register_interrupts(struct nicpf *nic) | ||
4374 | dev_err(&nic->pdev->dev, | ||
4375 | "Request for #%d msix vectors failed, returned %d\n", | ||
4376 | nic->num_vec, ret); | ||
4377 | - return 1; | ||
4378 | + return ret; | ||
4379 | } | ||
4380 | |||
4381 | /* Register mailbox interrupt handler */ | ||
4382 | diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c | ||
4383 | index 5c45c0c6dd234..27ea528ef4484 100644 | ||
4384 | --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c | ||
4385 | +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c | ||
4386 | @@ -1226,7 +1226,7 @@ static int nicvf_register_misc_interrupt(struct nicvf *nic) | ||
4387 | if (ret < 0) { | ||
4388 | netdev_err(nic->netdev, | ||
4389 | "Req for #%d msix vectors failed\n", nic->num_vec); | ||
4390 | - return 1; | ||
4391 | + return ret; | ||
4392 | } | ||
4393 | |||
4394 | sprintf(nic->irq_name[irq], "%s Mbox", "NICVF"); | ||
4395 | @@ -1245,7 +1245,7 @@ static int nicvf_register_misc_interrupt(struct nicvf *nic) | ||
4396 | if (!nicvf_check_pf_ready(nic)) { | ||
4397 | nicvf_disable_intr(nic, NICVF_INTR_MBOX, 0); | ||
4398 | nicvf_unregister_interrupts(nic); | ||
4399 | - return 1; | ||
4400 | + return -EIO; | ||
4401 | } | ||
4402 | |||
4403 | return 0; | ||
4404 | diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | ||
4405 | index f537be9cb3155..5ba30b8eb1e11 100644 | ||
4406 | --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | ||
4407 | +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | ||
4408 | @@ -1466,12 +1466,15 @@ static int cxgb4_get_module_info(struct net_device *dev, | ||
4409 | if (ret) | ||
4410 | return ret; | ||
4411 | |||
4412 | - if (!sff8472_comp || (sff_diag_type & 4)) { | ||
4413 | + if (!sff8472_comp || (sff_diag_type & SFP_DIAG_ADDRMODE)) { | ||
4414 | modinfo->type = ETH_MODULE_SFF_8079; | ||
4415 | modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; | ||
4416 | } else { | ||
4417 | modinfo->type = ETH_MODULE_SFF_8472; | ||
4418 | - modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; | ||
4419 | + if (sff_diag_type & SFP_DIAG_IMPLEMENTED) | ||
4420 | + modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; | ||
4421 | + else | ||
4422 | + modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN / 2; | ||
4423 | } | ||
4424 | break; | ||
4425 | |||
4426 | diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | ||
4427 | index 002fc62ea7262..63bc956d20376 100644 | ||
4428 | --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | ||
4429 | +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | ||
4430 | @@ -293,6 +293,8 @@ enum { | ||
4431 | #define I2C_PAGE_SIZE 0x100 | ||
4432 | #define SFP_DIAG_TYPE_ADDR 0x5c | ||
4433 | #define SFP_DIAG_TYPE_LEN 0x1 | ||
4434 | +#define SFP_DIAG_ADDRMODE BIT(2) | ||
4435 | +#define SFP_DIAG_IMPLEMENTED BIT(6) | ||
4436 | #define SFF_8472_COMP_ADDR 0x5e | ||
4437 | #define SFF_8472_COMP_LEN 0x1 | ||
4438 | #define SFF_REV_ADDR 0x1 | ||
4439 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | ||
4440 | index 9076605403a74..bb22d91f6e53e 100644 | ||
4441 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | ||
4442 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | ||
4443 | @@ -124,7 +124,7 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets, | ||
4444 | if (ret) | ||
4445 | return ret; | ||
4446 | |||
4447 | - for (i = 0; i < hdev->tc_max; i++) { | ||
4448 | + for (i = 0; i < HNAE3_MAX_TC; i++) { | ||
4449 | switch (ets->tc_tsa[i]) { | ||
4450 | case IEEE_8021QAZ_TSA_STRICT: | ||
4451 | if (hdev->tm_info.tc_info[i].tc_sch_mode != | ||
4452 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | ||
4453 | index d98f0e2ec7aa3..8448607742a6b 100644 | ||
4454 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | ||
4455 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | ||
4456 | @@ -974,7 +974,6 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclge_dev *hdev) | ||
4457 | |||
4458 | static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev) | ||
4459 | { | ||
4460 | -#define DEFAULT_TC_WEIGHT 1 | ||
4461 | #define DEFAULT_TC_OFFSET 14 | ||
4462 | |||
4463 | struct hclge_ets_tc_weight_cmd *ets_weight; | ||
4464 | @@ -987,13 +986,7 @@ static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev) | ||
4465 | for (i = 0; i < HNAE3_MAX_TC; i++) { | ||
4466 | struct hclge_pg_info *pg_info; | ||
4467 | |||
4468 | - ets_weight->tc_weight[i] = DEFAULT_TC_WEIGHT; | ||
4469 | - | ||
4470 | - if (!(hdev->hw_tc_map & BIT(i))) | ||
4471 | - continue; | ||
4472 | - | ||
4473 | - pg_info = | ||
4474 | - &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid]; | ||
4475 | + pg_info = &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid]; | ||
4476 | ets_weight->tc_weight[i] = pg_info->tc_dwrr[i]; | ||
4477 | } | ||
4478 | |||
4479 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c | ||
4480 | index cfe7229593ead..9adfc0a7ab823 100644 | ||
4481 | --- a/drivers/net/ethernet/ibm/ibmvnic.c | ||
4482 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c | ||
4483 | @@ -1462,8 +1462,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) | ||
4484 | netdev_tx_t ret = NETDEV_TX_OK; | ||
4485 | |||
4486 | if (test_bit(0, &adapter->resetting)) { | ||
4487 | - if (!netif_subqueue_stopped(netdev, skb)) | ||
4488 | - netif_stop_subqueue(netdev, queue_num); | ||
4489 | dev_kfree_skb_any(skb); | ||
4490 | |||
4491 | tx_send_failed++; | ||
4492 | @@ -4936,6 +4934,9 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter) | ||
4493 | crq->cur = 0; | ||
4494 | spin_lock_init(&crq->lock); | ||
4495 | |||
4496 | + /* process any CRQs that were queued before we enabled interrupts */ | ||
4497 | + tasklet_schedule(&adapter->tasklet); | ||
4498 | + | ||
4499 | return retrc; | ||
4500 | |||
4501 | req_irq_failed: | ||
4502 | diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c | ||
4503 | index 8f732771d3fad..bd2966eb6b7d3 100644 | ||
4504 | --- a/drivers/net/ethernet/netronome/nfp/bpf/main.c | ||
4505 | +++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c | ||
4506 | @@ -182,15 +182,21 @@ static int | ||
4507 | nfp_bpf_check_mtu(struct nfp_app *app, struct net_device *netdev, int new_mtu) | ||
4508 | { | ||
4509 | struct nfp_net *nn = netdev_priv(netdev); | ||
4510 | - unsigned int max_mtu; | ||
4511 | + struct nfp_bpf_vnic *bv; | ||
4512 | + struct bpf_prog *prog; | ||
4513 | |||
4514 | if (~nn->dp.ctrl & NFP_NET_CFG_CTRL_BPF) | ||
4515 | return 0; | ||
4516 | |||
4517 | - max_mtu = nn_readb(nn, NFP_NET_CFG_BPF_INL_MTU) * 64 - 32; | ||
4518 | - if (new_mtu > max_mtu) { | ||
4519 | - nn_info(nn, "BPF offload active, MTU over %u not supported\n", | ||
4520 | - max_mtu); | ||
4521 | + if (nn->xdp_hw.prog) { | ||
4522 | + prog = nn->xdp_hw.prog; | ||
4523 | + } else { | ||
4524 | + bv = nn->app_priv; | ||
4525 | + prog = bv->tc_prog; | ||
4526 | + } | ||
4527 | + | ||
4528 | + if (nfp_bpf_offload_check_mtu(nn, prog, new_mtu)) { | ||
4529 | + nn_info(nn, "BPF offload active, potential packet access beyond hardware packet boundary"); | ||
4530 | return -EBUSY; | ||
4531 | } | ||
4532 | return 0; | ||
4533 | diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.h b/drivers/net/ethernet/netronome/nfp/bpf/main.h | ||
4534 | index fac9c6f9e197b..c74620fcc539c 100644 | ||
4535 | --- a/drivers/net/ethernet/netronome/nfp/bpf/main.h | ||
4536 | +++ b/drivers/net/ethernet/netronome/nfp/bpf/main.h | ||
4537 | @@ -560,6 +560,8 @@ bool nfp_is_subprog_start(struct nfp_insn_meta *meta); | ||
4538 | void nfp_bpf_jit_prepare(struct nfp_prog *nfp_prog); | ||
4539 | int nfp_bpf_jit(struct nfp_prog *prog); | ||
4540 | bool nfp_bpf_supported_opcode(u8 code); | ||
4541 | +bool nfp_bpf_offload_check_mtu(struct nfp_net *nn, struct bpf_prog *prog, | ||
4542 | + unsigned int mtu); | ||
4543 | |||
4544 | int nfp_verify_insn(struct bpf_verifier_env *env, int insn_idx, | ||
4545 | int prev_insn_idx); | ||
4546 | diff --git a/drivers/net/ethernet/netronome/nfp/bpf/offload.c b/drivers/net/ethernet/netronome/nfp/bpf/offload.c | ||
4547 | index 88fab6a82acff..7ff388ecc7e3a 100644 | ||
4548 | --- a/drivers/net/ethernet/netronome/nfp/bpf/offload.c | ||
4549 | +++ b/drivers/net/ethernet/netronome/nfp/bpf/offload.c | ||
4550 | @@ -477,19 +477,28 @@ int nfp_bpf_event_output(struct nfp_app_bpf *bpf, const void *data, | ||
4551 | return 0; | ||
4552 | } | ||
4553 | |||
4554 | +bool nfp_bpf_offload_check_mtu(struct nfp_net *nn, struct bpf_prog *prog, | ||
4555 | + unsigned int mtu) | ||
4556 | +{ | ||
4557 | + unsigned int fw_mtu, pkt_off; | ||
4558 | + | ||
4559 | + fw_mtu = nn_readb(nn, NFP_NET_CFG_BPF_INL_MTU) * 64 - 32; | ||
4560 | + pkt_off = min(prog->aux->max_pkt_offset, mtu); | ||
4561 | + | ||
4562 | + return fw_mtu < pkt_off; | ||
4563 | +} | ||
4564 | + | ||
4565 | static int | ||
4566 | nfp_net_bpf_load(struct nfp_net *nn, struct bpf_prog *prog, | ||
4567 | struct netlink_ext_ack *extack) | ||
4568 | { | ||
4569 | struct nfp_prog *nfp_prog = prog->aux->offload->dev_priv; | ||
4570 | - unsigned int fw_mtu, pkt_off, max_stack, max_prog_len; | ||
4571 | + unsigned int max_stack, max_prog_len; | ||
4572 | dma_addr_t dma_addr; | ||
4573 | void *img; | ||
4574 | int err; | ||
4575 | |||
4576 | - fw_mtu = nn_readb(nn, NFP_NET_CFG_BPF_INL_MTU) * 64 - 32; | ||
4577 | - pkt_off = min(prog->aux->max_pkt_offset, nn->dp.netdev->mtu); | ||
4578 | - if (fw_mtu < pkt_off) { | ||
4579 | + if (nfp_bpf_offload_check_mtu(nn, prog, nn->dp.netdev->mtu)) { | ||
4580 | NL_SET_ERR_MSG_MOD(extack, "BPF offload not supported with potential packet access beyond HW packet split boundary"); | ||
4581 | return -EOPNOTSUPP; | ||
4582 | } | ||
4583 | diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c | ||
4584 | index 623d86e5e970f..8d2b184ff5758 100644 | ||
4585 | --- a/drivers/net/ethernet/realtek/r8169_main.c | ||
4586 | +++ b/drivers/net/ethernet/realtek/r8169_main.c | ||
4587 | @@ -212,6 +212,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = { | ||
4588 | { PCI_VDEVICE(REALTEK, 0x8129) }, | ||
4589 | { PCI_VDEVICE(REALTEK, 0x8136), RTL_CFG_NO_GBIT }, | ||
4590 | { PCI_VDEVICE(REALTEK, 0x8161) }, | ||
4591 | + { PCI_VDEVICE(REALTEK, 0x8162) }, | ||
4592 | { PCI_VDEVICE(REALTEK, 0x8167) }, | ||
4593 | { PCI_VDEVICE(REALTEK, 0x8168) }, | ||
4594 | { PCI_VDEVICE(NCUBE, 0x8168) }, | ||
4595 | diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c | ||
4596 | index 59b4f16896a81..1fa1b71dbfa11 100644 | ||
4597 | --- a/drivers/net/ethernet/sfc/ptp.c | ||
4598 | +++ b/drivers/net/ethernet/sfc/ptp.c | ||
4599 | @@ -648,7 +648,7 @@ static int efx_ptp_get_attributes(struct efx_nic *efx) | ||
4600 | } else if (rc == -EINVAL) { | ||
4601 | fmt = MC_CMD_PTP_OUT_GET_ATTRIBUTES_SECONDS_NANOSECONDS; | ||
4602 | } else if (rc == -EPERM) { | ||
4603 | - netif_info(efx, probe, efx->net_dev, "no PTP support\n"); | ||
4604 | + pci_info(efx->pci_dev, "no PTP support\n"); | ||
4605 | return rc; | ||
4606 | } else { | ||
4607 | efx_mcdi_display_error(efx, MC_CMD_PTP, sizeof(inbuf), | ||
4608 | @@ -824,7 +824,7 @@ static int efx_ptp_disable(struct efx_nic *efx) | ||
4609 | * should only have been called during probe. | ||
4610 | */ | ||
4611 | if (rc == -ENOSYS || rc == -EPERM) | ||
4612 | - netif_info(efx, probe, efx->net_dev, "no PTP support\n"); | ||
4613 | + pci_info(efx->pci_dev, "no PTP support\n"); | ||
4614 | else if (rc) | ||
4615 | efx_mcdi_display_error(efx, MC_CMD_PTP, | ||
4616 | MC_CMD_PTP_IN_DISABLE_LEN, | ||
4617 | diff --git a/drivers/net/ethernet/sfc/siena_sriov.c b/drivers/net/ethernet/sfc/siena_sriov.c | ||
4618 | index dfbdf05dcf794..68f092881d137 100644 | ||
4619 | --- a/drivers/net/ethernet/sfc/siena_sriov.c | ||
4620 | +++ b/drivers/net/ethernet/sfc/siena_sriov.c | ||
4621 | @@ -1056,7 +1056,7 @@ void efx_siena_sriov_probe(struct efx_nic *efx) | ||
4622 | return; | ||
4623 | |||
4624 | if (efx_siena_sriov_cmd(efx, false, &efx->vi_scale, &count)) { | ||
4625 | - netif_info(efx, probe, efx->net_dev, "no SR-IOV VFs probed\n"); | ||
4626 | + pci_info(efx->pci_dev, "no SR-IOV VFs probed\n"); | ||
4627 | return; | ||
4628 | } | ||
4629 | if (count > 0 && count > max_vfs) | ||
4630 | diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c | ||
4631 | index 6869c5c74b9f7..fac59032bf83a 100644 | ||
4632 | --- a/drivers/net/ethernet/ti/davinci_emac.c | ||
4633 | +++ b/drivers/net/ethernet/ti/davinci_emac.c | ||
4634 | @@ -412,8 +412,20 @@ static int emac_set_coalesce(struct net_device *ndev, | ||
4635 | u32 int_ctrl, num_interrupts = 0; | ||
4636 | u32 prescale = 0, addnl_dvdr = 1, coal_intvl = 0; | ||
4637 | |||
4638 | - if (!coal->rx_coalesce_usecs) | ||
4639 | - return -EINVAL; | ||
4640 | + if (!coal->rx_coalesce_usecs) { | ||
4641 | + priv->coal_intvl = 0; | ||
4642 | + | ||
4643 | + switch (priv->version) { | ||
4644 | + case EMAC_VERSION_2: | ||
4645 | + emac_ctrl_write(EMAC_DM646X_CMINTCTRL, 0); | ||
4646 | + break; | ||
4647 | + default: | ||
4648 | + emac_ctrl_write(EMAC_CTRL_EWINTTCNT, 0); | ||
4649 | + break; | ||
4650 | + } | ||
4651 | + | ||
4652 | + return 0; | ||
4653 | + } | ||
4654 | |||
4655 | coal_intvl = coal->rx_coalesce_usecs; | ||
4656 | |||
4657 | diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c | ||
4658 | index f95bd1b0fb965..0b61d80ea3f8c 100644 | ||
4659 | --- a/drivers/net/phy/micrel.c | ||
4660 | +++ b/drivers/net/phy/micrel.c | ||
4661 | @@ -1040,8 +1040,9 @@ static struct phy_driver ksphy_driver[] = { | ||
4662 | .get_sset_count = kszphy_get_sset_count, | ||
4663 | .get_strings = kszphy_get_strings, | ||
4664 | .get_stats = kszphy_get_stats, | ||
4665 | - .suspend = genphy_suspend, | ||
4666 | - .resume = genphy_resume, | ||
4667 | + /* No suspend/resume callbacks because of errata DS80000700A, | ||
4668 | + * receiver error following software power down. | ||
4669 | + */ | ||
4670 | }, { | ||
4671 | .phy_id = PHY_ID_KSZ8041RNLI, | ||
4672 | .phy_id_mask = MICREL_PHY_ID_MASK, | ||
4673 | diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c | ||
4674 | index bf5bbb565cf5e..7be43a1eaefda 100644 | ||
4675 | --- a/drivers/net/phy/phylink.c | ||
4676 | +++ b/drivers/net/phy/phylink.c | ||
4677 | @@ -1331,7 +1331,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, | ||
4678 | return -EOPNOTSUPP; | ||
4679 | |||
4680 | if (!phylink_test(pl->supported, Asym_Pause) && | ||
4681 | - !pause->autoneg && pause->rx_pause != pause->tx_pause) | ||
4682 | + pause->rx_pause != pause->tx_pause) | ||
4683 | return -EINVAL; | ||
4684 | |||
4685 | config->pause &= ~(MLO_PAUSE_AN | MLO_PAUSE_TXRX_MASK); | ||
4686 | diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c | ||
4687 | index a06e6ab453f50..cf090f88dac03 100644 | ||
4688 | --- a/drivers/net/vmxnet3/vmxnet3_drv.c | ||
4689 | +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | ||
4690 | @@ -3634,7 +3634,6 @@ vmxnet3_suspend(struct device *device) | ||
4691 | vmxnet3_free_intr_resources(adapter); | ||
4692 | |||
4693 | netif_device_detach(netdev); | ||
4694 | - netif_tx_stop_all_queues(netdev); | ||
4695 | |||
4696 | /* Create wake-up filters. */ | ||
4697 | pmConf = adapter->pm_conf; | ||
4698 | diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c | ||
4699 | index f08ed52d51f3f..f436b8c130611 100644 | ||
4700 | --- a/drivers/net/vrf.c | ||
4701 | +++ b/drivers/net/vrf.c | ||
4702 | @@ -33,6 +33,7 @@ | ||
4703 | #include <net/l3mdev.h> | ||
4704 | #include <net/fib_rules.h> | ||
4705 | #include <net/netns/generic.h> | ||
4706 | +#include <net/netfilter/nf_conntrack.h> | ||
4707 | |||
4708 | #define DRV_NAME "vrf" | ||
4709 | #define DRV_VERSION "1.0" | ||
4710 | @@ -147,12 +148,26 @@ static int vrf_local_xmit(struct sk_buff *skb, struct net_device *dev, | ||
4711 | return NETDEV_TX_OK; | ||
4712 | } | ||
4713 | |||
4714 | +static void vrf_nf_set_untracked(struct sk_buff *skb) | ||
4715 | +{ | ||
4716 | + if (skb_get_nfct(skb) == 0) | ||
4717 | + nf_ct_set(skb, NULL, IP_CT_UNTRACKED); | ||
4718 | +} | ||
4719 | + | ||
4720 | +static void vrf_nf_reset_ct(struct sk_buff *skb) | ||
4721 | +{ | ||
4722 | + if (skb_get_nfct(skb) == IP_CT_UNTRACKED) | ||
4723 | + nf_reset_ct(skb); | ||
4724 | +} | ||
4725 | + | ||
4726 | #if IS_ENABLED(CONFIG_IPV6) | ||
4727 | static int vrf_ip6_local_out(struct net *net, struct sock *sk, | ||
4728 | struct sk_buff *skb) | ||
4729 | { | ||
4730 | int err; | ||
4731 | |||
4732 | + vrf_nf_reset_ct(skb); | ||
4733 | + | ||
4734 | err = nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, | ||
4735 | sk, skb, NULL, skb_dst(skb)->dev, dst_output); | ||
4736 | |||
4737 | @@ -232,6 +247,8 @@ static int vrf_ip_local_out(struct net *net, struct sock *sk, | ||
4738 | { | ||
4739 | int err; | ||
4740 | |||
4741 | + vrf_nf_reset_ct(skb); | ||
4742 | + | ||
4743 | err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk, | ||
4744 | skb, NULL, skb_dst(skb)->dev, dst_output); | ||
4745 | if (likely(err == 1)) | ||
4746 | @@ -351,8 +368,7 @@ static void vrf_finish_direct(struct sk_buff *skb) | ||
4747 | skb_pull(skb, ETH_HLEN); | ||
4748 | } | ||
4749 | |||
4750 | - /* reset skb device */ | ||
4751 | - nf_reset_ct(skb); | ||
4752 | + vrf_nf_reset_ct(skb); | ||
4753 | } | ||
4754 | |||
4755 | #if IS_ENABLED(CONFIG_IPV6) | ||
4756 | @@ -366,7 +382,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, | ||
4757 | struct neighbour *neigh; | ||
4758 | int ret; | ||
4759 | |||
4760 | - nf_reset_ct(skb); | ||
4761 | + vrf_nf_reset_ct(skb); | ||
4762 | |||
4763 | skb->protocol = htons(ETH_P_IPV6); | ||
4764 | skb->dev = dev; | ||
4765 | @@ -477,6 +493,8 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, | ||
4766 | |||
4767 | skb->dev = vrf_dev; | ||
4768 | |||
4769 | + vrf_nf_set_untracked(skb); | ||
4770 | + | ||
4771 | err = nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, | ||
4772 | skb, NULL, vrf_dev, vrf_ip6_out_direct_finish); | ||
4773 | |||
4774 | @@ -584,7 +602,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s | ||
4775 | bool is_v6gw = false; | ||
4776 | int ret = -EINVAL; | ||
4777 | |||
4778 | - nf_reset_ct(skb); | ||
4779 | + vrf_nf_reset_ct(skb); | ||
4780 | |||
4781 | /* Be paranoid, rather than too clever. */ | ||
4782 | if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { | ||
4783 | @@ -712,6 +730,8 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, | ||
4784 | |||
4785 | skb->dev = vrf_dev; | ||
4786 | |||
4787 | + vrf_nf_set_untracked(skb); | ||
4788 | + | ||
4789 | err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk, | ||
4790 | skb, NULL, vrf_dev, vrf_ip_out_direct_finish); | ||
4791 | |||
4792 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c | ||
4793 | index 20e248fd43642..3026eb54a7f23 100644 | ||
4794 | --- a/drivers/net/wireless/ath/ath10k/mac.c | ||
4795 | +++ b/drivers/net/wireless/ath/ath10k/mac.c | ||
4796 | @@ -985,8 +985,12 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif) | ||
4797 | ath10k_mac_vif_beacon_free(arvif); | ||
4798 | |||
4799 | if (arvif->beacon_buf) { | ||
4800 | - dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, | ||
4801 | - arvif->beacon_buf, arvif->beacon_paddr); | ||
4802 | + if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) | ||
4803 | + kfree(arvif->beacon_buf); | ||
4804 | + else | ||
4805 | + dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, | ||
4806 | + arvif->beacon_buf, | ||
4807 | + arvif->beacon_paddr); | ||
4808 | arvif->beacon_buf = NULL; | ||
4809 | } | ||
4810 | } | ||
4811 | @@ -1040,7 +1044,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) | ||
4812 | arg.channel.min_power = 0; | ||
4813 | arg.channel.max_power = channel->max_power * 2; | ||
4814 | arg.channel.max_reg_power = channel->max_reg_power * 2; | ||
4815 | - arg.channel.max_antenna_gain = channel->max_antenna_gain * 2; | ||
4816 | + arg.channel.max_antenna_gain = channel->max_antenna_gain; | ||
4817 | |||
4818 | reinit_completion(&ar->vdev_setup_done); | ||
4819 | reinit_completion(&ar->vdev_delete_done); | ||
4820 | @@ -1486,7 +1490,7 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, | ||
4821 | arg.channel.min_power = 0; | ||
4822 | arg.channel.max_power = chandef->chan->max_power * 2; | ||
4823 | arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; | ||
4824 | - arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; | ||
4825 | + arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; | ||
4826 | |||
4827 | if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { | ||
4828 | arg.ssid = arvif->u.ap.ssid; | ||
4829 | @@ -3145,7 +3149,7 @@ static int ath10k_update_channel_list(struct ath10k *ar) | ||
4830 | ch->min_power = 0; | ||
4831 | ch->max_power = channel->max_power * 2; | ||
4832 | ch->max_reg_power = channel->max_reg_power * 2; | ||
4833 | - ch->max_antenna_gain = channel->max_antenna_gain * 2; | ||
4834 | + ch->max_antenna_gain = channel->max_antenna_gain; | ||
4835 | ch->reg_class_id = 0; /* FIXME */ | ||
4836 | |||
4837 | /* FIXME: why use only legacy modes, why not any | ||
4838 | @@ -5251,10 +5255,25 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, | ||
4839 | if (vif->type == NL80211_IFTYPE_ADHOC || | ||
4840 | vif->type == NL80211_IFTYPE_MESH_POINT || | ||
4841 | vif->type == NL80211_IFTYPE_AP) { | ||
4842 | - arvif->beacon_buf = dma_alloc_coherent(ar->dev, | ||
4843 | - IEEE80211_MAX_FRAME_LEN, | ||
4844 | - &arvif->beacon_paddr, | ||
4845 | - GFP_ATOMIC); | ||
4846 | + if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) { | ||
4847 | + arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN, | ||
4848 | + GFP_KERNEL); | ||
4849 | + | ||
4850 | + /* Using a kernel pointer in place of a dma_addr_t | ||
4851 | + * token can lead to undefined behavior if that | ||
4852 | + * makes it into cache management functions. Use a | ||
4853 | + * known-invalid address token instead, which | ||
4854 | + * avoids the warning and makes it easier to catch | ||
4855 | + * bugs if it does end up getting used. | ||
4856 | + */ | ||
4857 | + arvif->beacon_paddr = DMA_MAPPING_ERROR; | ||
4858 | + } else { | ||
4859 | + arvif->beacon_buf = | ||
4860 | + dma_alloc_coherent(ar->dev, | ||
4861 | + IEEE80211_MAX_FRAME_LEN, | ||
4862 | + &arvif->beacon_paddr, | ||
4863 | + GFP_ATOMIC); | ||
4864 | + } | ||
4865 | if (!arvif->beacon_buf) { | ||
4866 | ret = -ENOMEM; | ||
4867 | ath10k_warn(ar, "failed to allocate beacon buffer: %d\n", | ||
4868 | @@ -5469,8 +5488,12 @@ err_vdev_delete: | ||
4869 | |||
4870 | err: | ||
4871 | if (arvif->beacon_buf) { | ||
4872 | - dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, | ||
4873 | - arvif->beacon_buf, arvif->beacon_paddr); | ||
4874 | + if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) | ||
4875 | + kfree(arvif->beacon_buf); | ||
4876 | + else | ||
4877 | + dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, | ||
4878 | + arvif->beacon_buf, | ||
4879 | + arvif->beacon_paddr); | ||
4880 | arvif->beacon_buf = NULL; | ||
4881 | } | ||
4882 | |||
4883 | diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c | ||
4884 | index 05c0d5e92475e..326e1dc4c6734 100644 | ||
4885 | --- a/drivers/net/wireless/ath/ath10k/usb.c | ||
4886 | +++ b/drivers/net/wireless/ath/ath10k/usb.c | ||
4887 | @@ -525,7 +525,7 @@ static int ath10k_usb_submit_ctrl_in(struct ath10k *ar, | ||
4888 | req, | ||
4889 | USB_DIR_IN | USB_TYPE_VENDOR | | ||
4890 | USB_RECIP_DEVICE, value, index, buf, | ||
4891 | - size, 2 * HZ); | ||
4892 | + size, 2000); | ||
4893 | |||
4894 | if (ret < 0) { | ||
4895 | ath10k_warn(ar, "Failed to read usb control message: %d\n", | ||
4896 | @@ -865,6 +865,11 @@ static int ath10k_usb_setup_pipe_resources(struct ath10k *ar, | ||
4897 | le16_to_cpu(endpoint->wMaxPacketSize), | ||
4898 | endpoint->bInterval); | ||
4899 | } | ||
4900 | + | ||
4901 | + /* Ignore broken descriptors. */ | ||
4902 | + if (usb_endpoint_maxp(endpoint) == 0) | ||
4903 | + continue; | ||
4904 | + | ||
4905 | urbcount = 0; | ||
4906 | |||
4907 | pipe_num = | ||
4908 | diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c | ||
4909 | index 91604a14a8f46..796bd93c599b1 100644 | ||
4910 | --- a/drivers/net/wireless/ath/ath10k/wmi.c | ||
4911 | +++ b/drivers/net/wireless/ath/ath10k/wmi.c | ||
4912 | @@ -2541,6 +2541,10 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) | ||
4913 | if (ieee80211_is_beacon(hdr->frame_control)) | ||
4914 | ath10k_mac_handle_beacon(ar, skb); | ||
4915 | |||
4916 | + if (ieee80211_is_beacon(hdr->frame_control) || | ||
4917 | + ieee80211_is_probe_resp(hdr->frame_control)) | ||
4918 | + status->boottime_ns = ktime_get_boottime_ns(); | ||
4919 | + | ||
4920 | ath10k_dbg(ar, ATH10K_DBG_MGMT, | ||
4921 | "event mgmt rx skb %pK len %d ftype %02x stype %02x\n", | ||
4922 | skb, skb->len, | ||
4923 | diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h | ||
4924 | index 761bc4a7064df..de22396d085ce 100644 | ||
4925 | --- a/drivers/net/wireless/ath/ath10k/wmi.h | ||
4926 | +++ b/drivers/net/wireless/ath/ath10k/wmi.h | ||
4927 | @@ -2045,7 +2045,9 @@ struct wmi_channel { | ||
4928 | union { | ||
4929 | __le32 reginfo1; | ||
4930 | struct { | ||
4931 | + /* note: power unit is 1 dBm */ | ||
4932 | u8 antenna_max; | ||
4933 | + /* note: power unit is 0.5 dBm */ | ||
4934 | u8 max_tx_power; | ||
4935 | } __packed; | ||
4936 | } __packed; | ||
4937 | @@ -2065,6 +2067,7 @@ struct wmi_channel_arg { | ||
4938 | u32 min_power; | ||
4939 | u32 max_power; | ||
4940 | u32 max_reg_power; | ||
4941 | + /* note: power unit is 1 dBm */ | ||
4942 | u32 max_antenna_gain; | ||
4943 | u32 reg_class_id; | ||
4944 | enum wmi_phy_mode mode; | ||
4945 | diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c | ||
4946 | index 53b66e9434c99..8b24964304b1f 100644 | ||
4947 | --- a/drivers/net/wireless/ath/ath6kl/usb.c | ||
4948 | +++ b/drivers/net/wireless/ath/ath6kl/usb.c | ||
4949 | @@ -340,6 +340,11 @@ static int ath6kl_usb_setup_pipe_resources(struct ath6kl_usb *ar_usb) | ||
4950 | le16_to_cpu(endpoint->wMaxPacketSize), | ||
4951 | endpoint->bInterval); | ||
4952 | } | ||
4953 | + | ||
4954 | + /* Ignore broken descriptors. */ | ||
4955 | + if (usb_endpoint_maxp(endpoint) == 0) | ||
4956 | + continue; | ||
4957 | + | ||
4958 | urbcount = 0; | ||
4959 | |||
4960 | pipe_num = | ||
4961 | @@ -907,7 +912,7 @@ static int ath6kl_usb_submit_ctrl_in(struct ath6kl_usb *ar_usb, | ||
4962 | req, | ||
4963 | USB_DIR_IN | USB_TYPE_VENDOR | | ||
4964 | USB_RECIP_DEVICE, value, index, buf, | ||
4965 | - size, 2 * HZ); | ||
4966 | + size, 2000); | ||
4967 | |||
4968 | if (ret < 0) { | ||
4969 | ath6kl_warn("Failed to read usb control message: %d\n", ret); | ||
4970 | diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c | ||
4971 | index 28ccdcb197de2..ec13bd8d5487d 100644 | ||
4972 | --- a/drivers/net/wireless/ath/ath9k/main.c | ||
4973 | +++ b/drivers/net/wireless/ath/ath9k/main.c | ||
4974 | @@ -530,8 +530,10 @@ irqreturn_t ath_isr(int irq, void *dev) | ||
4975 | ath9k_debug_sync_cause(sc, sync_cause); | ||
4976 | status &= ah->imask; /* discard unasked-for bits */ | ||
4977 | |||
4978 | - if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) | ||
4979 | + if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) { | ||
4980 | + ath9k_hw_kill_interrupts(sc->sc_ah); | ||
4981 | return IRQ_HANDLED; | ||
4982 | + } | ||
4983 | |||
4984 | /* | ||
4985 | * If there are no status bits set, then this interrupt was not | ||
4986 | diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c | ||
4987 | index a274eb0d19688..a0ad6e48a35b4 100644 | ||
4988 | --- a/drivers/net/wireless/ath/dfs_pattern_detector.c | ||
4989 | +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c | ||
4990 | @@ -182,10 +182,12 @@ static void channel_detector_exit(struct dfs_pattern_detector *dpd, | ||
4991 | if (cd == NULL) | ||
4992 | return; | ||
4993 | list_del(&cd->head); | ||
4994 | - for (i = 0; i < dpd->num_radar_types; i++) { | ||
4995 | - struct pri_detector *de = cd->detectors[i]; | ||
4996 | - if (de != NULL) | ||
4997 | - de->exit(de); | ||
4998 | + if (cd->detectors) { | ||
4999 | + for (i = 0; i < dpd->num_radar_types; i++) { | ||
5000 | + struct pri_detector *de = cd->detectors[i]; | ||
5001 | + if (de != NULL) | ||
5002 | + de->exit(de); | ||
5003 | + } | ||
5004 | } | ||
5005 | kfree(cd->detectors); | ||
5006 | kfree(cd); | ||
5007 | diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c | ||
5008 | index bab30f7a443ce..4da25e84793b7 100644 | ||
5009 | --- a/drivers/net/wireless/ath/wcn36xx/dxe.c | ||
5010 | +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c | ||
5011 | @@ -563,6 +563,10 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn, | ||
5012 | dxe = ctl->desc; | ||
5013 | |||
5014 | while (!(READ_ONCE(dxe->ctrl) & WCN36xx_DXE_CTRL_VLD)) { | ||
5015 | + /* do not read until we own DMA descriptor */ | ||
5016 | + dma_rmb(); | ||
5017 | + | ||
5018 | + /* read/modify DMA descriptor */ | ||
5019 | skb = ctl->skb; | ||
5020 | dma_addr = dxe->dst_addr_l; | ||
5021 | ret = wcn36xx_dxe_fill_skb(wcn->dev, ctl, GFP_ATOMIC); | ||
5022 | @@ -573,9 +577,15 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn, | ||
5023 | dma_unmap_single(wcn->dev, dma_addr, WCN36XX_PKT_SIZE, | ||
5024 | DMA_FROM_DEVICE); | ||
5025 | wcn36xx_rx_skb(wcn, skb); | ||
5026 | - } /* else keep old skb not submitted and use it for rx DMA */ | ||
5027 | + } | ||
5028 | + /* else keep old skb not submitted and reuse it for rx DMA | ||
5029 | + * (dropping the packet that it contained) | ||
5030 | + */ | ||
5031 | |||
5032 | + /* flush descriptor changes before re-marking as valid */ | ||
5033 | + dma_wmb(); | ||
5034 | dxe->ctrl = ctrl; | ||
5035 | + | ||
5036 | ctl = ctl->next; | ||
5037 | dxe = ctl->desc; | ||
5038 | } | ||
5039 | diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c | ||
5040 | index 556ba3c6c5d8e..eb5d08bf25032 100644 | ||
5041 | --- a/drivers/net/wireless/ath/wcn36xx/main.c | ||
5042 | +++ b/drivers/net/wireless/ath/wcn36xx/main.c | ||
5043 | @@ -134,7 +134,9 @@ static struct ieee80211_supported_band wcn_band_2ghz = { | ||
5044 | .cap = IEEE80211_HT_CAP_GRN_FLD | | ||
5045 | IEEE80211_HT_CAP_SGI_20 | | ||
5046 | IEEE80211_HT_CAP_DSSSCCK40 | | ||
5047 | - IEEE80211_HT_CAP_LSIG_TXOP_PROT, | ||
5048 | + IEEE80211_HT_CAP_LSIG_TXOP_PROT | | ||
5049 | + IEEE80211_HT_CAP_SGI_40 | | ||
5050 | + IEEE80211_HT_CAP_SUP_WIDTH_20_40, | ||
5051 | .ht_supported = true, | ||
5052 | .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, | ||
5053 | .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, | ||
5054 | diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c | ||
5055 | index 523550f94a3f0..a7532028bf9db 100644 | ||
5056 | --- a/drivers/net/wireless/ath/wcn36xx/smd.c | ||
5057 | +++ b/drivers/net/wireless/ath/wcn36xx/smd.c | ||
5058 | @@ -2340,30 +2340,52 @@ static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn, | ||
5059 | size_t len) | ||
5060 | { | ||
5061 | struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf; | ||
5062 | - struct wcn36xx_vif *tmp; | ||
5063 | + struct wcn36xx_vif *vif_priv; | ||
5064 | + struct ieee80211_vif *vif; | ||
5065 | + struct ieee80211_bss_conf *bss_conf; | ||
5066 | struct ieee80211_sta *sta; | ||
5067 | + bool found = false; | ||
5068 | |||
5069 | if (len != sizeof(*rsp)) { | ||
5070 | wcn36xx_warn("Corrupted delete sta indication\n"); | ||
5071 | return -EIO; | ||
5072 | } | ||
5073 | |||
5074 | - wcn36xx_dbg(WCN36XX_DBG_HAL, "delete station indication %pM index %d\n", | ||
5075 | - rsp->addr2, rsp->sta_id); | ||
5076 | + wcn36xx_dbg(WCN36XX_DBG_HAL, | ||
5077 | + "delete station indication %pM index %d reason %d\n", | ||
5078 | + rsp->addr2, rsp->sta_id, rsp->reason_code); | ||
5079 | |||
5080 | - list_for_each_entry(tmp, &wcn->vif_list, list) { | ||
5081 | + list_for_each_entry(vif_priv, &wcn->vif_list, list) { | ||
5082 | rcu_read_lock(); | ||
5083 | - sta = ieee80211_find_sta(wcn36xx_priv_to_vif(tmp), rsp->addr2); | ||
5084 | - if (sta) | ||
5085 | - ieee80211_report_low_ack(sta, 0); | ||
5086 | + vif = wcn36xx_priv_to_vif(vif_priv); | ||
5087 | + | ||
5088 | + if (vif->type == NL80211_IFTYPE_STATION) { | ||
5089 | + /* We could call ieee80211_find_sta too, but checking | ||
5090 | + * bss_conf is clearer. | ||
5091 | + */ | ||
5092 | + bss_conf = &vif->bss_conf; | ||
5093 | + if (vif_priv->sta_assoc && | ||
5094 | + !memcmp(bss_conf->bssid, rsp->addr2, ETH_ALEN)) { | ||
5095 | + found = true; | ||
5096 | + wcn36xx_dbg(WCN36XX_DBG_HAL, | ||
5097 | + "connection loss bss_index %d\n", | ||
5098 | + vif_priv->bss_index); | ||
5099 | + ieee80211_connection_loss(vif); | ||
5100 | + } | ||
5101 | + } else { | ||
5102 | + sta = ieee80211_find_sta(vif, rsp->addr2); | ||
5103 | + if (sta) { | ||
5104 | + found = true; | ||
5105 | + ieee80211_report_low_ack(sta, 0); | ||
5106 | + } | ||
5107 | + } | ||
5108 | + | ||
5109 | rcu_read_unlock(); | ||
5110 | - if (sta) | ||
5111 | + if (found) | ||
5112 | return 0; | ||
5113 | } | ||
5114 | |||
5115 | - wcn36xx_warn("STA with addr %pM and index %d not found\n", | ||
5116 | - rsp->addr2, | ||
5117 | - rsp->sta_id); | ||
5118 | + wcn36xx_warn("BSS or STA with addr %pM not found\n", rsp->addr2); | ||
5119 | return -ENOENT; | ||
5120 | } | ||
5121 | |||
5122 | diff --git a/drivers/net/wireless/broadcom/b43/phy_g.c b/drivers/net/wireless/broadcom/b43/phy_g.c | ||
5123 | index 1e022ec733a37..8b8fdb4965bde 100644 | ||
5124 | --- a/drivers/net/wireless/broadcom/b43/phy_g.c | ||
5125 | +++ b/drivers/net/wireless/broadcom/b43/phy_g.c | ||
5126 | @@ -2297,7 +2297,7 @@ static u8 b43_gphy_aci_scan(struct b43_wldev *dev) | ||
5127 | b43_phy_mask(dev, B43_PHY_G_CRS, 0x7FFF); | ||
5128 | b43_set_all_gains(dev, 3, 8, 1); | ||
5129 | |||
5130 | - start = (channel - 5 > 0) ? channel - 5 : 1; | ||
5131 | + start = (channel > 5) ? channel - 5 : 1; | ||
5132 | end = (channel + 5 < 14) ? channel + 5 : 13; | ||
5133 | |||
5134 | for (i = start; i <= end; i++) { | ||
5135 | diff --git a/drivers/net/wireless/broadcom/b43legacy/radio.c b/drivers/net/wireless/broadcom/b43legacy/radio.c | ||
5136 | index da40d1ca8723d..e4dce76a4481d 100644 | ||
5137 | --- a/drivers/net/wireless/broadcom/b43legacy/radio.c | ||
5138 | +++ b/drivers/net/wireless/broadcom/b43legacy/radio.c | ||
5139 | @@ -283,7 +283,7 @@ u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *dev) | ||
5140 | & 0x7FFF); | ||
5141 | b43legacy_set_all_gains(dev, 3, 8, 1); | ||
5142 | |||
5143 | - start = (channel - 5 > 0) ? channel - 5 : 1; | ||
5144 | + start = (channel > 5) ? channel - 5 : 1; | ||
5145 | end = (channel + 5 < 14) ? channel + 5 : 13; | ||
5146 | |||
5147 | for (i = start; i <= end; i++) { | ||
5148 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c | ||
5149 | index 6d5188b78f2de..0af452dca7664 100644 | ||
5150 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c | ||
5151 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c | ||
5152 | @@ -75,6 +75,16 @@ static const struct dmi_system_id dmi_platform_data[] = { | ||
5153 | }, | ||
5154 | .driver_data = (void *)&acepc_t8_data, | ||
5155 | }, | ||
5156 | + { | ||
5157 | + /* Cyberbook T116 rugged tablet */ | ||
5158 | + .matches = { | ||
5159 | + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"), | ||
5160 | + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), | ||
5161 | + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"), | ||
5162 | + }, | ||
5163 | + /* The factory image nvram file is identical to the ACEPC T8 one */ | ||
5164 | + .driver_data = (void *)&acepc_t8_data, | ||
5165 | + }, | ||
5166 | { | ||
5167 | /* Match for the GPDwin which unfortunately uses somewhat | ||
5168 | * generic dmi strings, which is why we test for 4 strings. | ||
5169 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c | ||
5170 | index 8686107da1168..a637d7fb4b261 100644 | ||
5171 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c | ||
5172 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c | ||
5173 | @@ -758,6 +758,9 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm) | ||
5174 | |||
5175 | lockdep_assert_held(&mvm->mutex); | ||
5176 | |||
5177 | + if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) | ||
5178 | + return false; | ||
5179 | + | ||
5180 | if (num_of_ant(iwl_mvm_get_valid_rx_ant(mvm)) == 1) | ||
5181 | return false; | ||
5182 | |||
5183 | diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c | ||
5184 | index 20436a289d5cd..5d6dc1dd050d4 100644 | ||
5185 | --- a/drivers/net/wireless/marvell/libertas/if_usb.c | ||
5186 | +++ b/drivers/net/wireless/marvell/libertas/if_usb.c | ||
5187 | @@ -292,6 +292,7 @@ err_add_card: | ||
5188 | if_usb_reset_device(cardp); | ||
5189 | dealloc: | ||
5190 | if_usb_free(cardp); | ||
5191 | + kfree(cardp); | ||
5192 | |||
5193 | error: | ||
5194 | return r; | ||
5195 | @@ -316,6 +317,7 @@ static void if_usb_disconnect(struct usb_interface *intf) | ||
5196 | |||
5197 | /* Unlink and free urb */ | ||
5198 | if_usb_free(cardp); | ||
5199 | + kfree(cardp); | ||
5200 | |||
5201 | usb_set_intfdata(intf, NULL); | ||
5202 | usb_put_dev(interface_to_usbdev(intf)); | ||
5203 | diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c | ||
5204 | index bedc092150884..b30bcb28503ae 100644 | ||
5205 | --- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c | ||
5206 | +++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c | ||
5207 | @@ -230,6 +230,7 @@ static int if_usb_probe(struct usb_interface *intf, | ||
5208 | |||
5209 | dealloc: | ||
5210 | if_usb_free(cardp); | ||
5211 | + kfree(cardp); | ||
5212 | error: | ||
5213 | lbtf_deb_leave(LBTF_DEB_MAIN); | ||
5214 | return -ENOMEM; | ||
5215 | @@ -254,6 +255,7 @@ static void if_usb_disconnect(struct usb_interface *intf) | ||
5216 | |||
5217 | /* Unlink and free urb */ | ||
5218 | if_usb_free(cardp); | ||
5219 | + kfree(cardp); | ||
5220 | |||
5221 | usb_set_intfdata(intf, NULL); | ||
5222 | usb_put_dev(interface_to_usbdev(intf)); | ||
5223 | diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c | ||
5224 | index e435f801bc912..acbef9f1a83b6 100644 | ||
5225 | --- a/drivers/net/wireless/marvell/mwifiex/11n.c | ||
5226 | +++ b/drivers/net/wireless/marvell/mwifiex/11n.c | ||
5227 | @@ -657,14 +657,15 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac, | ||
5228 | uint16_t del_ba_param_set; | ||
5229 | |||
5230 | memset(&delba, 0, sizeof(delba)); | ||
5231 | - delba.del_ba_param_set = cpu_to_le16(tid << DELBA_TID_POS); | ||
5232 | |||
5233 | - del_ba_param_set = le16_to_cpu(delba.del_ba_param_set); | ||
5234 | + del_ba_param_set = tid << DELBA_TID_POS; | ||
5235 | + | ||
5236 | if (initiator) | ||
5237 | del_ba_param_set |= IEEE80211_DELBA_PARAM_INITIATOR_MASK; | ||
5238 | else | ||
5239 | del_ba_param_set &= ~IEEE80211_DELBA_PARAM_INITIATOR_MASK; | ||
5240 | |||
5241 | + delba.del_ba_param_set = cpu_to_le16(del_ba_param_set); | ||
5242 | memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN); | ||
5243 | |||
5244 | /* We don't wait for the response of this command */ | ||
5245 | diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | ||
5246 | index 9e6dc289ec3e8..1599ae74b066b 100644 | ||
5247 | --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c | ||
5248 | +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | ||
5249 | @@ -912,16 +912,20 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv, | ||
5250 | switch (type) { | ||
5251 | case NL80211_IFTYPE_STATION: | ||
5252 | case NL80211_IFTYPE_ADHOC: | ||
5253 | - priv->bss_role = MWIFIEX_BSS_ROLE_STA; | ||
5254 | + priv->bss_role = MWIFIEX_BSS_ROLE_STA; | ||
5255 | + priv->bss_type = MWIFIEX_BSS_TYPE_STA; | ||
5256 | break; | ||
5257 | case NL80211_IFTYPE_P2P_CLIENT: | ||
5258 | - priv->bss_role = MWIFIEX_BSS_ROLE_STA; | ||
5259 | + priv->bss_role = MWIFIEX_BSS_ROLE_STA; | ||
5260 | + priv->bss_type = MWIFIEX_BSS_TYPE_P2P; | ||
5261 | break; | ||
5262 | case NL80211_IFTYPE_P2P_GO: | ||
5263 | - priv->bss_role = MWIFIEX_BSS_ROLE_UAP; | ||
5264 | + priv->bss_role = MWIFIEX_BSS_ROLE_UAP; | ||
5265 | + priv->bss_type = MWIFIEX_BSS_TYPE_P2P; | ||
5266 | break; | ||
5267 | case NL80211_IFTYPE_AP: | ||
5268 | priv->bss_role = MWIFIEX_BSS_ROLE_UAP; | ||
5269 | + priv->bss_type = MWIFIEX_BSS_TYPE_UAP; | ||
5270 | break; | ||
5271 | default: | ||
5272 | mwifiex_dbg(adapter, ERROR, | ||
5273 | @@ -1233,29 +1237,15 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, | ||
5274 | break; | ||
5275 | case NL80211_IFTYPE_P2P_CLIENT: | ||
5276 | case NL80211_IFTYPE_P2P_GO: | ||
5277 | + if (mwifiex_cfg80211_deinit_p2p(priv)) | ||
5278 | + return -EFAULT; | ||
5279 | + | ||
5280 | switch (type) { | ||
5281 | - case NL80211_IFTYPE_STATION: | ||
5282 | - if (mwifiex_cfg80211_deinit_p2p(priv)) | ||
5283 | - return -EFAULT; | ||
5284 | - priv->adapter->curr_iface_comb.p2p_intf--; | ||
5285 | - priv->adapter->curr_iface_comb.sta_intf++; | ||
5286 | - dev->ieee80211_ptr->iftype = type; | ||
5287 | - if (mwifiex_deinit_priv_params(priv)) | ||
5288 | - return -1; | ||
5289 | - if (mwifiex_init_new_priv_params(priv, dev, type)) | ||
5290 | - return -1; | ||
5291 | - if (mwifiex_sta_init_cmd(priv, false, false)) | ||
5292 | - return -1; | ||
5293 | - break; | ||
5294 | case NL80211_IFTYPE_ADHOC: | ||
5295 | - if (mwifiex_cfg80211_deinit_p2p(priv)) | ||
5296 | - return -EFAULT; | ||
5297 | + case NL80211_IFTYPE_STATION: | ||
5298 | return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype, | ||
5299 | type, params); | ||
5300 | - break; | ||
5301 | case NL80211_IFTYPE_AP: | ||
5302 | - if (mwifiex_cfg80211_deinit_p2p(priv)) | ||
5303 | - return -EFAULT; | ||
5304 | return mwifiex_change_vif_to_ap(dev, curr_iftype, type, | ||
5305 | params); | ||
5306 | case NL80211_IFTYPE_UNSPECIFIED: | ||
5307 | diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c | ||
5308 | index bc46a0aa06eb7..b316e34917958 100644 | ||
5309 | --- a/drivers/net/wireless/marvell/mwifiex/pcie.c | ||
5310 | +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c | ||
5311 | @@ -1326,6 +1326,14 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb, | ||
5312 | ret = -1; | ||
5313 | goto done_unmap; | ||
5314 | } | ||
5315 | + | ||
5316 | + /* The firmware (latest version 15.68.19.p21) of the 88W8897 PCIe+USB card | ||
5317 | + * seems to crash randomly after setting the TX ring write pointer when | ||
5318 | + * ASPM powersaving is enabled. A workaround seems to be keeping the bus | ||
5319 | + * busy by reading a random register afterwards. | ||
5320 | + */ | ||
5321 | + mwifiex_read_reg(adapter, PCI_VENDOR_ID, &rx_val); | ||
5322 | + | ||
5323 | if ((mwifiex_pcie_txbd_not_full(card)) && | ||
5324 | tx_param->next_pkt_len) { | ||
5325 | /* have more packets and TxBD still can hold more */ | ||
5326 | diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c | ||
5327 | index 528107d70c1cb..cb8a9ad40cfe9 100644 | ||
5328 | --- a/drivers/net/wireless/marvell/mwifiex/usb.c | ||
5329 | +++ b/drivers/net/wireless/marvell/mwifiex/usb.c | ||
5330 | @@ -505,6 +505,22 @@ static int mwifiex_usb_probe(struct usb_interface *intf, | ||
5331 | } | ||
5332 | } | ||
5333 | |||
5334 | + switch (card->usb_boot_state) { | ||
5335 | + case USB8XXX_FW_DNLD: | ||
5336 | + /* Reject broken descriptors. */ | ||
5337 | + if (!card->rx_cmd_ep || !card->tx_cmd_ep) | ||
5338 | + return -ENODEV; | ||
5339 | + if (card->bulk_out_maxpktsize == 0) | ||
5340 | + return -ENODEV; | ||
5341 | + break; | ||
5342 | + case USB8XXX_FW_READY: | ||
5343 | + /* Assume the driver can handle missing endpoints for now. */ | ||
5344 | + break; | ||
5345 | + default: | ||
5346 | + WARN_ON(1); | ||
5347 | + return -ENODEV; | ||
5348 | + } | ||
5349 | + | ||
5350 | usb_set_intfdata(intf, card); | ||
5351 | |||
5352 | ret = mwifiex_add_card(card, &card->fw_done, &usb_ops, | ||
5353 | diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c | ||
5354 | index 1b76b24191866..14ac2384218df 100644 | ||
5355 | --- a/drivers/net/wireless/marvell/mwl8k.c | ||
5356 | +++ b/drivers/net/wireless/marvell/mwl8k.c | ||
5357 | @@ -5796,8 +5796,8 @@ static void mwl8k_fw_state_machine(const struct firmware *fw, void *context) | ||
5358 | fail: | ||
5359 | priv->fw_state = FW_STATE_ERROR; | ||
5360 | complete(&priv->firmware_loading_complete); | ||
5361 | - device_release_driver(&priv->pdev->dev); | ||
5362 | mwl8k_release_firmware(priv); | ||
5363 | + device_release_driver(&priv->pdev->dev); | ||
5364 | } | ||
5365 | |||
5366 | #define MAX_RESTART_ATTEMPTS 1 | ||
5367 | diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | ||
5368 | index abacb4ea7179d..5c12cd7fce940 100644 | ||
5369 | --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | ||
5370 | +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | ||
5371 | @@ -154,7 +154,7 @@ void mt76x02_mac_wcid_set_drop(struct mt76x02_dev *dev, u8 idx, bool drop) | ||
5372 | mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop)); | ||
5373 | } | ||
5374 | |||
5375 | -static __le16 | ||
5376 | +static u16 | ||
5377 | mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev, | ||
5378 | const struct ieee80211_tx_rate *rate, u8 *nss_val) | ||
5379 | { | ||
5380 | @@ -200,14 +200,14 @@ mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev, | ||
5381 | rateval |= MT_RXWI_RATE_SGI; | ||
5382 | |||
5383 | *nss_val = nss; | ||
5384 | - return cpu_to_le16(rateval); | ||
5385 | + return rateval; | ||
5386 | } | ||
5387 | |||
5388 | void mt76x02_mac_wcid_set_rate(struct mt76x02_dev *dev, struct mt76_wcid *wcid, | ||
5389 | const struct ieee80211_tx_rate *rate) | ||
5390 | { | ||
5391 | s8 max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate); | ||
5392 | - __le16 rateval; | ||
5393 | + u16 rateval; | ||
5394 | u32 tx_info; | ||
5395 | s8 nss; | ||
5396 | |||
5397 | @@ -320,7 +320,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, | ||
5398 | struct ieee80211_key_conf *key = info->control.hw_key; | ||
5399 | u32 wcid_tx_info; | ||
5400 | u16 rate_ht_mask = FIELD_PREP(MT_RXWI_RATE_PHY, BIT(1) | BIT(2)); | ||
5401 | - u16 txwi_flags = 0; | ||
5402 | + u16 txwi_flags = 0, rateval; | ||
5403 | u8 nss; | ||
5404 | s8 txpwr_adj, max_txpwr_adj; | ||
5405 | u8 ccmp_pn[8], nstreams = dev->mt76.chainmask & 0xf; | ||
5406 | @@ -356,14 +356,15 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, | ||
5407 | |||
5408 | if (wcid && (rate->idx < 0 || !rate->count)) { | ||
5409 | wcid_tx_info = wcid->tx_info; | ||
5410 | - txwi->rate = FIELD_GET(MT_WCID_TX_INFO_RATE, wcid_tx_info); | ||
5411 | + rateval = FIELD_GET(MT_WCID_TX_INFO_RATE, wcid_tx_info); | ||
5412 | max_txpwr_adj = FIELD_GET(MT_WCID_TX_INFO_TXPWR_ADJ, | ||
5413 | wcid_tx_info); | ||
5414 | nss = FIELD_GET(MT_WCID_TX_INFO_NSS, wcid_tx_info); | ||
5415 | } else { | ||
5416 | - txwi->rate = mt76x02_mac_tx_rate_val(dev, rate, &nss); | ||
5417 | + rateval = mt76x02_mac_tx_rate_val(dev, rate, &nss); | ||
5418 | max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate); | ||
5419 | } | ||
5420 | + txwi->rate = cpu_to_le16(rateval); | ||
5421 | |||
5422 | txpwr_adj = mt76x02_tx_get_txpwr_adj(dev, dev->mt76.txpower_conf, | ||
5423 | max_txpwr_adj); | ||
5424 | diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | ||
5425 | index b2616d61b66d8..843e3f41a2bc3 100644 | ||
5426 | --- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | ||
5427 | +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | ||
5428 | @@ -28,7 +28,7 @@ u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv, | ||
5429 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), | ||
5430 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, | ||
5431 | (unsigned long)addr, idx & 0x03, | ||
5432 | - &priv->io_dmabuf->bits8, sizeof(val), HZ / 2); | ||
5433 | + &priv->io_dmabuf->bits8, sizeof(val), 500); | ||
5434 | |||
5435 | val = priv->io_dmabuf->bits8; | ||
5436 | mutex_unlock(&priv->io_mutex); | ||
5437 | @@ -45,7 +45,7 @@ u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv, | ||
5438 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), | ||
5439 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, | ||
5440 | (unsigned long)addr, idx & 0x03, | ||
5441 | - &priv->io_dmabuf->bits16, sizeof(val), HZ / 2); | ||
5442 | + &priv->io_dmabuf->bits16, sizeof(val), 500); | ||
5443 | |||
5444 | val = priv->io_dmabuf->bits16; | ||
5445 | mutex_unlock(&priv->io_mutex); | ||
5446 | @@ -62,7 +62,7 @@ u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv, | ||
5447 | usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), | ||
5448 | RTL8187_REQ_GET_REG, RTL8187_REQT_READ, | ||
5449 | (unsigned long)addr, idx & 0x03, | ||
5450 | - &priv->io_dmabuf->bits32, sizeof(val), HZ / 2); | ||
5451 | + &priv->io_dmabuf->bits32, sizeof(val), 500); | ||
5452 | |||
5453 | val = priv->io_dmabuf->bits32; | ||
5454 | mutex_unlock(&priv->io_mutex); | ||
5455 | @@ -79,7 +79,7 @@ void rtl818x_iowrite8_idx(struct rtl8187_priv *priv, | ||
5456 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), | ||
5457 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, | ||
5458 | (unsigned long)addr, idx & 0x03, | ||
5459 | - &priv->io_dmabuf->bits8, sizeof(val), HZ / 2); | ||
5460 | + &priv->io_dmabuf->bits8, sizeof(val), 500); | ||
5461 | |||
5462 | mutex_unlock(&priv->io_mutex); | ||
5463 | } | ||
5464 | @@ -93,7 +93,7 @@ void rtl818x_iowrite16_idx(struct rtl8187_priv *priv, | ||
5465 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), | ||
5466 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, | ||
5467 | (unsigned long)addr, idx & 0x03, | ||
5468 | - &priv->io_dmabuf->bits16, sizeof(val), HZ / 2); | ||
5469 | + &priv->io_dmabuf->bits16, sizeof(val), 500); | ||
5470 | |||
5471 | mutex_unlock(&priv->io_mutex); | ||
5472 | } | ||
5473 | @@ -107,7 +107,7 @@ void rtl818x_iowrite32_idx(struct rtl8187_priv *priv, | ||
5474 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), | ||
5475 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, | ||
5476 | (unsigned long)addr, idx & 0x03, | ||
5477 | - &priv->io_dmabuf->bits32, sizeof(val), HZ / 2); | ||
5478 | + &priv->io_dmabuf->bits32, sizeof(val), 500); | ||
5479 | |||
5480 | mutex_unlock(&priv->io_mutex); | ||
5481 | } | ||
5482 | @@ -183,7 +183,7 @@ static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data) | ||
5483 | usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), | ||
5484 | RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, | ||
5485 | addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data), | ||
5486 | - HZ / 2); | ||
5487 | + 500); | ||
5488 | |||
5489 | mutex_unlock(&priv->io_mutex); | ||
5490 | |||
5491 | diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c b/drivers/net/wireless/rsi/rsi_91x_core.c | ||
5492 | index 3644d7d994638..c6c29034b2ead 100644 | ||
5493 | --- a/drivers/net/wireless/rsi/rsi_91x_core.c | ||
5494 | +++ b/drivers/net/wireless/rsi/rsi_91x_core.c | ||
5495 | @@ -400,6 +400,8 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb) | ||
5496 | |||
5497 | info = IEEE80211_SKB_CB(skb); | ||
5498 | tx_params = (struct skb_info *)info->driver_data; | ||
5499 | + /* info->driver_data and info->control part of union so make copy */ | ||
5500 | + tx_params->have_key = !!info->control.hw_key; | ||
5501 | wh = (struct ieee80211_hdr *)&skb->data[0]; | ||
5502 | tx_params->sta_id = 0; | ||
5503 | |||
5504 | diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c | ||
5505 | index 5e6c5d13319d5..7d0b44fd56901 100644 | ||
5506 | --- a/drivers/net/wireless/rsi/rsi_91x_hal.c | ||
5507 | +++ b/drivers/net/wireless/rsi/rsi_91x_hal.c | ||
5508 | @@ -203,7 +203,7 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb) | ||
5509 | wh->frame_control |= cpu_to_le16(RSI_SET_PS_ENABLE); | ||
5510 | |||
5511 | if ((!(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) && | ||
5512 | - info->control.hw_key) { | ||
5513 | + tx_params->have_key) { | ||
5514 | if (rsi_is_cipher_wep(common)) | ||
5515 | ieee80211_size += 4; | ||
5516 | else | ||
5517 | @@ -214,15 +214,17 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb) | ||
5518 | RSI_WIFI_DATA_Q); | ||
5519 | data_desc->header_len = ieee80211_size; | ||
5520 | |||
5521 | - if (common->min_rate != RSI_RATE_AUTO) { | ||
5522 | + if (common->rate_config[common->band].fixed_enabled) { | ||
5523 | /* Send fixed rate */ | ||
5524 | + u16 fixed_rate = common->rate_config[common->band].fixed_hw_rate; | ||
5525 | + | ||
5526 | data_desc->frame_info = cpu_to_le16(RATE_INFO_ENABLE); | ||
5527 | - data_desc->rate_info = cpu_to_le16(common->min_rate); | ||
5528 | + data_desc->rate_info = cpu_to_le16(fixed_rate); | ||
5529 | |||
5530 | if (conf_is_ht40(&common->priv->hw->conf)) | ||
5531 | data_desc->bbp_info = cpu_to_le16(FULL40M_ENABLE); | ||
5532 | |||
5533 | - if ((common->vif_info[0].sgi) && (common->min_rate & 0x100)) { | ||
5534 | + if (common->vif_info[0].sgi && (fixed_rate & 0x100)) { | ||
5535 | /* Only MCS rates */ | ||
5536 | data_desc->rate_info |= | ||
5537 | cpu_to_le16(ENABLE_SHORTGI_RATE); | ||
5538 | diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c | ||
5539 | index ca1e609f637e4..1279339a4b59b 100644 | ||
5540 | --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c | ||
5541 | +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c | ||
5542 | @@ -510,7 +510,6 @@ static int rsi_mac80211_add_interface(struct ieee80211_hw *hw, | ||
5543 | if ((vif->type == NL80211_IFTYPE_AP) || | ||
5544 | (vif->type == NL80211_IFTYPE_P2P_GO)) { | ||
5545 | rsi_send_rx_filter_frame(common, DISALLOW_BEACONS); | ||
5546 | - common->min_rate = RSI_RATE_AUTO; | ||
5547 | for (i = 0; i < common->max_stations; i++) | ||
5548 | common->stations[i].sta = NULL; | ||
5549 | } | ||
5550 | @@ -1211,20 +1210,32 @@ static int rsi_mac80211_set_rate_mask(struct ieee80211_hw *hw, | ||
5551 | struct ieee80211_vif *vif, | ||
5552 | const struct cfg80211_bitrate_mask *mask) | ||
5553 | { | ||
5554 | + const unsigned int mcs_offset = ARRAY_SIZE(rsi_rates); | ||
5555 | struct rsi_hw *adapter = hw->priv; | ||
5556 | struct rsi_common *common = adapter->priv; | ||
5557 | - enum nl80211_band band = hw->conf.chandef.chan->band; | ||
5558 | + int i; | ||
5559 | |||
5560 | mutex_lock(&common->mutex); | ||
5561 | - common->fixedrate_mask[band] = 0; | ||
5562 | |||
5563 | - if (mask->control[band].legacy == 0xfff) { | ||
5564 | - common->fixedrate_mask[band] = | ||
5565 | - (mask->control[band].ht_mcs[0] << 12); | ||
5566 | - } else { | ||
5567 | - common->fixedrate_mask[band] = | ||
5568 | - mask->control[band].legacy; | ||
5569 | + for (i = 0; i < ARRAY_SIZE(common->rate_config); i++) { | ||
5570 | + struct rsi_rate_config *cfg = &common->rate_config[i]; | ||
5571 | + u32 bm; | ||
5572 | + | ||
5573 | + bm = mask->control[i].legacy | (mask->control[i].ht_mcs[0] << mcs_offset); | ||
5574 | + if (hweight32(bm) == 1) { /* single rate */ | ||
5575 | + int rate_index = ffs(bm) - 1; | ||
5576 | + | ||
5577 | + if (rate_index < mcs_offset) | ||
5578 | + cfg->fixed_hw_rate = rsi_rates[rate_index].hw_value; | ||
5579 | + else | ||
5580 | + cfg->fixed_hw_rate = rsi_mcsrates[rate_index - mcs_offset]; | ||
5581 | + cfg->fixed_enabled = true; | ||
5582 | + } else { | ||
5583 | + cfg->configured_mask = bm; | ||
5584 | + cfg->fixed_enabled = false; | ||
5585 | + } | ||
5586 | } | ||
5587 | + | ||
5588 | mutex_unlock(&common->mutex); | ||
5589 | |||
5590 | return 0; | ||
5591 | @@ -1360,46 +1371,6 @@ void rsi_indicate_pkt_to_os(struct rsi_common *common, | ||
5592 | ieee80211_rx_irqsafe(hw, skb); | ||
5593 | } | ||
5594 | |||
5595 | -static void rsi_set_min_rate(struct ieee80211_hw *hw, | ||
5596 | - struct ieee80211_sta *sta, | ||
5597 | - struct rsi_common *common) | ||
5598 | -{ | ||
5599 | - u8 band = hw->conf.chandef.chan->band; | ||
5600 | - u8 ii; | ||
5601 | - u32 rate_bitmap; | ||
5602 | - bool matched = false; | ||
5603 | - | ||
5604 | - common->bitrate_mask[band] = sta->supp_rates[band]; | ||
5605 | - | ||
5606 | - rate_bitmap = (common->fixedrate_mask[band] & sta->supp_rates[band]); | ||
5607 | - | ||
5608 | - if (rate_bitmap & 0xfff) { | ||
5609 | - /* Find out the min rate */ | ||
5610 | - for (ii = 0; ii < ARRAY_SIZE(rsi_rates); ii++) { | ||
5611 | - if (rate_bitmap & BIT(ii)) { | ||
5612 | - common->min_rate = rsi_rates[ii].hw_value; | ||
5613 | - matched = true; | ||
5614 | - break; | ||
5615 | - } | ||
5616 | - } | ||
5617 | - } | ||
5618 | - | ||
5619 | - common->vif_info[0].is_ht = sta->ht_cap.ht_supported; | ||
5620 | - | ||
5621 | - if ((common->vif_info[0].is_ht) && (rate_bitmap >> 12)) { | ||
5622 | - for (ii = 0; ii < ARRAY_SIZE(rsi_mcsrates); ii++) { | ||
5623 | - if ((rate_bitmap >> 12) & BIT(ii)) { | ||
5624 | - common->min_rate = rsi_mcsrates[ii]; | ||
5625 | - matched = true; | ||
5626 | - break; | ||
5627 | - } | ||
5628 | - } | ||
5629 | - } | ||
5630 | - | ||
5631 | - if (!matched) | ||
5632 | - common->min_rate = 0xffff; | ||
5633 | -} | ||
5634 | - | ||
5635 | /** | ||
5636 | * rsi_mac80211_sta_add() - This function notifies driver about a peer getting | ||
5637 | * connected. | ||
5638 | @@ -1498,9 +1469,9 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw, | ||
5639 | |||
5640 | if ((vif->type == NL80211_IFTYPE_STATION) || | ||
5641 | (vif->type == NL80211_IFTYPE_P2P_CLIENT)) { | ||
5642 | - rsi_set_min_rate(hw, sta, common); | ||
5643 | + common->bitrate_mask[common->band] = sta->supp_rates[common->band]; | ||
5644 | + common->vif_info[0].is_ht = sta->ht_cap.ht_supported; | ||
5645 | if (sta->ht_cap.ht_supported) { | ||
5646 | - common->vif_info[0].is_ht = true; | ||
5647 | common->bitrate_mask[NL80211_BAND_2GHZ] = | ||
5648 | sta->supp_rates[NL80211_BAND_2GHZ]; | ||
5649 | if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) || | ||
5650 | @@ -1574,7 +1545,6 @@ static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw, | ||
5651 | bss->qos = sta->wme; | ||
5652 | common->bitrate_mask[NL80211_BAND_2GHZ] = 0; | ||
5653 | common->bitrate_mask[NL80211_BAND_5GHZ] = 0; | ||
5654 | - common->min_rate = 0xffff; | ||
5655 | common->vif_info[0].is_ht = false; | ||
5656 | common->vif_info[0].sgi = false; | ||
5657 | common->vif_info[0].seq_start = 0; | ||
5658 | diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c | ||
5659 | index 29d83049c5f56..441fda71f6289 100644 | ||
5660 | --- a/drivers/net/wireless/rsi/rsi_91x_main.c | ||
5661 | +++ b/drivers/net/wireless/rsi/rsi_91x_main.c | ||
5662 | @@ -210,9 +210,10 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len) | ||
5663 | bt_pkt_type = frame_desc[offset + BT_RX_PKT_TYPE_OFST]; | ||
5664 | if (bt_pkt_type == BT_CARD_READY_IND) { | ||
5665 | rsi_dbg(INFO_ZONE, "BT Card ready recvd\n"); | ||
5666 | - if (rsi_bt_ops.attach(common, &g_proto_ops)) | ||
5667 | - rsi_dbg(ERR_ZONE, | ||
5668 | - "Failed to attach BT module\n"); | ||
5669 | + if (common->fsm_state == FSM_MAC_INIT_DONE) | ||
5670 | + rsi_attach_bt(common); | ||
5671 | + else | ||
5672 | + common->bt_defer_attach = true; | ||
5673 | } else { | ||
5674 | if (common->bt_adapter) | ||
5675 | rsi_bt_ops.recv_pkt(common->bt_adapter, | ||
5676 | @@ -277,6 +278,15 @@ void rsi_set_bt_context(void *priv, void *bt_context) | ||
5677 | } | ||
5678 | #endif | ||
5679 | |||
5680 | +void rsi_attach_bt(struct rsi_common *common) | ||
5681 | +{ | ||
5682 | +#ifdef CONFIG_RSI_COEX | ||
5683 | + if (rsi_bt_ops.attach(common, &g_proto_ops)) | ||
5684 | + rsi_dbg(ERR_ZONE, | ||
5685 | + "Failed to attach BT module\n"); | ||
5686 | +#endif | ||
5687 | +} | ||
5688 | + | ||
5689 | /** | ||
5690 | * rsi_91x_init() - This function initializes os interface operations. | ||
5691 | * @void: Void. | ||
5692 | @@ -358,6 +368,7 @@ struct rsi_hw *rsi_91x_init(u16 oper_mode) | ||
5693 | if (common->coex_mode > 1) { | ||
5694 | if (rsi_coex_attach(common)) { | ||
5695 | rsi_dbg(ERR_ZONE, "Failed to init coex module\n"); | ||
5696 | + rsi_kill_thread(&common->tx_thread); | ||
5697 | goto err; | ||
5698 | } | ||
5699 | } | ||
5700 | diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c | ||
5701 | index ed67f65986775..0c0e4c08be8aa 100644 | ||
5702 | --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c | ||
5703 | +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c | ||
5704 | @@ -276,7 +276,7 @@ static void rsi_set_default_parameters(struct rsi_common *common) | ||
5705 | common->channel_width = BW_20MHZ; | ||
5706 | common->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; | ||
5707 | common->channel = 1; | ||
5708 | - common->min_rate = 0xffff; | ||
5709 | + memset(&common->rate_config, 0, sizeof(common->rate_config)); | ||
5710 | common->fsm_state = FSM_CARD_NOT_READY; | ||
5711 | common->iface_down = true; | ||
5712 | common->endpoint = EP_2GHZ_20MHZ; | ||
5713 | @@ -1304,7 +1304,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common, | ||
5714 | u8 band = hw->conf.chandef.chan->band; | ||
5715 | u8 num_supported_rates = 0; | ||
5716 | u8 rate_table_offset, rate_offset = 0; | ||
5717 | - u32 rate_bitmap; | ||
5718 | + u32 rate_bitmap, configured_rates; | ||
5719 | u16 *selected_rates, min_rate; | ||
5720 | bool is_ht = false, is_sgi = false; | ||
5721 | u16 frame_len = sizeof(struct rsi_auto_rate); | ||
5722 | @@ -1354,6 +1354,10 @@ static int rsi_send_auto_rate_request(struct rsi_common *common, | ||
5723 | is_sgi = true; | ||
5724 | } | ||
5725 | |||
5726 | + /* Limit to any rates administratively configured by cfg80211 */ | ||
5727 | + configured_rates = common->rate_config[band].configured_mask ?: 0xffffffff; | ||
5728 | + rate_bitmap &= configured_rates; | ||
5729 | + | ||
5730 | if (band == NL80211_BAND_2GHZ) { | ||
5731 | if ((rate_bitmap == 0) && (is_ht)) | ||
5732 | min_rate = RSI_RATE_MCS0; | ||
5733 | @@ -1379,10 +1383,13 @@ static int rsi_send_auto_rate_request(struct rsi_common *common, | ||
5734 | num_supported_rates = jj; | ||
5735 | |||
5736 | if (is_ht) { | ||
5737 | - for (ii = 0; ii < ARRAY_SIZE(mcs); ii++) | ||
5738 | - selected_rates[jj++] = mcs[ii]; | ||
5739 | - num_supported_rates += ARRAY_SIZE(mcs); | ||
5740 | - rate_offset += ARRAY_SIZE(mcs); | ||
5741 | + for (ii = 0; ii < ARRAY_SIZE(mcs); ii++) { | ||
5742 | + if (configured_rates & BIT(ii + ARRAY_SIZE(rsi_rates))) { | ||
5743 | + selected_rates[jj++] = mcs[ii]; | ||
5744 | + num_supported_rates++; | ||
5745 | + rate_offset++; | ||
5746 | + } | ||
5747 | + } | ||
5748 | } | ||
5749 | |||
5750 | sort(selected_rates, jj, sizeof(u16), &rsi_compare, NULL); | ||
5751 | @@ -1467,7 +1474,7 @@ void rsi_inform_bss_status(struct rsi_common *common, | ||
5752 | qos_enable, | ||
5753 | aid, sta_id, | ||
5754 | vif); | ||
5755 | - if (common->min_rate == 0xffff) | ||
5756 | + if (!common->rate_config[common->band].fixed_enabled) | ||
5757 | rsi_send_auto_rate_request(common, sta, sta_id, vif); | ||
5758 | if (opmode == RSI_OPMODE_STA && | ||
5759 | !(assoc_cap & WLAN_CAPABILITY_PRIVACY) && | ||
5760 | @@ -2056,6 +2063,9 @@ static int rsi_handle_ta_confirm_type(struct rsi_common *common, | ||
5761 | if (common->reinit_hw) { | ||
5762 | complete(&common->wlan_init_completion); | ||
5763 | } else { | ||
5764 | + if (common->bt_defer_attach) | ||
5765 | + rsi_attach_bt(common); | ||
5766 | + | ||
5767 | return rsi_mac80211_attach(common); | ||
5768 | } | ||
5769 | } | ||
5770 | diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c | ||
5771 | index d51ec7104fb7c..4fe837090cdae 100644 | ||
5772 | --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c | ||
5773 | +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c | ||
5774 | @@ -24,10 +24,7 @@ | ||
5775 | /* Default operating mode is wlan STA + BT */ | ||
5776 | static u16 dev_oper_mode = DEV_OPMODE_STA_BT_DUAL; | ||
5777 | module_param(dev_oper_mode, ushort, 0444); | ||
5778 | -MODULE_PARM_DESC(dev_oper_mode, | ||
5779 | - "1[Wi-Fi], 4[BT], 8[BT LE], 5[Wi-Fi STA + BT classic]\n" | ||
5780 | - "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" | ||
5781 | - "6[AP + BT classic], 14[AP + BT classic + BT LE]"); | ||
5782 | +MODULE_PARM_DESC(dev_oper_mode, DEV_OPMODE_PARAM_DESC); | ||
5783 | |||
5784 | /** | ||
5785 | * rsi_sdio_set_cmd52_arg() - This function prepares cmd 52 read/write arg. | ||
5786 | diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c | ||
5787 | index 1e5a2a0cc6700..68ce3d2bc5357 100644 | ||
5788 | --- a/drivers/net/wireless/rsi/rsi_91x_usb.c | ||
5789 | +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c | ||
5790 | @@ -25,10 +25,7 @@ | ||
5791 | /* Default operating mode is wlan STA + BT */ | ||
5792 | static u16 dev_oper_mode = DEV_OPMODE_STA_BT_DUAL; | ||
5793 | module_param(dev_oper_mode, ushort, 0444); | ||
5794 | -MODULE_PARM_DESC(dev_oper_mode, | ||
5795 | - "1[Wi-Fi], 4[BT], 8[BT LE], 5[Wi-Fi STA + BT classic]\n" | ||
5796 | - "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" | ||
5797 | - "6[AP + BT classic], 14[AP + BT classic + BT LE]"); | ||
5798 | +MODULE_PARM_DESC(dev_oper_mode, DEV_OPMODE_PARAM_DESC); | ||
5799 | |||
5800 | static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t flags); | ||
5801 | |||
5802 | diff --git a/drivers/net/wireless/rsi/rsi_hal.h b/drivers/net/wireless/rsi/rsi_hal.h | ||
5803 | index 46e36df9e8e3c..a2fbec1cec4c3 100644 | ||
5804 | --- a/drivers/net/wireless/rsi/rsi_hal.h | ||
5805 | +++ b/drivers/net/wireless/rsi/rsi_hal.h | ||
5806 | @@ -28,6 +28,17 @@ | ||
5807 | #define DEV_OPMODE_AP_BT 6 | ||
5808 | #define DEV_OPMODE_AP_BT_DUAL 14 | ||
5809 | |||
5810 | +#define DEV_OPMODE_PARAM_DESC \ | ||
5811 | + __stringify(DEV_OPMODE_WIFI_ALONE) "[Wi-Fi alone], " \ | ||
5812 | + __stringify(DEV_OPMODE_BT_ALONE) "[BT classic alone], " \ | ||
5813 | + __stringify(DEV_OPMODE_BT_LE_ALONE) "[BT LE alone], " \ | ||
5814 | + __stringify(DEV_OPMODE_BT_DUAL) "[BT classic + BT LE alone], " \ | ||
5815 | + __stringify(DEV_OPMODE_STA_BT) "[Wi-Fi STA + BT classic], " \ | ||
5816 | + __stringify(DEV_OPMODE_STA_BT_LE) "[Wi-Fi STA + BT LE], " \ | ||
5817 | + __stringify(DEV_OPMODE_STA_BT_DUAL) "[Wi-Fi STA + BT classic + BT LE], " \ | ||
5818 | + __stringify(DEV_OPMODE_AP_BT) "[Wi-Fi AP + BT classic], " \ | ||
5819 | + __stringify(DEV_OPMODE_AP_BT_DUAL) "[Wi-Fi AP + BT classic + BT LE]" | ||
5820 | + | ||
5821 | #define FLASH_WRITE_CHUNK_SIZE (4 * 1024) | ||
5822 | #define FLASH_SECTOR_SIZE (4 * 1024) | ||
5823 | |||
5824 | diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h | ||
5825 | index b3e25bc28682c..de595025c0197 100644 | ||
5826 | --- a/drivers/net/wireless/rsi/rsi_main.h | ||
5827 | +++ b/drivers/net/wireless/rsi/rsi_main.h | ||
5828 | @@ -61,6 +61,7 @@ enum RSI_FSM_STATES { | ||
5829 | extern u32 rsi_zone_enabled; | ||
5830 | extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...); | ||
5831 | |||
5832 | +#define RSI_MAX_BANDS 2 | ||
5833 | #define RSI_MAX_VIFS 3 | ||
5834 | #define NUM_EDCA_QUEUES 4 | ||
5835 | #define IEEE80211_ADDR_LEN 6 | ||
5836 | @@ -139,6 +140,7 @@ struct skb_info { | ||
5837 | u8 internal_hdr_size; | ||
5838 | struct ieee80211_vif *vif; | ||
5839 | u8 vap_id; | ||
5840 | + bool have_key; | ||
5841 | }; | ||
5842 | |||
5843 | enum edca_queue { | ||
5844 | @@ -229,6 +231,12 @@ struct rsi_9116_features { | ||
5845 | u32 ps_options; | ||
5846 | }; | ||
5847 | |||
5848 | +struct rsi_rate_config { | ||
5849 | + u32 configured_mask; /* configured by mac80211 bits 0-11=legacy 12+ mcs */ | ||
5850 | + u16 fixed_hw_rate; | ||
5851 | + bool fixed_enabled; | ||
5852 | +}; | ||
5853 | + | ||
5854 | struct rsi_common { | ||
5855 | struct rsi_hw *priv; | ||
5856 | struct vif_priv vif_info[RSI_MAX_VIFS]; | ||
5857 | @@ -254,8 +262,8 @@ struct rsi_common { | ||
5858 | u8 channel_width; | ||
5859 | |||
5860 | u16 rts_threshold; | ||
5861 | - u16 bitrate_mask[2]; | ||
5862 | - u32 fixedrate_mask[2]; | ||
5863 | + u32 bitrate_mask[RSI_MAX_BANDS]; | ||
5864 | + struct rsi_rate_config rate_config[RSI_MAX_BANDS]; | ||
5865 | |||
5866 | u8 rf_reset; | ||
5867 | struct transmit_q_stats tx_stats; | ||
5868 | @@ -276,7 +284,6 @@ struct rsi_common { | ||
5869 | u8 mac_id; | ||
5870 | u8 radio_id; | ||
5871 | u16 rate_pwr[20]; | ||
5872 | - u16 min_rate; | ||
5873 | |||
5874 | /* WMM algo related */ | ||
5875 | u8 selected_qnum; | ||
5876 | @@ -320,6 +327,7 @@ struct rsi_common { | ||
5877 | struct ieee80211_vif *roc_vif; | ||
5878 | |||
5879 | bool eapol4_confirm; | ||
5880 | + bool bt_defer_attach; | ||
5881 | void *bt_adapter; | ||
5882 | |||
5883 | struct cfg80211_scan_request *hwscan; | ||
5884 | @@ -401,5 +409,6 @@ struct rsi_host_intf_ops { | ||
5885 | |||
5886 | enum rsi_host_intf rsi_get_host_intf(void *priv); | ||
5887 | void rsi_set_bt_context(void *priv, void *bt_context); | ||
5888 | +void rsi_attach_bt(struct rsi_common *common); | ||
5889 | |||
5890 | #endif | ||
5891 | diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c | ||
5892 | index 88280057e0321..7d389c2cc9026 100644 | ||
5893 | --- a/drivers/net/xen-netfront.c | ||
5894 | +++ b/drivers/net/xen-netfront.c | ||
5895 | @@ -1439,6 +1439,10 @@ static int netfront_resume(struct xenbus_device *dev) | ||
5896 | |||
5897 | dev_dbg(&dev->dev, "%s\n", dev->nodename); | ||
5898 | |||
5899 | + netif_tx_lock_bh(info->netdev); | ||
5900 | + netif_device_detach(info->netdev); | ||
5901 | + netif_tx_unlock_bh(info->netdev); | ||
5902 | + | ||
5903 | xennet_disconnect_backend(info); | ||
5904 | return 0; | ||
5905 | } | ||
5906 | @@ -1987,6 +1991,10 @@ static int xennet_connect(struct net_device *dev) | ||
5907 | * domain a kick because we've probably just requeued some | ||
5908 | * packets. | ||
5909 | */ | ||
5910 | + netif_tx_lock_bh(np->netdev); | ||
5911 | + netif_device_attach(np->netdev); | ||
5912 | + netif_tx_unlock_bh(np->netdev); | ||
5913 | + | ||
5914 | netif_carrier_on(np->netdev); | ||
5915 | for (j = 0; j < num_queues; ++j) { | ||
5916 | queue = &np->queues[j]; | ||
5917 | diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c | ||
5918 | index 3ea38ce86cc9f..807b7b37d9dce 100644 | ||
5919 | --- a/drivers/nfc/pn533/pn533.c | ||
5920 | +++ b/drivers/nfc/pn533/pn533.c | ||
5921 | @@ -2072,7 +2072,7 @@ static int pn533_fill_fragment_skbs(struct pn533 *dev, struct sk_buff *skb) | ||
5922 | frag = pn533_alloc_skb(dev, frag_size); | ||
5923 | if (!frag) { | ||
5924 | skb_queue_purge(&dev->fragment_skb); | ||
5925 | - break; | ||
5926 | + return -ENOMEM; | ||
5927 | } | ||
5928 | |||
5929 | if (!dev->tgt_mode) { | ||
5930 | @@ -2143,7 +2143,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev, | ||
5931 | /* jumbo frame ? */ | ||
5932 | if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) { | ||
5933 | rc = pn533_fill_fragment_skbs(dev, skb); | ||
5934 | - if (rc <= 0) | ||
5935 | + if (rc < 0) | ||
5936 | goto error; | ||
5937 | |||
5938 | skb = skb_dequeue(&dev->fragment_skb); | ||
5939 | @@ -2215,7 +2215,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb) | ||
5940 | /* let's split in multiple chunks if size's too big */ | ||
5941 | if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) { | ||
5942 | rc = pn533_fill_fragment_skbs(dev, skb); | ||
5943 | - if (rc <= 0) | ||
5944 | + if (rc < 0) | ||
5945 | goto error; | ||
5946 | |||
5947 | /* get the first skb */ | ||
5948 | diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c | ||
5949 | index 016a67fd41989..9f01af2f03e68 100644 | ||
5950 | --- a/drivers/nvme/host/multipath.c | ||
5951 | +++ b/drivers/nvme/host/multipath.c | ||
5952 | @@ -156,13 +156,12 @@ void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) | ||
5953 | { | ||
5954 | struct nvme_ns *ns; | ||
5955 | |||
5956 | - mutex_lock(&ctrl->scan_lock); | ||
5957 | down_read(&ctrl->namespaces_rwsem); | ||
5958 | - list_for_each_entry(ns, &ctrl->namespaces, list) | ||
5959 | - if (nvme_mpath_clear_current_path(ns)) | ||
5960 | - kblockd_schedule_work(&ns->head->requeue_work); | ||
5961 | + list_for_each_entry(ns, &ctrl->namespaces, list) { | ||
5962 | + nvme_mpath_clear_current_path(ns); | ||
5963 | + kblockd_schedule_work(&ns->head->requeue_work); | ||
5964 | + } | ||
5965 | up_read(&ctrl->namespaces_rwsem); | ||
5966 | - mutex_unlock(&ctrl->scan_lock); | ||
5967 | } | ||
5968 | |||
5969 | static bool nvme_path_is_disabled(struct nvme_ns *ns) | ||
5970 | diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c | ||
5971 | index dcc3d2393605e..08a23bb4b8b57 100644 | ||
5972 | --- a/drivers/nvme/host/rdma.c | ||
5973 | +++ b/drivers/nvme/host/rdma.c | ||
5974 | @@ -1019,11 +1019,13 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new) | ||
5975 | return ret; | ||
5976 | |||
5977 | if (ctrl->ctrl.icdoff) { | ||
5978 | + ret = -EOPNOTSUPP; | ||
5979 | dev_err(ctrl->ctrl.device, "icdoff is not supported!\n"); | ||
5980 | goto destroy_admin; | ||
5981 | } | ||
5982 | |||
5983 | if (!(ctrl->ctrl.sgls & (1 << 2))) { | ||
5984 | + ret = -EOPNOTSUPP; | ||
5985 | dev_err(ctrl->ctrl.device, | ||
5986 | "Mandatory keyed sgls are not supported!\n"); | ||
5987 | goto destroy_admin; | ||
5988 | diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c | ||
5989 | index 98613a45bd3b4..baf8a3e4ed12a 100644 | ||
5990 | --- a/drivers/nvme/target/configfs.c | ||
5991 | +++ b/drivers/nvme/target/configfs.c | ||
5992 | @@ -1148,6 +1148,8 @@ static void nvmet_port_release(struct config_item *item) | ||
5993 | { | ||
5994 | struct nvmet_port *port = to_nvmet_port(item); | ||
5995 | |||
5996 | + /* Let inflight controllers teardown complete */ | ||
5997 | + flush_scheduled_work(); | ||
5998 | list_del(&port->global_entry); | ||
5999 | |||
6000 | kfree(port->ana_state); | ||
6001 | diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c | ||
6002 | index 2f4e512bd449f..fac1985870765 100644 | ||
6003 | --- a/drivers/nvme/target/tcp.c | ||
6004 | +++ b/drivers/nvme/target/tcp.c | ||
6005 | @@ -1020,7 +1020,7 @@ recv: | ||
6006 | } | ||
6007 | |||
6008 | if (queue->hdr_digest && | ||
6009 | - nvmet_tcp_verify_hdgst(queue, &queue->pdu, queue->offset)) { | ||
6010 | + nvmet_tcp_verify_hdgst(queue, &queue->pdu, hdr->hlen)) { | ||
6011 | nvmet_tcp_fatal_error(queue); /* fatal */ | ||
6012 | return -EPROTO; | ||
6013 | } | ||
6014 | @@ -1343,6 +1343,7 @@ static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue) | ||
6015 | |||
6016 | static void nvmet_tcp_release_queue_work(struct work_struct *w) | ||
6017 | { | ||
6018 | + struct page *page; | ||
6019 | struct nvmet_tcp_queue *queue = | ||
6020 | container_of(w, struct nvmet_tcp_queue, release_work); | ||
6021 | |||
6022 | @@ -1362,6 +1363,8 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w) | ||
6023 | nvmet_tcp_free_crypto(queue); | ||
6024 | ida_simple_remove(&nvmet_tcp_queue_ida, queue->idx); | ||
6025 | |||
6026 | + page = virt_to_head_page(queue->pf_cache.va); | ||
6027 | + __page_frag_cache_drain(page, queue->pf_cache.pagecnt_bias); | ||
6028 | kfree(queue); | ||
6029 | } | ||
6030 | |||
6031 | @@ -1664,6 +1667,17 @@ err_port: | ||
6032 | return ret; | ||
6033 | } | ||
6034 | |||
6035 | +static void nvmet_tcp_destroy_port_queues(struct nvmet_tcp_port *port) | ||
6036 | +{ | ||
6037 | + struct nvmet_tcp_queue *queue; | ||
6038 | + | ||
6039 | + mutex_lock(&nvmet_tcp_queue_mutex); | ||
6040 | + list_for_each_entry(queue, &nvmet_tcp_queue_list, queue_list) | ||
6041 | + if (queue->port == port) | ||
6042 | + kernel_sock_shutdown(queue->sock, SHUT_RDWR); | ||
6043 | + mutex_unlock(&nvmet_tcp_queue_mutex); | ||
6044 | +} | ||
6045 | + | ||
6046 | static void nvmet_tcp_remove_port(struct nvmet_port *nport) | ||
6047 | { | ||
6048 | struct nvmet_tcp_port *port = nport->priv; | ||
6049 | @@ -1673,6 +1687,11 @@ static void nvmet_tcp_remove_port(struct nvmet_port *nport) | ||
6050 | port->sock->sk->sk_user_data = NULL; | ||
6051 | write_unlock_bh(&port->sock->sk->sk_callback_lock); | ||
6052 | cancel_work_sync(&port->accept_work); | ||
6053 | + /* | ||
6054 | + * Destroy the remaining queues, which are not belong to any | ||
6055 | + * controller yet. | ||
6056 | + */ | ||
6057 | + nvmet_tcp_destroy_port_queues(port); | ||
6058 | |||
6059 | sock_release(port->sock); | ||
6060 | kfree(port); | ||
6061 | diff --git a/drivers/opp/of.c b/drivers/opp/of.c | ||
6062 | index 30cc407c8f93f..ba30694508153 100644 | ||
6063 | --- a/drivers/opp/of.c | ||
6064 | +++ b/drivers/opp/of.c | ||
6065 | @@ -639,7 +639,7 @@ free_required_opps: | ||
6066 | free_opp: | ||
6067 | _opp_free(new_opp); | ||
6068 | |||
6069 | - return ERR_PTR(ret); | ||
6070 | + return ret ? ERR_PTR(ret) : NULL; | ||
6071 | } | ||
6072 | |||
6073 | /* Initializes OPP tables based on new bindings */ | ||
6074 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c | ||
6075 | index 18753fd218a31..45794ba643d40 100644 | ||
6076 | --- a/drivers/pci/controller/pci-aardvark.c | ||
6077 | +++ b/drivers/pci/controller/pci-aardvark.c | ||
6078 | @@ -108,26 +108,69 @@ | ||
6079 | #define PCIE_ISR0_MSI_INT_PENDING BIT(24) | ||
6080 | #define PCIE_ISR0_INTX_ASSERT(val) BIT(16 + (val)) | ||
6081 | #define PCIE_ISR0_INTX_DEASSERT(val) BIT(20 + (val)) | ||
6082 | -#define PCIE_ISR0_ALL_MASK GENMASK(26, 0) | ||
6083 | +#define PCIE_ISR0_ALL_MASK GENMASK(31, 0) | ||
6084 | #define PCIE_ISR1_REG (CONTROL_BASE_ADDR + 0x48) | ||
6085 | #define PCIE_ISR1_MASK_REG (CONTROL_BASE_ADDR + 0x4C) | ||
6086 | #define PCIE_ISR1_POWER_STATE_CHANGE BIT(4) | ||
6087 | #define PCIE_ISR1_FLUSH BIT(5) | ||
6088 | #define PCIE_ISR1_INTX_ASSERT(val) BIT(8 + (val)) | ||
6089 | -#define PCIE_ISR1_ALL_MASK GENMASK(11, 4) | ||
6090 | +#define PCIE_ISR1_ALL_MASK GENMASK(31, 0) | ||
6091 | #define PCIE_MSI_ADDR_LOW_REG (CONTROL_BASE_ADDR + 0x50) | ||
6092 | #define PCIE_MSI_ADDR_HIGH_REG (CONTROL_BASE_ADDR + 0x54) | ||
6093 | #define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58) | ||
6094 | #define PCIE_MSI_MASK_REG (CONTROL_BASE_ADDR + 0x5C) | ||
6095 | #define PCIE_MSI_PAYLOAD_REG (CONTROL_BASE_ADDR + 0x9C) | ||
6096 | +#define PCIE_MSI_DATA_MASK GENMASK(15, 0) | ||
6097 | |||
6098 | /* LMI registers base address and register offsets */ | ||
6099 | #define LMI_BASE_ADDR 0x6000 | ||
6100 | #define CFG_REG (LMI_BASE_ADDR + 0x0) | ||
6101 | #define LTSSM_SHIFT 24 | ||
6102 | #define LTSSM_MASK 0x3f | ||
6103 | -#define LTSSM_L0 0x10 | ||
6104 | #define RC_BAR_CONFIG 0x300 | ||
6105 | + | ||
6106 | +/* LTSSM values in CFG_REG */ | ||
6107 | +enum { | ||
6108 | + LTSSM_DETECT_QUIET = 0x0, | ||
6109 | + LTSSM_DETECT_ACTIVE = 0x1, | ||
6110 | + LTSSM_POLLING_ACTIVE = 0x2, | ||
6111 | + LTSSM_POLLING_COMPLIANCE = 0x3, | ||
6112 | + LTSSM_POLLING_CONFIGURATION = 0x4, | ||
6113 | + LTSSM_CONFIG_LINKWIDTH_START = 0x5, | ||
6114 | + LTSSM_CONFIG_LINKWIDTH_ACCEPT = 0x6, | ||
6115 | + LTSSM_CONFIG_LANENUM_ACCEPT = 0x7, | ||
6116 | + LTSSM_CONFIG_LANENUM_WAIT = 0x8, | ||
6117 | + LTSSM_CONFIG_COMPLETE = 0x9, | ||
6118 | + LTSSM_CONFIG_IDLE = 0xa, | ||
6119 | + LTSSM_RECOVERY_RCVR_LOCK = 0xb, | ||
6120 | + LTSSM_RECOVERY_SPEED = 0xc, | ||
6121 | + LTSSM_RECOVERY_RCVR_CFG = 0xd, | ||
6122 | + LTSSM_RECOVERY_IDLE = 0xe, | ||
6123 | + LTSSM_L0 = 0x10, | ||
6124 | + LTSSM_RX_L0S_ENTRY = 0x11, | ||
6125 | + LTSSM_RX_L0S_IDLE = 0x12, | ||
6126 | + LTSSM_RX_L0S_FTS = 0x13, | ||
6127 | + LTSSM_TX_L0S_ENTRY = 0x14, | ||
6128 | + LTSSM_TX_L0S_IDLE = 0x15, | ||
6129 | + LTSSM_TX_L0S_FTS = 0x16, | ||
6130 | + LTSSM_L1_ENTRY = 0x17, | ||
6131 | + LTSSM_L1_IDLE = 0x18, | ||
6132 | + LTSSM_L2_IDLE = 0x19, | ||
6133 | + LTSSM_L2_TRANSMIT_WAKE = 0x1a, | ||
6134 | + LTSSM_DISABLED = 0x20, | ||
6135 | + LTSSM_LOOPBACK_ENTRY_MASTER = 0x21, | ||
6136 | + LTSSM_LOOPBACK_ACTIVE_MASTER = 0x22, | ||
6137 | + LTSSM_LOOPBACK_EXIT_MASTER = 0x23, | ||
6138 | + LTSSM_LOOPBACK_ENTRY_SLAVE = 0x24, | ||
6139 | + LTSSM_LOOPBACK_ACTIVE_SLAVE = 0x25, | ||
6140 | + LTSSM_LOOPBACK_EXIT_SLAVE = 0x26, | ||
6141 | + LTSSM_HOT_RESET = 0x27, | ||
6142 | + LTSSM_RECOVERY_EQUALIZATION_PHASE0 = 0x28, | ||
6143 | + LTSSM_RECOVERY_EQUALIZATION_PHASE1 = 0x29, | ||
6144 | + LTSSM_RECOVERY_EQUALIZATION_PHASE2 = 0x2a, | ||
6145 | + LTSSM_RECOVERY_EQUALIZATION_PHASE3 = 0x2b, | ||
6146 | +}; | ||
6147 | + | ||
6148 | #define VENDOR_ID_REG (LMI_BASE_ADDR + 0x44) | ||
6149 | |||
6150 | /* PCIe core controller registers */ | ||
6151 | @@ -160,7 +203,7 @@ | ||
6152 | #define PCIE_IRQ_MSI_INT2_DET BIT(21) | ||
6153 | #define PCIE_IRQ_RC_DBELL_DET BIT(22) | ||
6154 | #define PCIE_IRQ_EP_STATUS BIT(23) | ||
6155 | -#define PCIE_IRQ_ALL_MASK 0xfff0fb | ||
6156 | +#define PCIE_IRQ_ALL_MASK GENMASK(31, 0) | ||
6157 | #define PCIE_IRQ_ENABLE_INTS_MASK PCIE_IRQ_CORE_INT | ||
6158 | |||
6159 | /* Transaction types */ | ||
6160 | @@ -219,13 +262,49 @@ static inline u32 advk_readl(struct advk_pcie *pcie, u64 reg) | ||
6161 | return readl(pcie->base + reg); | ||
6162 | } | ||
6163 | |||
6164 | -static int advk_pcie_link_up(struct advk_pcie *pcie) | ||
6165 | +static u8 advk_pcie_ltssm_state(struct advk_pcie *pcie) | ||
6166 | { | ||
6167 | - u32 val, ltssm_state; | ||
6168 | + u32 val; | ||
6169 | + u8 ltssm_state; | ||
6170 | |||
6171 | val = advk_readl(pcie, CFG_REG); | ||
6172 | ltssm_state = (val >> LTSSM_SHIFT) & LTSSM_MASK; | ||
6173 | - return ltssm_state >= LTSSM_L0; | ||
6174 | + return ltssm_state; | ||
6175 | +} | ||
6176 | + | ||
6177 | +static inline bool advk_pcie_link_up(struct advk_pcie *pcie) | ||
6178 | +{ | ||
6179 | + /* check if LTSSM is in normal operation - some L* state */ | ||
6180 | + u8 ltssm_state = advk_pcie_ltssm_state(pcie); | ||
6181 | + return ltssm_state >= LTSSM_L0 && ltssm_state < LTSSM_DISABLED; | ||
6182 | +} | ||
6183 | + | ||
6184 | +static inline bool advk_pcie_link_active(struct advk_pcie *pcie) | ||
6185 | +{ | ||
6186 | + /* | ||
6187 | + * According to PCIe Base specification 3.0, Table 4-14: Link | ||
6188 | + * Status Mapped to the LTSSM, and 4.2.6.3.6 Configuration.Idle | ||
6189 | + * is Link Up mapped to LTSSM Configuration.Idle, Recovery, L0, | ||
6190 | + * L0s, L1 and L2 states. And according to 3.2.1. Data Link | ||
6191 | + * Control and Management State Machine Rules is DL Up status | ||
6192 | + * reported in DL Active state. | ||
6193 | + */ | ||
6194 | + u8 ltssm_state = advk_pcie_ltssm_state(pcie); | ||
6195 | + return ltssm_state >= LTSSM_CONFIG_IDLE && ltssm_state < LTSSM_DISABLED; | ||
6196 | +} | ||
6197 | + | ||
6198 | +static inline bool advk_pcie_link_training(struct advk_pcie *pcie) | ||
6199 | +{ | ||
6200 | + /* | ||
6201 | + * According to PCIe Base specification 3.0, Table 4-14: Link | ||
6202 | + * Status Mapped to the LTSSM is Link Training mapped to LTSSM | ||
6203 | + * Configuration and Recovery states. | ||
6204 | + */ | ||
6205 | + u8 ltssm_state = advk_pcie_ltssm_state(pcie); | ||
6206 | + return ((ltssm_state >= LTSSM_CONFIG_LINKWIDTH_START && | ||
6207 | + ltssm_state < LTSSM_L0) || | ||
6208 | + (ltssm_state >= LTSSM_RECOVERY_EQUALIZATION_PHASE0 && | ||
6209 | + ltssm_state <= LTSSM_RECOVERY_EQUALIZATION_PHASE3)); | ||
6210 | } | ||
6211 | |||
6212 | static int advk_pcie_wait_for_link(struct advk_pcie *pcie) | ||
6213 | @@ -252,7 +331,7 @@ static void advk_pcie_wait_for_retrain(struct advk_pcie *pcie) | ||
6214 | size_t retries; | ||
6215 | |||
6216 | for (retries = 0; retries < RETRAIN_WAIT_MAX_RETRIES; ++retries) { | ||
6217 | - if (!advk_pcie_link_up(pcie)) | ||
6218 | + if (advk_pcie_link_training(pcie)) | ||
6219 | break; | ||
6220 | udelay(RETRAIN_WAIT_USLEEP_US); | ||
6221 | } | ||
6222 | @@ -460,7 +539,7 @@ static int advk_pcie_check_pio_status(struct advk_pcie *pcie, bool allow_crs, u3 | ||
6223 | else | ||
6224 | str_posted = "Posted"; | ||
6225 | |||
6226 | - dev_err(dev, "%s PIO Response Status: %s, %#x @ %#x\n", | ||
6227 | + dev_dbg(dev, "%s PIO Response Status: %s, %#x @ %#x\n", | ||
6228 | str_posted, strcomp_status, reg, advk_readl(pcie, PIO_ADDR_LS)); | ||
6229 | |||
6230 | return -EFAULT; | ||
6231 | @@ -501,6 +580,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, | ||
6232 | case PCI_EXP_RTCTL: { | ||
6233 | u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); | ||
6234 | *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE; | ||
6235 | + *value |= le16_to_cpu(bridge->pcie_conf.rootctl) & PCI_EXP_RTCTL_CRSSVE; | ||
6236 | *value |= PCI_EXP_RTCAP_CRSVIS << 16; | ||
6237 | return PCI_BRIDGE_EMUL_HANDLED; | ||
6238 | } | ||
6239 | @@ -512,12 +592,26 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, | ||
6240 | return PCI_BRIDGE_EMUL_HANDLED; | ||
6241 | } | ||
6242 | |||
6243 | + case PCI_EXP_LNKCAP: { | ||
6244 | + u32 val = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); | ||
6245 | + /* | ||
6246 | + * PCI_EXP_LNKCAP_DLLLARC bit is hardwired in aardvark HW to 0. | ||
6247 | + * But support for PCI_EXP_LNKSTA_DLLLA is emulated via ltssm | ||
6248 | + * state so explicitly enable PCI_EXP_LNKCAP_DLLLARC flag. | ||
6249 | + */ | ||
6250 | + val |= PCI_EXP_LNKCAP_DLLLARC; | ||
6251 | + *value = val; | ||
6252 | + return PCI_BRIDGE_EMUL_HANDLED; | ||
6253 | + } | ||
6254 | + | ||
6255 | case PCI_EXP_LNKCTL: { | ||
6256 | /* u32 contains both PCI_EXP_LNKCTL and PCI_EXP_LNKSTA */ | ||
6257 | u32 val = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg) & | ||
6258 | ~(PCI_EXP_LNKSTA_LT << 16); | ||
6259 | - if (!advk_pcie_link_up(pcie)) | ||
6260 | + if (advk_pcie_link_training(pcie)) | ||
6261 | val |= (PCI_EXP_LNKSTA_LT << 16); | ||
6262 | + if (advk_pcie_link_active(pcie)) | ||
6263 | + val |= (PCI_EXP_LNKSTA_DLLLA << 16); | ||
6264 | *value = val; | ||
6265 | return PCI_BRIDGE_EMUL_HANDLED; | ||
6266 | } | ||
6267 | @@ -525,7 +619,6 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, | ||
6268 | case PCI_CAP_LIST_ID: | ||
6269 | case PCI_EXP_DEVCAP: | ||
6270 | case PCI_EXP_DEVCTL: | ||
6271 | - case PCI_EXP_LNKCAP: | ||
6272 | *value = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); | ||
6273 | return PCI_BRIDGE_EMUL_HANDLED; | ||
6274 | default: | ||
6275 | @@ -851,7 +944,7 @@ static int advk_msi_irq_domain_alloc(struct irq_domain *domain, | ||
6276 | domain->host_data, handle_simple_irq, | ||
6277 | NULL, NULL); | ||
6278 | |||
6279 | - return hwirq; | ||
6280 | + return 0; | ||
6281 | } | ||
6282 | |||
6283 | static void advk_msi_irq_domain_free(struct irq_domain *domain, | ||
6284 | @@ -1032,8 +1125,12 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie) | ||
6285 | if (!(BIT(msi_idx) & msi_status)) | ||
6286 | continue; | ||
6287 | |||
6288 | + /* | ||
6289 | + * msi_idx contains bits [4:0] of the msi_data and msi_data | ||
6290 | + * contains 16bit MSI interrupt number | ||
6291 | + */ | ||
6292 | advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG); | ||
6293 | - msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & 0xFF; | ||
6294 | + msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK; | ||
6295 | generic_handle_irq(msi_data); | ||
6296 | } | ||
6297 | |||
6298 | @@ -1055,12 +1152,6 @@ static void advk_pcie_handle_int(struct advk_pcie *pcie) | ||
6299 | isr1_mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); | ||
6300 | isr1_status = isr1_val & ((~isr1_mask) & PCIE_ISR1_ALL_MASK); | ||
6301 | |||
6302 | - if (!isr0_status && !isr1_status) { | ||
6303 | - advk_writel(pcie, isr0_val, PCIE_ISR0_REG); | ||
6304 | - advk_writel(pcie, isr1_val, PCIE_ISR1_REG); | ||
6305 | - return; | ||
6306 | - } | ||
6307 | - | ||
6308 | /* Process MSI interrupts */ | ||
6309 | if (isr0_status & PCIE_ISR0_MSI_INT_PENDING) | ||
6310 | advk_pcie_handle_msi(pcie); | ||
6311 | diff --git a/drivers/pci/pci-bridge-emul.c b/drivers/pci/pci-bridge-emul.c | ||
6312 | index 06c800595e036..b3d63e319bb39 100644 | ||
6313 | --- a/drivers/pci/pci-bridge-emul.c | ||
6314 | +++ b/drivers/pci/pci-bridge-emul.c | ||
6315 | @@ -432,8 +432,21 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where, | ||
6316 | /* Clear the W1C bits */ | ||
6317 | new &= ~((value << shift) & (behavior[reg / 4].w1c & mask)); | ||
6318 | |||
6319 | + /* Save the new value with the cleared W1C bits into the cfgspace */ | ||
6320 | cfgspace[reg / 4] = cpu_to_le32(new); | ||
6321 | |||
6322 | + /* | ||
6323 | + * Clear the W1C bits not specified by the write mask, so that the | ||
6324 | + * write_op() does not clear them. | ||
6325 | + */ | ||
6326 | + new &= ~(behavior[reg / 4].w1c & ~mask); | ||
6327 | + | ||
6328 | + /* | ||
6329 | + * Set the W1C bits specified by the write mask, so that write_op() | ||
6330 | + * knows about that they are to be cleared. | ||
6331 | + */ | ||
6332 | + new |= (value << shift) & (behavior[reg / 4].w1c & mask); | ||
6333 | + | ||
6334 | if (write_op) | ||
6335 | write_op(bridge, reg, old, new, mask); | ||
6336 | |||
6337 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c | ||
6338 | index 686298c0f6cda..fb7c5518447da 100644 | ||
6339 | --- a/drivers/pci/quirks.c | ||
6340 | +++ b/drivers/pci/quirks.c | ||
6341 | @@ -3584,6 +3584,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset); | ||
6342 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset); | ||
6343 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset); | ||
6344 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset); | ||
6345 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003e, quirk_no_bus_reset); | ||
6346 | |||
6347 | /* | ||
6348 | * Root port on some Cavium CN8xxx chips do not successfully complete a bus | ||
6349 | diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c | ||
6350 | index bf94a52d30871..946e9b05f0ae6 100644 | ||
6351 | --- a/drivers/phy/qualcomm/phy-qcom-qusb2.c | ||
6352 | +++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c | ||
6353 | @@ -432,7 +432,7 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) | ||
6354 | { | ||
6355 | struct device *dev = &qphy->phy->dev; | ||
6356 | const struct qusb2_phy_cfg *cfg = qphy->cfg; | ||
6357 | - u8 *val; | ||
6358 | + u8 *val, hstx_trim; | ||
6359 | |||
6360 | /* efuse register is optional */ | ||
6361 | if (!qphy->cell) | ||
6362 | @@ -446,7 +446,13 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) | ||
6363 | * set while configuring the phy. | ||
6364 | */ | ||
6365 | val = nvmem_cell_read(qphy->cell, NULL); | ||
6366 | - if (IS_ERR(val) || !val[0]) { | ||
6367 | + if (IS_ERR(val)) { | ||
6368 | + dev_dbg(dev, "failed to read a valid hs-tx trim value\n"); | ||
6369 | + return; | ||
6370 | + } | ||
6371 | + hstx_trim = val[0]; | ||
6372 | + kfree(val); | ||
6373 | + if (!hstx_trim) { | ||
6374 | dev_dbg(dev, "failed to read a valid hs-tx trim value\n"); | ||
6375 | return; | ||
6376 | } | ||
6377 | @@ -454,12 +460,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) | ||
6378 | /* Fused TUNE1/2 value is the higher nibble only */ | ||
6379 | if (cfg->update_tune1_with_efuse) | ||
6380 | qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1], | ||
6381 | - val[0] << HSTX_TRIM_SHIFT, | ||
6382 | - HSTX_TRIM_MASK); | ||
6383 | + hstx_trim << HSTX_TRIM_SHIFT, HSTX_TRIM_MASK); | ||
6384 | else | ||
6385 | qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2], | ||
6386 | - val[0] << HSTX_TRIM_SHIFT, | ||
6387 | - HSTX_TRIM_MASK); | ||
6388 | + hstx_trim << HSTX_TRIM_SHIFT, HSTX_TRIM_MASK); | ||
6389 | } | ||
6390 | |||
6391 | static int qusb2_phy_set_mode(struct phy *phy, | ||
6392 | diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c | ||
6393 | index 6381745e3bb18..9ebeef2ac7b18 100644 | ||
6394 | --- a/drivers/pinctrl/core.c | ||
6395 | +++ b/drivers/pinctrl/core.c | ||
6396 | @@ -2055,6 +2055,8 @@ int pinctrl_enable(struct pinctrl_dev *pctldev) | ||
6397 | if (error) { | ||
6398 | dev_err(pctldev->dev, "could not claim hogs: %i\n", | ||
6399 | error); | ||
6400 | + pinctrl_free_pindescs(pctldev, pctldev->desc->pins, | ||
6401 | + pctldev->desc->npins); | ||
6402 | mutex_destroy(&pctldev->mutex); | ||
6403 | kfree(pctldev); | ||
6404 | |||
6405 | diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c | ||
6406 | index f027609fdab6d..3028d9f1ac59c 100644 | ||
6407 | --- a/drivers/platform/x86/thinkpad_acpi.c | ||
6408 | +++ b/drivers/platform/x86/thinkpad_acpi.c | ||
6409 | @@ -9086,7 +9086,7 @@ static int fan_write_cmd_level(const char *cmd, int *rc) | ||
6410 | |||
6411 | if (strlencmp(cmd, "level auto") == 0) | ||
6412 | level = TP_EC_FAN_AUTO; | ||
6413 | - else if ((strlencmp(cmd, "level disengaged") == 0) | | ||
6414 | + else if ((strlencmp(cmd, "level disengaged") == 0) || | ||
6415 | (strlencmp(cmd, "level full-speed") == 0)) | ||
6416 | level = TP_EC_FAN_FULLSPEED; | ||
6417 | else if (sscanf(cmd, "level %d", &level) != 1) | ||
6418 | diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c | ||
6419 | index 59e9aa0f96436..cb029126a68c6 100644 | ||
6420 | --- a/drivers/platform/x86/wmi.c | ||
6421 | +++ b/drivers/platform/x86/wmi.c | ||
6422 | @@ -353,7 +353,14 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, | ||
6423 | * the WQxx method failed - we should disable collection anyway. | ||
6424 | */ | ||
6425 | if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) { | ||
6426 | - status = acpi_execute_simple_method(handle, wc_method, 0); | ||
6427 | + /* | ||
6428 | + * Ignore whether this WCxx call succeeds or not since | ||
6429 | + * the previously executed WQxx method call might have | ||
6430 | + * succeeded, and returning the failing status code | ||
6431 | + * of this call would throw away the result of the WQxx | ||
6432 | + * call, potentially leaking memory. | ||
6433 | + */ | ||
6434 | + acpi_execute_simple_method(handle, wc_method, 0); | ||
6435 | } | ||
6436 | |||
6437 | return status; | ||
6438 | diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c | ||
6439 | index 2677c38a8a424..34229c1f43e31 100644 | ||
6440 | --- a/drivers/power/supply/bq27xxx_battery_i2c.c | ||
6441 | +++ b/drivers/power/supply/bq27xxx_battery_i2c.c | ||
6442 | @@ -195,7 +195,8 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client, | ||
6443 | dev_err(&client->dev, | ||
6444 | "Unable to register IRQ %d error %d\n", | ||
6445 | client->irq, ret); | ||
6446 | - return ret; | ||
6447 | + bq27xxx_battery_teardown(di); | ||
6448 | + goto err_failed; | ||
6449 | } | ||
6450 | } | ||
6451 | |||
6452 | diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c | ||
6453 | index f8f8207a1895e..170639a1e734a 100644 | ||
6454 | --- a/drivers/power/supply/max17042_battery.c | ||
6455 | +++ b/drivers/power/supply/max17042_battery.c | ||
6456 | @@ -312,7 +312,10 @@ static int max17042_get_property(struct power_supply *psy, | ||
6457 | val->intval = data * 625 / 8; | ||
6458 | break; | ||
6459 | case POWER_SUPPLY_PROP_CAPACITY: | ||
6460 | - ret = regmap_read(map, MAX17042_RepSOC, &data); | ||
6461 | + if (chip->pdata->enable_current_sense) | ||
6462 | + ret = regmap_read(map, MAX17042_RepSOC, &data); | ||
6463 | + else | ||
6464 | + ret = regmap_read(map, MAX17042_VFSOC, &data); | ||
6465 | if (ret < 0) | ||
6466 | return ret; | ||
6467 | |||
6468 | @@ -834,7 +837,8 @@ static void max17042_set_soc_threshold(struct max17042_chip *chip, u16 off) | ||
6469 | regmap_read(map, MAX17042_RepSOC, &soc); | ||
6470 | soc >>= 8; | ||
6471 | soc_tr = (soc + off) << 8; | ||
6472 | - soc_tr |= (soc - off); | ||
6473 | + if (off < soc) | ||
6474 | + soc_tr |= soc - off; | ||
6475 | regmap_write(map, MAX17042_SALRT_Th, soc_tr); | ||
6476 | } | ||
6477 | |||
6478 | diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c | ||
6479 | index 6609f8cb8ca01..ef53891b88bbc 100644 | ||
6480 | --- a/drivers/power/supply/rt5033_battery.c | ||
6481 | +++ b/drivers/power/supply/rt5033_battery.c | ||
6482 | @@ -60,7 +60,7 @@ static int rt5033_battery_get_watt_prop(struct i2c_client *client, | ||
6483 | regmap_read(battery->regmap, regh, &msb); | ||
6484 | regmap_read(battery->regmap, regl, &lsb); | ||
6485 | |||
6486 | - ret = ((msb << 4) + (lsb >> 4)) * 1250 / 1000; | ||
6487 | + ret = ((msb << 4) + (lsb >> 4)) * 1250; | ||
6488 | |||
6489 | return ret; | ||
6490 | } | ||
6491 | diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c | ||
6492 | index 5276f8442f3c6..1e9f03a2ea1cc 100644 | ||
6493 | --- a/drivers/regulator/s5m8767.c | ||
6494 | +++ b/drivers/regulator/s5m8767.c | ||
6495 | @@ -851,18 +851,15 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) | ||
6496 | /* DS4 GPIO */ | ||
6497 | gpio_direction_output(pdata->buck_ds[2], 0x0); | ||
6498 | |||
6499 | - if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs || | ||
6500 | - pdata->buck4_gpiodvs) { | ||
6501 | - regmap_update_bits(s5m8767->iodev->regmap_pmic, | ||
6502 | - S5M8767_REG_BUCK2CTRL, 1 << 1, | ||
6503 | - (pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1)); | ||
6504 | - regmap_update_bits(s5m8767->iodev->regmap_pmic, | ||
6505 | - S5M8767_REG_BUCK3CTRL, 1 << 1, | ||
6506 | - (pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1)); | ||
6507 | - regmap_update_bits(s5m8767->iodev->regmap_pmic, | ||
6508 | - S5M8767_REG_BUCK4CTRL, 1 << 1, | ||
6509 | - (pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1)); | ||
6510 | - } | ||
6511 | + regmap_update_bits(s5m8767->iodev->regmap_pmic, | ||
6512 | + S5M8767_REG_BUCK2CTRL, 1 << 1, | ||
6513 | + (pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1)); | ||
6514 | + regmap_update_bits(s5m8767->iodev->regmap_pmic, | ||
6515 | + S5M8767_REG_BUCK3CTRL, 1 << 1, | ||
6516 | + (pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1)); | ||
6517 | + regmap_update_bits(s5m8767->iodev->regmap_pmic, | ||
6518 | + S5M8767_REG_BUCK4CTRL, 1 << 1, | ||
6519 | + (pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1)); | ||
6520 | |||
6521 | /* Initialize GPIO DVS registers */ | ||
6522 | for (i = 0; i < 8; i++) { | ||
6523 | diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c | ||
6524 | index 96953992c2bb5..1c5236a69dc49 100644 | ||
6525 | --- a/drivers/reset/reset-socfpga.c | ||
6526 | +++ b/drivers/reset/reset-socfpga.c | ||
6527 | @@ -86,3 +86,29 @@ void __init socfpga_reset_init(void) | ||
6528 | for_each_matching_node(np, socfpga_early_reset_dt_ids) | ||
6529 | a10_reset_init(np); | ||
6530 | } | ||
6531 | + | ||
6532 | +/* | ||
6533 | + * The early driver is problematic, because it doesn't register | ||
6534 | + * itself as a driver. This causes certain device links to prevent | ||
6535 | + * consumer devices from probing. The hacky solution is to register | ||
6536 | + * an empty driver, whose only job is to attach itself to the reset | ||
6537 | + * manager and call probe. | ||
6538 | + */ | ||
6539 | +static const struct of_device_id socfpga_reset_dt_ids[] = { | ||
6540 | + { .compatible = "altr,rst-mgr", }, | ||
6541 | + { /* sentinel */ }, | ||
6542 | +}; | ||
6543 | + | ||
6544 | +static int reset_simple_probe(struct platform_device *pdev) | ||
6545 | +{ | ||
6546 | + return 0; | ||
6547 | +} | ||
6548 | + | ||
6549 | +static struct platform_driver reset_socfpga_driver = { | ||
6550 | + .probe = reset_simple_probe, | ||
6551 | + .driver = { | ||
6552 | + .name = "socfpga-reset", | ||
6553 | + .of_match_table = socfpga_reset_dt_ids, | ||
6554 | + }, | ||
6555 | +}; | ||
6556 | +builtin_platform_driver(reset_socfpga_driver); | ||
6557 | diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c | ||
6558 | index 1f5fab617b679..f7e75d9fedf61 100644 | ||
6559 | --- a/drivers/s390/char/tape_std.c | ||
6560 | +++ b/drivers/s390/char/tape_std.c | ||
6561 | @@ -53,7 +53,6 @@ int | ||
6562 | tape_std_assign(struct tape_device *device) | ||
6563 | { | ||
6564 | int rc; | ||
6565 | - struct timer_list timeout; | ||
6566 | struct tape_request *request; | ||
6567 | |||
6568 | request = tape_alloc_request(2, 11); | ||
6569 | @@ -70,7 +69,7 @@ tape_std_assign(struct tape_device *device) | ||
6570 | * So we set up a timeout for this call. | ||
6571 | */ | ||
6572 | timer_setup(&request->timer, tape_std_assign_timeout, 0); | ||
6573 | - mod_timer(&timeout, jiffies + 2 * HZ); | ||
6574 | + mod_timer(&request->timer, jiffies + msecs_to_jiffies(2000)); | ||
6575 | |||
6576 | rc = tape_do_io_interruptible(device, request); | ||
6577 | |||
6578 | diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c | ||
6579 | index 7950ac59b1744..ad447437a27c5 100644 | ||
6580 | --- a/drivers/s390/cio/css.c | ||
6581 | +++ b/drivers/s390/cio/css.c | ||
6582 | @@ -433,8 +433,8 @@ static ssize_t dev_busid_show(struct device *dev, | ||
6583 | struct subchannel *sch = to_subchannel(dev); | ||
6584 | struct pmcw *pmcw = &sch->schib.pmcw; | ||
6585 | |||
6586 | - if ((pmcw->st == SUBCHANNEL_TYPE_IO || | ||
6587 | - pmcw->st == SUBCHANNEL_TYPE_MSG) && pmcw->dnv) | ||
6588 | + if ((pmcw->st == SUBCHANNEL_TYPE_IO && pmcw->dnv) || | ||
6589 | + (pmcw->st == SUBCHANNEL_TYPE_MSG && pmcw->w)) | ||
6590 | return sysfs_emit(buf, "0.%x.%04x\n", sch->schid.ssid, | ||
6591 | pmcw->dev); | ||
6592 | else | ||
6593 | diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c | ||
6594 | index ccecf6b9504e8..5a411595347b5 100644 | ||
6595 | --- a/drivers/s390/cio/device_ops.c | ||
6596 | +++ b/drivers/s390/cio/device_ops.c | ||
6597 | @@ -717,13 +717,23 @@ EXPORT_SYMBOL_GPL(ccw_device_get_schid); | ||
6598 | */ | ||
6599 | void *ccw_device_dma_zalloc(struct ccw_device *cdev, size_t size) | ||
6600 | { | ||
6601 | - return cio_gp_dma_zalloc(cdev->private->dma_pool, &cdev->dev, size); | ||
6602 | + void *addr; | ||
6603 | + | ||
6604 | + if (!get_device(&cdev->dev)) | ||
6605 | + return NULL; | ||
6606 | + addr = cio_gp_dma_zalloc(cdev->private->dma_pool, &cdev->dev, size); | ||
6607 | + if (IS_ERR_OR_NULL(addr)) | ||
6608 | + put_device(&cdev->dev); | ||
6609 | + return addr; | ||
6610 | } | ||
6611 | EXPORT_SYMBOL(ccw_device_dma_zalloc); | ||
6612 | |||
6613 | void ccw_device_dma_free(struct ccw_device *cdev, void *cpu_addr, size_t size) | ||
6614 | { | ||
6615 | + if (!cpu_addr) | ||
6616 | + return; | ||
6617 | cio_gp_dma_free(cdev->private->dma_pool, cpu_addr, size); | ||
6618 | + put_device(&cdev->dev); | ||
6619 | } | ||
6620 | EXPORT_SYMBOL(ccw_device_dma_free); | ||
6621 | |||
6622 | diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c | ||
6623 | index 23cbe4cda760e..c3bf590f5d685 100644 | ||
6624 | --- a/drivers/scsi/csiostor/csio_lnode.c | ||
6625 | +++ b/drivers/scsi/csiostor/csio_lnode.c | ||
6626 | @@ -619,7 +619,7 @@ csio_ln_vnp_read_cbfn(struct csio_hw *hw, struct csio_mb *mbp) | ||
6627 | struct fc_els_csp *csp; | ||
6628 | struct fc_els_cssp *clsp; | ||
6629 | enum fw_retval retval; | ||
6630 | - __be32 nport_id; | ||
6631 | + __be32 nport_id = 0; | ||
6632 | |||
6633 | retval = FW_CMD_RETVAL_G(ntohl(rsp->alloc_to_len16)); | ||
6634 | if (retval != FW_SUCCESS) { | ||
6635 | diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c | ||
6636 | index 13fbb2eab842e..5fb06930912a0 100644 | ||
6637 | --- a/drivers/scsi/dc395x.c | ||
6638 | +++ b/drivers/scsi/dc395x.c | ||
6639 | @@ -4698,6 +4698,7 @@ static int dc395x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | ||
6640 | /* initialise the adapter and everything we need */ | ||
6641 | if (adapter_init(acb, io_port_base, io_port_len, irq)) { | ||
6642 | dprintkl(KERN_INFO, "adapter init failed\n"); | ||
6643 | + acb = NULL; | ||
6644 | goto fail; | ||
6645 | } | ||
6646 | |||
6647 | diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c | ||
6648 | index 580d30cd5c35c..8f85ca0112961 100644 | ||
6649 | --- a/drivers/scsi/qla2xxx/qla_attr.c | ||
6650 | +++ b/drivers/scsi/qla2xxx/qla_attr.c | ||
6651 | @@ -1759,6 +1759,18 @@ qla2x00_port_speed_store(struct device *dev, struct device_attribute *attr, | ||
6652 | return strlen(buf); | ||
6653 | } | ||
6654 | |||
6655 | +static const struct { | ||
6656 | + u16 rate; | ||
6657 | + char *str; | ||
6658 | +} port_speed_str[] = { | ||
6659 | + { PORT_SPEED_4GB, "4" }, | ||
6660 | + { PORT_SPEED_8GB, "8" }, | ||
6661 | + { PORT_SPEED_16GB, "16" }, | ||
6662 | + { PORT_SPEED_32GB, "32" }, | ||
6663 | + { PORT_SPEED_64GB, "64" }, | ||
6664 | + { PORT_SPEED_10GB, "10" }, | ||
6665 | +}; | ||
6666 | + | ||
6667 | static ssize_t | ||
6668 | qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr, | ||
6669 | char *buf) | ||
6670 | @@ -1766,7 +1778,8 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr, | ||
6671 | struct scsi_qla_host *vha = shost_priv(dev_to_shost(dev)); | ||
6672 | struct qla_hw_data *ha = vha->hw; | ||
6673 | ssize_t rval; | ||
6674 | - char *spd[7] = {"0", "0", "0", "4", "8", "16", "32"}; | ||
6675 | + u16 i; | ||
6676 | + char *speed = "Unknown"; | ||
6677 | |||
6678 | rval = qla2x00_get_data_rate(vha); | ||
6679 | if (rval != QLA_SUCCESS) { | ||
6680 | @@ -1775,7 +1788,14 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr, | ||
6681 | return -EINVAL; | ||
6682 | } | ||
6683 | |||
6684 | - return scnprintf(buf, PAGE_SIZE, "%s\n", spd[ha->link_data_rate]); | ||
6685 | + for (i = 0; i < ARRAY_SIZE(port_speed_str); i++) { | ||
6686 | + if (port_speed_str[i].rate != ha->link_data_rate) | ||
6687 | + continue; | ||
6688 | + speed = port_speed_str[i].str; | ||
6689 | + break; | ||
6690 | + } | ||
6691 | + | ||
6692 | + return scnprintf(buf, PAGE_SIZE, "%s\n", speed); | ||
6693 | } | ||
6694 | |||
6695 | /* ----- */ | ||
6696 | diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h | ||
6697 | index 7aa233771ec86..1a98e37c9be22 100644 | ||
6698 | --- a/drivers/scsi/qla2xxx/qla_gbl.h | ||
6699 | +++ b/drivers/scsi/qla2xxx/qla_gbl.h | ||
6700 | @@ -156,7 +156,6 @@ extern int ql2xasynctmfenable; | ||
6701 | extern int ql2xgffidenable; | ||
6702 | extern int ql2xenabledif; | ||
6703 | extern int ql2xenablehba_err_chk; | ||
6704 | -extern int ql2xtargetreset; | ||
6705 | extern int ql2xdontresethba; | ||
6706 | extern uint64_t ql2xmaxlun; | ||
6707 | extern int ql2xmdcapmask; | ||
6708 | @@ -770,7 +769,6 @@ extern void qlafx00_abort_iocb(srb_t *, struct abort_iocb_entry_fx00 *); | ||
6709 | extern void qlafx00_fxdisc_iocb(srb_t *, struct fxdisc_entry_fx00 *); | ||
6710 | extern void qlafx00_timer_routine(scsi_qla_host_t *); | ||
6711 | extern int qlafx00_rescan_isp(scsi_qla_host_t *); | ||
6712 | -extern int qlafx00_loop_reset(scsi_qla_host_t *vha); | ||
6713 | |||
6714 | /* qla82xx related functions */ | ||
6715 | |||
6716 | diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c | ||
6717 | index 5dae7ac0d3efe..37c1f27a76cf6 100644 | ||
6718 | --- a/drivers/scsi/qla2xxx/qla_init.c | ||
6719 | +++ b/drivers/scsi/qla2xxx/qla_init.c | ||
6720 | @@ -978,8 +978,6 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res) | ||
6721 | sp->name, res, sp->u.iocb_cmd.u.mbx.in_mb[1], | ||
6722 | sp->u.iocb_cmd.u.mbx.in_mb[2]); | ||
6723 | |||
6724 | - if (res == QLA_FUNCTION_TIMEOUT) | ||
6725 | - return; | ||
6726 | |||
6727 | sp->fcport->flags &= ~(FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE); | ||
6728 | memset(&ea, 0, sizeof(ea)); | ||
6729 | @@ -1017,8 +1015,8 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res) | ||
6730 | spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); | ||
6731 | |||
6732 | list_for_each_entry_safe(fcport, tf, &h, gnl_entry) { | ||
6733 | - list_del_init(&fcport->gnl_entry); | ||
6734 | spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); | ||
6735 | + list_del_init(&fcport->gnl_entry); | ||
6736 | fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); | ||
6737 | spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); | ||
6738 | ea.fcport = fcport; | ||
6739 | diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c | ||
6740 | index 605b59c76c901..badd09c5dd429 100644 | ||
6741 | --- a/drivers/scsi/qla2xxx/qla_mr.c | ||
6742 | +++ b/drivers/scsi/qla2xxx/qla_mr.c | ||
6743 | @@ -740,29 +740,6 @@ qlafx00_lun_reset(fc_port_t *fcport, uint64_t l, int tag) | ||
6744 | return qla2x00_async_tm_cmd(fcport, TCF_LUN_RESET, l, tag); | ||
6745 | } | ||
6746 | |||
6747 | -int | ||
6748 | -qlafx00_loop_reset(scsi_qla_host_t *vha) | ||
6749 | -{ | ||
6750 | - int ret; | ||
6751 | - struct fc_port *fcport; | ||
6752 | - struct qla_hw_data *ha = vha->hw; | ||
6753 | - | ||
6754 | - if (ql2xtargetreset) { | ||
6755 | - list_for_each_entry(fcport, &vha->vp_fcports, list) { | ||
6756 | - if (fcport->port_type != FCT_TARGET) | ||
6757 | - continue; | ||
6758 | - | ||
6759 | - ret = ha->isp_ops->target_reset(fcport, 0, 0); | ||
6760 | - if (ret != QLA_SUCCESS) { | ||
6761 | - ql_dbg(ql_dbg_taskm, vha, 0x803d, | ||
6762 | - "Bus Reset failed: Reset=%d " | ||
6763 | - "d_id=%x.\n", ret, fcport->d_id.b24); | ||
6764 | - } | ||
6765 | - } | ||
6766 | - } | ||
6767 | - return QLA_SUCCESS; | ||
6768 | -} | ||
6769 | - | ||
6770 | int | ||
6771 | qlafx00_iospace_config(struct qla_hw_data *ha) | ||
6772 | { | ||
6773 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c | ||
6774 | index 28cbefe715e59..c1d4c964b0dd4 100644 | ||
6775 | --- a/drivers/scsi/qla2xxx/qla_os.c | ||
6776 | +++ b/drivers/scsi/qla2xxx/qla_os.c | ||
6777 | @@ -191,12 +191,6 @@ MODULE_PARM_DESC(ql2xdbwr, | ||
6778 | " 0 -- Regular doorbell.\n" | ||
6779 | " 1 -- CAMRAM doorbell (faster).\n"); | ||
6780 | |||
6781 | -int ql2xtargetreset = 1; | ||
6782 | -module_param(ql2xtargetreset, int, S_IRUGO); | ||
6783 | -MODULE_PARM_DESC(ql2xtargetreset, | ||
6784 | - "Enable target reset." | ||
6785 | - "Default is 1 - use hw defaults."); | ||
6786 | - | ||
6787 | int ql2xgffidenable; | ||
6788 | module_param(ql2xgffidenable, int, S_IRUGO); | ||
6789 | MODULE_PARM_DESC(ql2xgffidenable, | ||
6790 | @@ -1229,6 +1223,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | ||
6791 | uint32_t ratov_j; | ||
6792 | struct qla_qpair *qpair; | ||
6793 | unsigned long flags; | ||
6794 | + int fast_fail_status = SUCCESS; | ||
6795 | |||
6796 | if (qla2x00_isp_reg_stat(ha)) { | ||
6797 | ql_log(ql_log_info, vha, 0x8042, | ||
6798 | @@ -1236,15 +1231,16 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | ||
6799 | return FAILED; | ||
6800 | } | ||
6801 | |||
6802 | + /* Save any FAST_IO_FAIL value to return later if abort succeeds */ | ||
6803 | ret = fc_block_scsi_eh(cmd); | ||
6804 | if (ret != 0) | ||
6805 | - return ret; | ||
6806 | + fast_fail_status = ret; | ||
6807 | |||
6808 | sp = scsi_cmd_priv(cmd); | ||
6809 | qpair = sp->qpair; | ||
6810 | |||
6811 | if ((sp->fcport && sp->fcport->deleted) || !qpair) | ||
6812 | - return SUCCESS; | ||
6813 | + return fast_fail_status != SUCCESS ? fast_fail_status : FAILED; | ||
6814 | |||
6815 | spin_lock_irqsave(qpair->qp_lock_ptr, flags); | ||
6816 | if (sp->completed) { | ||
6817 | @@ -1290,7 +1286,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | ||
6818 | __func__, ha->r_a_tov/10); | ||
6819 | ret = FAILED; | ||
6820 | } else { | ||
6821 | - ret = SUCCESS; | ||
6822 | + ret = fast_fail_status; | ||
6823 | } | ||
6824 | break; | ||
6825 | default: | ||
6826 | @@ -1636,27 +1632,10 @@ int | ||
6827 | qla2x00_loop_reset(scsi_qla_host_t *vha) | ||
6828 | { | ||
6829 | int ret; | ||
6830 | - struct fc_port *fcport; | ||
6831 | struct qla_hw_data *ha = vha->hw; | ||
6832 | |||
6833 | - if (IS_QLAFX00(ha)) { | ||
6834 | - return qlafx00_loop_reset(vha); | ||
6835 | - } | ||
6836 | - | ||
6837 | - if (ql2xtargetreset == 1 && ha->flags.enable_target_reset) { | ||
6838 | - list_for_each_entry(fcport, &vha->vp_fcports, list) { | ||
6839 | - if (fcport->port_type != FCT_TARGET) | ||
6840 | - continue; | ||
6841 | - | ||
6842 | - ret = ha->isp_ops->target_reset(fcport, 0, 0); | ||
6843 | - if (ret != QLA_SUCCESS) { | ||
6844 | - ql_dbg(ql_dbg_taskm, vha, 0x802c, | ||
6845 | - "Bus Reset failed: Reset=%d " | ||
6846 | - "d_id=%x.\n", ret, fcport->d_id.b24); | ||
6847 | - } | ||
6848 | - } | ||
6849 | - } | ||
6850 | - | ||
6851 | + if (IS_QLAFX00(ha)) | ||
6852 | + return QLA_SUCCESS; | ||
6853 | |||
6854 | if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { | ||
6855 | atomic_set(&vha->loop_state, LOOP_DOWN); | ||
6856 | @@ -4064,7 +4043,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len, | ||
6857 | ql_dbg_pci(ql_dbg_init, ha->pdev, | ||
6858 | 0xe0ee, "%s: failed alloc dsd\n", | ||
6859 | __func__); | ||
6860 | - return 1; | ||
6861 | + return -ENOMEM; | ||
6862 | } | ||
6863 | ha->dif_bundle_kallocs++; | ||
6864 | |||
6865 | diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c | ||
6866 | index 57068e2faef54..0111c543f0e64 100644 | ||
6867 | --- a/drivers/scsi/qla2xxx/qla_target.c | ||
6868 | +++ b/drivers/scsi/qla2xxx/qla_target.c | ||
6869 | @@ -3251,8 +3251,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, | ||
6870 | "RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n", | ||
6871 | vha->flags.online, qla2x00_reset_active(vha), | ||
6872 | cmd->reset_count, qpair->chip_reset); | ||
6873 | - spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); | ||
6874 | - return 0; | ||
6875 | + goto out_unmap_unlock; | ||
6876 | } | ||
6877 | |||
6878 | /* Does F/W have an IOCBs for this request */ | ||
6879 | @@ -3375,10 +3374,6 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) | ||
6880 | prm.sg = NULL; | ||
6881 | prm.req_cnt = 1; | ||
6882 | |||
6883 | - /* Calculate number of entries and segments required */ | ||
6884 | - if (qlt_pci_map_calc_cnt(&prm) != 0) | ||
6885 | - return -EAGAIN; | ||
6886 | - | ||
6887 | if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || | ||
6888 | (cmd->sess && cmd->sess->deleted)) { | ||
6889 | /* | ||
6890 | @@ -3396,6 +3391,10 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) | ||
6891 | return 0; | ||
6892 | } | ||
6893 | |||
6894 | + /* Calculate number of entries and segments required */ | ||
6895 | + if (qlt_pci_map_calc_cnt(&prm) != 0) | ||
6896 | + return -EAGAIN; | ||
6897 | + | ||
6898 | spin_lock_irqsave(qpair->qp_lock_ptr, flags); | ||
6899 | /* Does F/W have an IOCBs for this request */ | ||
6900 | res = qlt_check_reserve_free_req(qpair, prm.req_cnt); | ||
6901 | @@ -3800,9 +3799,6 @@ void qlt_free_cmd(struct qla_tgt_cmd *cmd) | ||
6902 | |||
6903 | BUG_ON(cmd->cmd_in_wq); | ||
6904 | |||
6905 | - if (cmd->sg_mapped) | ||
6906 | - qlt_unmap_sg(cmd->vha, cmd); | ||
6907 | - | ||
6908 | if (!cmd->q_full) | ||
6909 | qlt_decr_num_pend_cmds(cmd->vha); | ||
6910 | |||
6911 | diff --git a/drivers/soc/fsl/dpaa2-console.c b/drivers/soc/fsl/dpaa2-console.c | ||
6912 | index 27243f706f376..53917410f2bdb 100644 | ||
6913 | --- a/drivers/soc/fsl/dpaa2-console.c | ||
6914 | +++ b/drivers/soc/fsl/dpaa2-console.c | ||
6915 | @@ -231,6 +231,7 @@ static ssize_t dpaa2_console_read(struct file *fp, char __user *buf, | ||
6916 | cd->cur_ptr += bytes; | ||
6917 | written += bytes; | ||
6918 | |||
6919 | + kfree(kbuf); | ||
6920 | return written; | ||
6921 | |||
6922 | err_free_buf: | ||
6923 | diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c | ||
6924 | index 0447afa970f5e..ab75f41e9c0c9 100644 | ||
6925 | --- a/drivers/soc/tegra/pmc.c | ||
6926 | +++ b/drivers/soc/tegra/pmc.c | ||
6927 | @@ -591,7 +591,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg, | ||
6928 | |||
6929 | err = reset_control_deassert(pg->reset); | ||
6930 | if (err) | ||
6931 | - goto powergate_off; | ||
6932 | + goto disable_clks; | ||
6933 | |||
6934 | usleep_range(10, 20); | ||
6935 | |||
6936 | diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c | ||
6937 | index 8a4be34bccfd2..8a1176efa4c85 100644 | ||
6938 | --- a/drivers/spi/spi-bcm-qspi.c | ||
6939 | +++ b/drivers/spi/spi-bcm-qspi.c | ||
6940 | @@ -1300,7 +1300,7 @@ int bcm_qspi_probe(struct platform_device *pdev, | ||
6941 | &qspi->dev_ids[val]); | ||
6942 | if (ret < 0) { | ||
6943 | dev_err(&pdev->dev, "IRQ %s not found\n", name); | ||
6944 | - goto qspi_probe_err; | ||
6945 | + goto qspi_unprepare_err; | ||
6946 | } | ||
6947 | |||
6948 | qspi->dev_ids[val].dev = qspi; | ||
6949 | @@ -1315,7 +1315,7 @@ int bcm_qspi_probe(struct platform_device *pdev, | ||
6950 | if (!num_ints) { | ||
6951 | dev_err(&pdev->dev, "no IRQs registered, cannot init driver\n"); | ||
6952 | ret = -EINVAL; | ||
6953 | - goto qspi_probe_err; | ||
6954 | + goto qspi_unprepare_err; | ||
6955 | } | ||
6956 | |||
6957 | /* | ||
6958 | @@ -1359,6 +1359,7 @@ int bcm_qspi_probe(struct platform_device *pdev, | ||
6959 | |||
6960 | qspi_reg_err: | ||
6961 | bcm_qspi_hw_uninit(qspi); | ||
6962 | +qspi_unprepare_err: | ||
6963 | clk_disable_unprepare(qspi->clk); | ||
6964 | qspi_probe_err: | ||
6965 | kfree(qspi->dev_ids); | ||
6966 | diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c | ||
6967 | index 7fedea67159c5..8523bb4f6a62e 100644 | ||
6968 | --- a/drivers/spi/spi-pl022.c | ||
6969 | +++ b/drivers/spi/spi-pl022.c | ||
6970 | @@ -1720,12 +1720,13 @@ static int verify_controller_parameters(struct pl022 *pl022, | ||
6971 | return -EINVAL; | ||
6972 | } | ||
6973 | } else { | ||
6974 | - if (chip_info->duplex != SSP_MICROWIRE_CHANNEL_FULL_DUPLEX) | ||
6975 | + if (chip_info->duplex != SSP_MICROWIRE_CHANNEL_FULL_DUPLEX) { | ||
6976 | dev_err(&pl022->adev->dev, | ||
6977 | "Microwire half duplex mode requested," | ||
6978 | " but this is only available in the" | ||
6979 | " ST version of PL022\n"); | ||
6980 | - return -EINVAL; | ||
6981 | + return -EINVAL; | ||
6982 | + } | ||
6983 | } | ||
6984 | } | ||
6985 | return 0; | ||
6986 | diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig | ||
6987 | index 0987fdc2f70db..8ea6c09286798 100644 | ||
6988 | --- a/drivers/staging/ks7010/Kconfig | ||
6989 | +++ b/drivers/staging/ks7010/Kconfig | ||
6990 | @@ -5,6 +5,9 @@ config KS7010 | ||
6991 | select WIRELESS_EXT | ||
6992 | select WEXT_PRIV | ||
6993 | select FW_LOADER | ||
6994 | + select CRYPTO | ||
6995 | + select CRYPTO_HASH | ||
6996 | + select CRYPTO_MICHAEL_MIC | ||
6997 | help | ||
6998 | This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is | ||
6999 | found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only, | ||
7000 | diff --git a/drivers/staging/media/imx/imx-media-dev-common.c b/drivers/staging/media/imx/imx-media-dev-common.c | ||
7001 | index 66b505f7e8dff..137e414cda186 100644 | ||
7002 | --- a/drivers/staging/media/imx/imx-media-dev-common.c | ||
7003 | +++ b/drivers/staging/media/imx/imx-media-dev-common.c | ||
7004 | @@ -373,6 +373,8 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev, | ||
7005 | imxmd->v4l2_dev.notify = imx_media_notify; | ||
7006 | strscpy(imxmd->v4l2_dev.name, "imx-media", | ||
7007 | sizeof(imxmd->v4l2_dev.name)); | ||
7008 | + snprintf(imxmd->md.bus_info, sizeof(imxmd->md.bus_info), | ||
7009 | + "platform:%s", dev_name(imxmd->md.dev)); | ||
7010 | |||
7011 | media_device_init(&imxmd->md); | ||
7012 | |||
7013 | diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c | ||
7014 | index 908ae74aa970d..53239ea67fe48 100644 | ||
7015 | --- a/drivers/staging/media/ipu3/ipu3-v4l2.c | ||
7016 | +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c | ||
7017 | @@ -594,11 +594,12 @@ static const struct imgu_fmt *find_format(struct v4l2_format *f, u32 type) | ||
7018 | static int imgu_vidioc_querycap(struct file *file, void *fh, | ||
7019 | struct v4l2_capability *cap) | ||
7020 | { | ||
7021 | - struct imgu_video_device *node = file_to_intel_imgu_node(file); | ||
7022 | + struct imgu_device *imgu = video_drvdata(file); | ||
7023 | |||
7024 | strscpy(cap->driver, IMGU_NAME, sizeof(cap->driver)); | ||
7025 | strscpy(cap->card, IMGU_NAME, sizeof(cap->card)); | ||
7026 | - snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", node->name); | ||
7027 | + snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", | ||
7028 | + pci_name(imgu->pci_dev)); | ||
7029 | |||
7030 | return 0; | ||
7031 | } | ||
7032 | @@ -695,7 +696,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node, | ||
7033 | |||
7034 | /* CSS expects some format on OUT queue */ | ||
7035 | if (i != IPU3_CSS_QUEUE_OUT && | ||
7036 | - !imgu_pipe->nodes[inode].enabled) { | ||
7037 | + !imgu_pipe->nodes[inode].enabled && !try) { | ||
7038 | fmts[i] = NULL; | ||
7039 | continue; | ||
7040 | } | ||
7041 | diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | ||
7042 | index c3cd6f389a989..2a369fdaf0cbb 100644 | ||
7043 | --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | ||
7044 | +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | ||
7045 | @@ -97,8 +97,7 @@ static void cfg_scan_result(enum scan_event scan_event, | ||
7046 | info->frame_len, | ||
7047 | (s32)info->rssi * 100, | ||
7048 | GFP_KERNEL); | ||
7049 | - if (!bss) | ||
7050 | - cfg80211_put_bss(wiphy, bss); | ||
7051 | + cfg80211_put_bss(wiphy, bss); | ||
7052 | } else if (scan_event == SCAN_EVENT_DONE) { | ||
7053 | mutex_lock(&priv->scan_req_lock); | ||
7054 | |||
7055 | diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c | ||
7056 | index 51a7d3b19b394..381c5117aec1b 100644 | ||
7057 | --- a/drivers/tty/serial/8250/8250_dw.c | ||
7058 | +++ b/drivers/tty/serial/8250/8250_dw.c | ||
7059 | @@ -660,7 +660,7 @@ static struct platform_driver dw8250_platform_driver = { | ||
7060 | .name = "dw-apb-uart", | ||
7061 | .pm = &dw8250_pm_ops, | ||
7062 | .of_match_table = dw8250_of_match, | ||
7063 | - .acpi_match_table = ACPI_PTR(dw8250_acpi_match), | ||
7064 | + .acpi_match_table = dw8250_acpi_match, | ||
7065 | }, | ||
7066 | .probe = dw8250_probe, | ||
7067 | .remove = dw8250_remove, | ||
7068 | diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c | ||
7069 | index fa3bd8a97b244..38ee13bbcab81 100644 | ||
7070 | --- a/drivers/tty/serial/serial_core.c | ||
7071 | +++ b/drivers/tty/serial/serial_core.c | ||
7072 | @@ -220,7 +220,11 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, | ||
7073 | if (retval == 0) { | ||
7074 | if (uart_console(uport) && uport->cons->cflag) { | ||
7075 | tty->termios.c_cflag = uport->cons->cflag; | ||
7076 | + tty->termios.c_ispeed = uport->cons->ispeed; | ||
7077 | + tty->termios.c_ospeed = uport->cons->ospeed; | ||
7078 | uport->cons->cflag = 0; | ||
7079 | + uport->cons->ispeed = 0; | ||
7080 | + uport->cons->ospeed = 0; | ||
7081 | } | ||
7082 | /* | ||
7083 | * Initialise the hardware port settings. | ||
7084 | @@ -288,8 +292,11 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) | ||
7085 | /* | ||
7086 | * Turn off DTR and RTS early. | ||
7087 | */ | ||
7088 | - if (uport && uart_console(uport) && tty) | ||
7089 | + if (uport && uart_console(uport) && tty) { | ||
7090 | uport->cons->cflag = tty->termios.c_cflag; | ||
7091 | + uport->cons->ispeed = tty->termios.c_ispeed; | ||
7092 | + uport->cons->ospeed = tty->termios.c_ospeed; | ||
7093 | + } | ||
7094 | |||
7095 | if (!tty || C_HUPCL(tty)) | ||
7096 | uart_port_dtr_rts(uport, 0); | ||
7097 | @@ -2110,8 +2117,11 @@ uart_set_options(struct uart_port *port, struct console *co, | ||
7098 | * Allow the setting of the UART parameters with a NULL console | ||
7099 | * too: | ||
7100 | */ | ||
7101 | - if (co) | ||
7102 | + if (co) { | ||
7103 | co->cflag = termios.c_cflag; | ||
7104 | + co->ispeed = termios.c_ispeed; | ||
7105 | + co->ospeed = termios.c_ospeed; | ||
7106 | + } | ||
7107 | |||
7108 | return 0; | ||
7109 | } | ||
7110 | @@ -2245,6 +2255,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) | ||
7111 | */ | ||
7112 | memset(&termios, 0, sizeof(struct ktermios)); | ||
7113 | termios.c_cflag = uport->cons->cflag; | ||
7114 | + termios.c_ispeed = uport->cons->ispeed; | ||
7115 | + termios.c_ospeed = uport->cons->ospeed; | ||
7116 | |||
7117 | /* | ||
7118 | * If that's unset, use the tty termios setting. | ||
7119 | diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c | ||
7120 | index 9359c80fbb9f5..a1409251fbcc3 100644 | ||
7121 | --- a/drivers/tty/serial/xilinx_uartps.c | ||
7122 | +++ b/drivers/tty/serial/xilinx_uartps.c | ||
7123 | @@ -595,9 +595,10 @@ static void cdns_uart_start_tx(struct uart_port *port) | ||
7124 | if (uart_circ_empty(&port->state->xmit)) | ||
7125 | return; | ||
7126 | |||
7127 | + writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR); | ||
7128 | + | ||
7129 | cdns_uart_handle_tx(port); | ||
7130 | |||
7131 | - writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR); | ||
7132 | /* Enable the TX Empty interrupt */ | ||
7133 | writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IER); | ||
7134 | } | ||
7135 | diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c | ||
7136 | index b7da2a273c451..74cdc7ef476ae 100644 | ||
7137 | --- a/drivers/usb/chipidea/core.c | ||
7138 | +++ b/drivers/usb/chipidea/core.c | ||
7139 | @@ -534,7 +534,7 @@ int hw_device_reset(struct ci_hdrc *ci) | ||
7140 | return 0; | ||
7141 | } | ||
7142 | |||
7143 | -static irqreturn_t ci_irq(int irq, void *data) | ||
7144 | +static irqreturn_t ci_irq_handler(int irq, void *data) | ||
7145 | { | ||
7146 | struct ci_hdrc *ci = data; | ||
7147 | irqreturn_t ret = IRQ_NONE; | ||
7148 | @@ -587,6 +587,15 @@ static irqreturn_t ci_irq(int irq, void *data) | ||
7149 | return ret; | ||
7150 | } | ||
7151 | |||
7152 | +static void ci_irq(struct ci_hdrc *ci) | ||
7153 | +{ | ||
7154 | + unsigned long flags; | ||
7155 | + | ||
7156 | + local_irq_save(flags); | ||
7157 | + ci_irq_handler(ci->irq, ci); | ||
7158 | + local_irq_restore(flags); | ||
7159 | +} | ||
7160 | + | ||
7161 | static int ci_cable_notifier(struct notifier_block *nb, unsigned long event, | ||
7162 | void *ptr) | ||
7163 | { | ||
7164 | @@ -596,7 +605,7 @@ static int ci_cable_notifier(struct notifier_block *nb, unsigned long event, | ||
7165 | cbl->connected = event; | ||
7166 | cbl->changed = true; | ||
7167 | |||
7168 | - ci_irq(ci->irq, ci); | ||
7169 | + ci_irq(ci); | ||
7170 | return NOTIFY_DONE; | ||
7171 | } | ||
7172 | |||
7173 | @@ -634,7 +643,7 @@ static int ci_usb_role_switch_set(struct device *dev, enum usb_role role) | ||
7174 | if (cable) { | ||
7175 | cable->changed = true; | ||
7176 | cable->connected = false; | ||
7177 | - ci_irq(ci->irq, ci); | ||
7178 | + ci_irq(ci); | ||
7179 | spin_unlock_irqrestore(&ci->lock, flags); | ||
7180 | if (ci->wq && role != USB_ROLE_NONE) | ||
7181 | flush_workqueue(ci->wq); | ||
7182 | @@ -652,7 +661,7 @@ static int ci_usb_role_switch_set(struct device *dev, enum usb_role role) | ||
7183 | if (cable) { | ||
7184 | cable->changed = true; | ||
7185 | cable->connected = true; | ||
7186 | - ci_irq(ci->irq, ci); | ||
7187 | + ci_irq(ci); | ||
7188 | } | ||
7189 | spin_unlock_irqrestore(&ci->lock, flags); | ||
7190 | pm_runtime_put_sync(ci->dev); | ||
7191 | @@ -1156,7 +1165,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | ||
7192 | } | ||
7193 | } | ||
7194 | |||
7195 | - ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, | ||
7196 | + ret = devm_request_irq(dev, ci->irq, ci_irq_handler, IRQF_SHARED, | ||
7197 | ci->platdata->name, ci); | ||
7198 | if (ret) | ||
7199 | goto stop; | ||
7200 | @@ -1277,11 +1286,11 @@ static void ci_extcon_wakeup_int(struct ci_hdrc *ci) | ||
7201 | |||
7202 | if (!IS_ERR(cable_id->edev) && ci->is_otg && | ||
7203 | (otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS)) | ||
7204 | - ci_irq(ci->irq, ci); | ||
7205 | + ci_irq(ci); | ||
7206 | |||
7207 | if (!IS_ERR(cable_vbus->edev) && ci->is_otg && | ||
7208 | (otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS)) | ||
7209 | - ci_irq(ci->irq, ci); | ||
7210 | + ci_irq(ci); | ||
7211 | } | ||
7212 | |||
7213 | static int ci_controller_resume(struct device *dev) | ||
7214 | diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c | ||
7215 | index 5b27d289443fe..3912cc805f3af 100644 | ||
7216 | --- a/drivers/usb/gadget/legacy/hid.c | ||
7217 | +++ b/drivers/usb/gadget/legacy/hid.c | ||
7218 | @@ -99,8 +99,10 @@ static int do_config(struct usb_configuration *c) | ||
7219 | |||
7220 | list_for_each_entry(e, &hidg_func_list, node) { | ||
7221 | e->f = usb_get_function(e->fi); | ||
7222 | - if (IS_ERR(e->f)) | ||
7223 | + if (IS_ERR(e->f)) { | ||
7224 | + status = PTR_ERR(e->f); | ||
7225 | goto put; | ||
7226 | + } | ||
7227 | status = usb_add_function(c, e->f); | ||
7228 | if (status < 0) { | ||
7229 | usb_put_function(e->f); | ||
7230 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c | ||
7231 | index 6358d4e0653ed..9a4260927ce31 100644 | ||
7232 | --- a/drivers/usb/host/xhci-hub.c | ||
7233 | +++ b/drivers/usb/host/xhci-hub.c | ||
7234 | @@ -171,7 +171,6 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci, | ||
7235 | { | ||
7236 | u16 temp; | ||
7237 | |||
7238 | - desc->bPwrOn2PwrGood = 10; /* xhci section 5.4.9 says 20ms max */ | ||
7239 | desc->bHubContrCurrent = 0; | ||
7240 | |||
7241 | desc->bNbrPorts = ports; | ||
7242 | @@ -206,6 +205,7 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | ||
7243 | desc->bDescriptorType = USB_DT_HUB; | ||
7244 | temp = 1 + (ports / 8); | ||
7245 | desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp; | ||
7246 | + desc->bPwrOn2PwrGood = 10; /* xhci section 5.4.8 says 20ms */ | ||
7247 | |||
7248 | /* The Device Removable bits are reported on a byte granularity. | ||
7249 | * If the port doesn't exist within that byte, the bit is set to 0. | ||
7250 | @@ -258,6 +258,7 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | ||
7251 | xhci_common_hub_descriptor(xhci, desc, ports); | ||
7252 | desc->bDescriptorType = USB_DT_SS_HUB; | ||
7253 | desc->bDescLength = USB_DT_SS_HUB_SIZE; | ||
7254 | + desc->bPwrOn2PwrGood = 50; /* usb 3.1 may fail if less than 100ms */ | ||
7255 | |||
7256 | /* header decode latency should be zero for roothubs, | ||
7257 | * see section 4.23.5.2. | ||
7258 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c | ||
7259 | index ae8fa4ff05ee3..beee3543950fe 100644 | ||
7260 | --- a/drivers/usb/host/xhci-pci.c | ||
7261 | +++ b/drivers/usb/host/xhci-pci.c | ||
7262 | @@ -59,6 +59,13 @@ | ||
7263 | #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba | ||
7264 | #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb | ||
7265 | #define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc | ||
7266 | +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 0x161a | ||
7267 | +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 0x161b | ||
7268 | +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 0x161d | ||
7269 | +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e | ||
7270 | +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6 | ||
7271 | +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7 | ||
7272 | + | ||
7273 | #define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042 | ||
7274 | #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 | ||
7275 | #define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242 | ||
7276 | @@ -290,6 +297,15 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | ||
7277 | pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) | ||
7278 | xhci->quirks |= XHCI_NO_SOFT_RETRY; | ||
7279 | |||
7280 | + if (pdev->vendor == PCI_VENDOR_ID_AMD && | ||
7281 | + (pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 || | ||
7282 | + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 || | ||
7283 | + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 || | ||
7284 | + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 || | ||
7285 | + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 || | ||
7286 | + pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6)) | ||
7287 | + xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; | ||
7288 | + | ||
7289 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | ||
7290 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | ||
7291 | "QUIRK: Resetting on resume"); | ||
7292 | diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c | ||
7293 | index 103c69c692bad..888defdea546f 100644 | ||
7294 | --- a/drivers/usb/misc/iowarrior.c | ||
7295 | +++ b/drivers/usb/misc/iowarrior.c | ||
7296 | @@ -99,10 +99,6 @@ struct iowarrior { | ||
7297 | /* globals */ | ||
7298 | /*--------------*/ | ||
7299 | |||
7300 | -/* | ||
7301 | - * USB spec identifies 5 second timeouts. | ||
7302 | - */ | ||
7303 | -#define GET_TIMEOUT 5 | ||
7304 | #define USB_REQ_GET_REPORT 0x01 | ||
7305 | //#if 0 | ||
7306 | static int usb_get_report(struct usb_device *dev, | ||
7307 | @@ -114,7 +110,7 @@ static int usb_get_report(struct usb_device *dev, | ||
7308 | USB_DIR_IN | USB_TYPE_CLASS | | ||
7309 | USB_RECIP_INTERFACE, (type << 8) + id, | ||
7310 | inter->desc.bInterfaceNumber, buf, size, | ||
7311 | - GET_TIMEOUT*HZ); | ||
7312 | + USB_CTRL_GET_TIMEOUT); | ||
7313 | } | ||
7314 | //#endif | ||
7315 | |||
7316 | @@ -129,7 +125,7 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type, | ||
7317 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
7318 | (type << 8) + id, | ||
7319 | intf->cur_altsetting->desc.bInterfaceNumber, buf, | ||
7320 | - size, HZ); | ||
7321 | + size, 1000); | ||
7322 | } | ||
7323 | |||
7324 | /*---------------------*/ | ||
7325 | diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c | ||
7326 | index aa3dbce22cfbe..451759f38b573 100644 | ||
7327 | --- a/drivers/usb/serial/keyspan.c | ||
7328 | +++ b/drivers/usb/serial/keyspan.c | ||
7329 | @@ -2910,22 +2910,22 @@ static int keyspan_port_probe(struct usb_serial_port *port) | ||
7330 | for (i = 0; i < ARRAY_SIZE(p_priv->in_buffer); ++i) { | ||
7331 | p_priv->in_buffer[i] = kzalloc(IN_BUFLEN, GFP_KERNEL); | ||
7332 | if (!p_priv->in_buffer[i]) | ||
7333 | - goto err_in_buffer; | ||
7334 | + goto err_free_in_buffer; | ||
7335 | } | ||
7336 | |||
7337 | for (i = 0; i < ARRAY_SIZE(p_priv->out_buffer); ++i) { | ||
7338 | p_priv->out_buffer[i] = kzalloc(OUT_BUFLEN, GFP_KERNEL); | ||
7339 | if (!p_priv->out_buffer[i]) | ||
7340 | - goto err_out_buffer; | ||
7341 | + goto err_free_out_buffer; | ||
7342 | } | ||
7343 | |||
7344 | p_priv->inack_buffer = kzalloc(INACK_BUFLEN, GFP_KERNEL); | ||
7345 | if (!p_priv->inack_buffer) | ||
7346 | - goto err_inack_buffer; | ||
7347 | + goto err_free_out_buffer; | ||
7348 | |||
7349 | p_priv->outcont_buffer = kzalloc(OUTCONT_BUFLEN, GFP_KERNEL); | ||
7350 | if (!p_priv->outcont_buffer) | ||
7351 | - goto err_outcont_buffer; | ||
7352 | + goto err_free_inack_buffer; | ||
7353 | |||
7354 | p_priv->device_details = d_details; | ||
7355 | |||
7356 | @@ -2971,15 +2971,14 @@ static int keyspan_port_probe(struct usb_serial_port *port) | ||
7357 | |||
7358 | return 0; | ||
7359 | |||
7360 | -err_outcont_buffer: | ||
7361 | +err_free_inack_buffer: | ||
7362 | kfree(p_priv->inack_buffer); | ||
7363 | -err_inack_buffer: | ||
7364 | +err_free_out_buffer: | ||
7365 | for (i = 0; i < ARRAY_SIZE(p_priv->out_buffer); ++i) | ||
7366 | kfree(p_priv->out_buffer[i]); | ||
7367 | -err_out_buffer: | ||
7368 | +err_free_in_buffer: | ||
7369 | for (i = 0; i < ARRAY_SIZE(p_priv->in_buffer); ++i) | ||
7370 | kfree(p_priv->in_buffer[i]); | ||
7371 | -err_in_buffer: | ||
7372 | kfree(p_priv); | ||
7373 | |||
7374 | return -ENOMEM; | ||
7375 | diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c | ||
7376 | index cac3e35d76308..813a264a1b119 100644 | ||
7377 | --- a/drivers/video/backlight/backlight.c | ||
7378 | +++ b/drivers/video/backlight/backlight.c | ||
7379 | @@ -630,12 +630,6 @@ struct backlight_device *of_find_backlight(struct device *dev) | ||
7380 | of_node_put(np); | ||
7381 | if (!bd) | ||
7382 | return ERR_PTR(-EPROBE_DEFER); | ||
7383 | - /* | ||
7384 | - * Note: gpio_backlight uses brightness as | ||
7385 | - * power state during probe | ||
7386 | - */ | ||
7387 | - if (!bd->props.brightness) | ||
7388 | - bd->props.brightness = bd->props.max_brightness; | ||
7389 | } | ||
7390 | } | ||
7391 | |||
7392 | diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c | ||
7393 | index f4dc320dcafe2..80fdd3ee0565f 100644 | ||
7394 | --- a/drivers/video/fbdev/chipsfb.c | ||
7395 | +++ b/drivers/video/fbdev/chipsfb.c | ||
7396 | @@ -331,7 +331,7 @@ static const struct fb_var_screeninfo chipsfb_var = { | ||
7397 | |||
7398 | static void init_chips(struct fb_info *p, unsigned long addr) | ||
7399 | { | ||
7400 | - memset(p->screen_base, 0, 0x100000); | ||
7401 | + fb_memset(p->screen_base, 0, 0x100000); | ||
7402 | |||
7403 | p->fix = chipsfb_fix; | ||
7404 | p->fix.smem_start = addr; | ||
7405 | diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig | ||
7406 | index 1aa42e879e633..3fabd4177b0ee 100644 | ||
7407 | --- a/drivers/watchdog/Kconfig | ||
7408 | +++ b/drivers/watchdog/Kconfig | ||
7409 | @@ -1682,7 +1682,7 @@ config SIBYTE_WDOG | ||
7410 | |||
7411 | config AR7_WDT | ||
7412 | tristate "TI AR7 Watchdog Timer" | ||
7413 | - depends on AR7 || (MIPS && COMPILE_TEST) | ||
7414 | + depends on AR7 || (MIPS && 32BIT && COMPILE_TEST) | ||
7415 | help | ||
7416 | Hardware driver for the TI AR7 Watchdog Timer. | ||
7417 | |||
7418 | diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c | ||
7419 | index 893cef70c1599..aa57498009c34 100644 | ||
7420 | --- a/drivers/watchdog/f71808e_wdt.c | ||
7421 | +++ b/drivers/watchdog/f71808e_wdt.c | ||
7422 | @@ -228,15 +228,17 @@ static int watchdog_set_timeout(int timeout) | ||
7423 | |||
7424 | mutex_lock(&watchdog.lock); | ||
7425 | |||
7426 | - watchdog.timeout = timeout; | ||
7427 | if (timeout > 0xff) { | ||
7428 | watchdog.timer_val = DIV_ROUND_UP(timeout, 60); | ||
7429 | watchdog.minutes_mode = true; | ||
7430 | + timeout = watchdog.timer_val * 60; | ||
7431 | } else { | ||
7432 | watchdog.timer_val = timeout; | ||
7433 | watchdog.minutes_mode = false; | ||
7434 | } | ||
7435 | |||
7436 | + watchdog.timeout = timeout; | ||
7437 | + | ||
7438 | mutex_unlock(&watchdog.lock); | ||
7439 | |||
7440 | return 0; | ||
7441 | diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c | ||
7442 | index 9b91882fe3c41..6d7ccbc0b666c 100644 | ||
7443 | --- a/drivers/watchdog/omap_wdt.c | ||
7444 | +++ b/drivers/watchdog/omap_wdt.c | ||
7445 | @@ -268,8 +268,12 @@ static int omap_wdt_probe(struct platform_device *pdev) | ||
7446 | wdev->wdog.bootstatus = WDIOF_CARDRESET; | ||
7447 | } | ||
7448 | |||
7449 | - if (!early_enable) | ||
7450 | + if (early_enable) { | ||
7451 | + omap_wdt_start(&wdev->wdog); | ||
7452 | + set_bit(WDOG_HW_RUNNING, &wdev->wdog.status); | ||
7453 | + } else { | ||
7454 | omap_wdt_disable(wdev); | ||
7455 | + } | ||
7456 | |||
7457 | ret = watchdog_register_device(&wdev->wdog); | ||
7458 | if (ret) { | ||
7459 | diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c | ||
7460 | index 07f362c63ae90..39bbb127852f9 100644 | ||
7461 | --- a/drivers/xen/balloon.c | ||
7462 | +++ b/drivers/xen/balloon.c | ||
7463 | @@ -58,6 +58,7 @@ | ||
7464 | #include <linux/percpu-defs.h> | ||
7465 | #include <linux/slab.h> | ||
7466 | #include <linux/sysctl.h> | ||
7467 | +#include <linux/moduleparam.h> | ||
7468 | |||
7469 | #include <asm/page.h> | ||
7470 | #include <asm/pgalloc.h> | ||
7471 | @@ -75,6 +76,12 @@ | ||
7472 | #include <xen/page.h> | ||
7473 | #include <xen/mem-reservation.h> | ||
7474 | |||
7475 | +#undef MODULE_PARAM_PREFIX | ||
7476 | +#define MODULE_PARAM_PREFIX "xen." | ||
7477 | + | ||
7478 | +static uint __read_mostly balloon_boot_timeout = 180; | ||
7479 | +module_param(balloon_boot_timeout, uint, 0444); | ||
7480 | + | ||
7481 | static int xen_hotplug_unpopulated; | ||
7482 | |||
7483 | #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG | ||
7484 | @@ -127,12 +134,12 @@ static struct ctl_table xen_root[] = { | ||
7485 | * BP_ECANCELED: error, balloon operation canceled. | ||
7486 | */ | ||
7487 | |||
7488 | -enum bp_state { | ||
7489 | +static enum bp_state { | ||
7490 | BP_DONE, | ||
7491 | BP_WAIT, | ||
7492 | BP_EAGAIN, | ||
7493 | BP_ECANCELED | ||
7494 | -}; | ||
7495 | +} balloon_state = BP_DONE; | ||
7496 | |||
7497 | /* Main waiting point for xen-balloon thread. */ | ||
7498 | static DECLARE_WAIT_QUEUE_HEAD(balloon_thread_wq); | ||
7499 | @@ -201,18 +208,15 @@ static struct page *balloon_next_page(struct page *page) | ||
7500 | return list_entry(next, struct page, lru); | ||
7501 | } | ||
7502 | |||
7503 | -static enum bp_state update_schedule(enum bp_state state) | ||
7504 | +static void update_schedule(void) | ||
7505 | { | ||
7506 | - if (state == BP_WAIT) | ||
7507 | - return BP_WAIT; | ||
7508 | - | ||
7509 | - if (state == BP_ECANCELED) | ||
7510 | - return BP_ECANCELED; | ||
7511 | + if (balloon_state == BP_WAIT || balloon_state == BP_ECANCELED) | ||
7512 | + return; | ||
7513 | |||
7514 | - if (state == BP_DONE) { | ||
7515 | + if (balloon_state == BP_DONE) { | ||
7516 | balloon_stats.schedule_delay = 1; | ||
7517 | balloon_stats.retry_count = 1; | ||
7518 | - return BP_DONE; | ||
7519 | + return; | ||
7520 | } | ||
7521 | |||
7522 | ++balloon_stats.retry_count; | ||
7523 | @@ -221,7 +225,8 @@ static enum bp_state update_schedule(enum bp_state state) | ||
7524 | balloon_stats.retry_count > balloon_stats.max_retry_count) { | ||
7525 | balloon_stats.schedule_delay = 1; | ||
7526 | balloon_stats.retry_count = 1; | ||
7527 | - return BP_ECANCELED; | ||
7528 | + balloon_state = BP_ECANCELED; | ||
7529 | + return; | ||
7530 | } | ||
7531 | |||
7532 | balloon_stats.schedule_delay <<= 1; | ||
7533 | @@ -229,7 +234,7 @@ static enum bp_state update_schedule(enum bp_state state) | ||
7534 | if (balloon_stats.schedule_delay > balloon_stats.max_schedule_delay) | ||
7535 | balloon_stats.schedule_delay = balloon_stats.max_schedule_delay; | ||
7536 | |||
7537 | - return BP_EAGAIN; | ||
7538 | + balloon_state = BP_EAGAIN; | ||
7539 | } | ||
7540 | |||
7541 | #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG | ||
7542 | @@ -511,9 +516,9 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | ||
7543 | * Stop waiting if either state is BP_DONE and ballooning action is | ||
7544 | * needed, or if the credit has changed while state is not BP_DONE. | ||
7545 | */ | ||
7546 | -static bool balloon_thread_cond(enum bp_state state, long credit) | ||
7547 | +static bool balloon_thread_cond(long credit) | ||
7548 | { | ||
7549 | - if (state == BP_DONE) | ||
7550 | + if (balloon_state == BP_DONE) | ||
7551 | credit = 0; | ||
7552 | |||
7553 | return current_credit() != credit || kthread_should_stop(); | ||
7554 | @@ -527,13 +532,12 @@ static bool balloon_thread_cond(enum bp_state state, long credit) | ||
7555 | */ | ||
7556 | static int balloon_thread(void *unused) | ||
7557 | { | ||
7558 | - enum bp_state state = BP_DONE; | ||
7559 | long credit; | ||
7560 | unsigned long timeout; | ||
7561 | |||
7562 | set_freezable(); | ||
7563 | for (;;) { | ||
7564 | - switch (state) { | ||
7565 | + switch (balloon_state) { | ||
7566 | case BP_DONE: | ||
7567 | case BP_ECANCELED: | ||
7568 | timeout = 3600 * HZ; | ||
7569 | @@ -549,7 +553,7 @@ static int balloon_thread(void *unused) | ||
7570 | credit = current_credit(); | ||
7571 | |||
7572 | wait_event_freezable_timeout(balloon_thread_wq, | ||
7573 | - balloon_thread_cond(state, credit), timeout); | ||
7574 | + balloon_thread_cond(credit), timeout); | ||
7575 | |||
7576 | if (kthread_should_stop()) | ||
7577 | return 0; | ||
7578 | @@ -560,22 +564,23 @@ static int balloon_thread(void *unused) | ||
7579 | |||
7580 | if (credit > 0) { | ||
7581 | if (balloon_is_inflated()) | ||
7582 | - state = increase_reservation(credit); | ||
7583 | + balloon_state = increase_reservation(credit); | ||
7584 | else | ||
7585 | - state = reserve_additional_memory(); | ||
7586 | + balloon_state = reserve_additional_memory(); | ||
7587 | } | ||
7588 | |||
7589 | if (credit < 0) { | ||
7590 | long n_pages; | ||
7591 | |||
7592 | n_pages = min(-credit, si_mem_available()); | ||
7593 | - state = decrease_reservation(n_pages, GFP_BALLOON); | ||
7594 | - if (state == BP_DONE && n_pages != -credit && | ||
7595 | + balloon_state = decrease_reservation(n_pages, | ||
7596 | + GFP_BALLOON); | ||
7597 | + if (balloon_state == BP_DONE && n_pages != -credit && | ||
7598 | n_pages < totalreserve_pages) | ||
7599 | - state = BP_EAGAIN; | ||
7600 | + balloon_state = BP_EAGAIN; | ||
7601 | } | ||
7602 | |||
7603 | - state = update_schedule(state); | ||
7604 | + update_schedule(); | ||
7605 | |||
7606 | mutex_unlock(&balloon_mutex); | ||
7607 | |||
7608 | @@ -782,3 +787,38 @@ static int __init balloon_init(void) | ||
7609 | return 0; | ||
7610 | } | ||
7611 | subsys_initcall(balloon_init); | ||
7612 | + | ||
7613 | +static int __init balloon_wait_finish(void) | ||
7614 | +{ | ||
7615 | + long credit, last_credit = 0; | ||
7616 | + unsigned long last_changed = 0; | ||
7617 | + | ||
7618 | + if (!xen_domain()) | ||
7619 | + return -ENODEV; | ||
7620 | + | ||
7621 | + /* PV guests don't need to wait. */ | ||
7622 | + if (xen_pv_domain() || !current_credit()) | ||
7623 | + return 0; | ||
7624 | + | ||
7625 | + pr_notice("Waiting for initial ballooning down having finished.\n"); | ||
7626 | + | ||
7627 | + while ((credit = current_credit()) < 0) { | ||
7628 | + if (credit != last_credit) { | ||
7629 | + last_changed = jiffies; | ||
7630 | + last_credit = credit; | ||
7631 | + } | ||
7632 | + if (balloon_state == BP_ECANCELED) { | ||
7633 | + pr_warn_once("Initial ballooning failed, %ld pages need to be freed.\n", | ||
7634 | + -credit); | ||
7635 | + if (jiffies - last_changed >= HZ * balloon_boot_timeout) | ||
7636 | + panic("Initial ballooning failed!\n"); | ||
7637 | + } | ||
7638 | + | ||
7639 | + schedule_timeout_interruptible(HZ / 10); | ||
7640 | + } | ||
7641 | + | ||
7642 | + pr_notice("Initial ballooning down finished.\n"); | ||
7643 | + | ||
7644 | + return 0; | ||
7645 | +} | ||
7646 | +late_initcall_sync(balloon_wait_finish); | ||
7647 | diff --git a/drivers/xen/xen-pciback/conf_space_capability.c b/drivers/xen/xen-pciback/conf_space_capability.c | ||
7648 | index e5694133ebe57..42f0f64fcba47 100644 | ||
7649 | --- a/drivers/xen/xen-pciback/conf_space_capability.c | ||
7650 | +++ b/drivers/xen/xen-pciback/conf_space_capability.c | ||
7651 | @@ -160,7 +160,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset) | ||
7652 | } | ||
7653 | |||
7654 | out: | ||
7655 | - return ERR_PTR(err); | ||
7656 | + return err ? ERR_PTR(err) : NULL; | ||
7657 | } | ||
7658 | |||
7659 | static const struct config_field caplist_pm[] = { | ||
7660 | diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c | ||
7661 | index 946ae198b3449..1499531bc1511 100644 | ||
7662 | --- a/fs/btrfs/disk-io.c | ||
7663 | +++ b/fs/btrfs/disk-io.c | ||
7664 | @@ -3145,7 +3145,8 @@ retry_root_backup: | ||
7665 | goto fail_sysfs; | ||
7666 | } | ||
7667 | |||
7668 | - if (!sb_rdonly(sb) && !btrfs_check_rw_degradable(fs_info, NULL)) { | ||
7669 | + if (!sb_rdonly(sb) && fs_info->fs_devices->missing_devices && | ||
7670 | + !btrfs_check_rw_degradable(fs_info, NULL)) { | ||
7671 | btrfs_warn(fs_info, | ||
7672 | "writable mount is not allowed due to too many missing devices"); | ||
7673 | goto fail_sysfs; | ||
7674 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c | ||
7675 | index f342055699870..7bc4477d7ee7d 100644 | ||
7676 | --- a/fs/btrfs/tree-log.c | ||
7677 | +++ b/fs/btrfs/tree-log.c | ||
7678 | @@ -2490,7 +2490,9 @@ again: | ||
7679 | else { | ||
7680 | ret = find_dir_range(log, path, dirid, key_type, | ||
7681 | &range_start, &range_end); | ||
7682 | - if (ret != 0) | ||
7683 | + if (ret < 0) | ||
7684 | + goto out; | ||
7685 | + else if (ret > 0) | ||
7686 | break; | ||
7687 | } | ||
7688 | |||
7689 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c | ||
7690 | index f302bbb93f32c..344d18de1f08c 100644 | ||
7691 | --- a/fs/btrfs/volumes.c | ||
7692 | +++ b/fs/btrfs/volumes.c | ||
7693 | @@ -1315,8 +1315,10 @@ static void btrfs_close_one_device(struct btrfs_device *device) | ||
7694 | if (device->devid == BTRFS_DEV_REPLACE_DEVID) | ||
7695 | clear_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state); | ||
7696 | |||
7697 | - if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) | ||
7698 | + if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) { | ||
7699 | + clear_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state); | ||
7700 | fs_devices->missing_devices--; | ||
7701 | + } | ||
7702 | |||
7703 | btrfs_close_bdev(device); | ||
7704 | |||
7705 | @@ -2160,8 +2162,11 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, | ||
7706 | u64 num_devices; | ||
7707 | int ret = 0; | ||
7708 | |||
7709 | - mutex_lock(&uuid_mutex); | ||
7710 | - | ||
7711 | + /* | ||
7712 | + * The device list in fs_devices is accessed without locks (neither | ||
7713 | + * uuid_mutex nor device_list_mutex) as it won't change on a mounted | ||
7714 | + * filesystem and another device rm cannot run. | ||
7715 | + */ | ||
7716 | num_devices = btrfs_num_devices(fs_info); | ||
7717 | |||
7718 | ret = btrfs_check_raid_min_devices(fs_info, num_devices - 1); | ||
7719 | @@ -2205,11 +2210,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, | ||
7720 | mutex_unlock(&fs_info->chunk_mutex); | ||
7721 | } | ||
7722 | |||
7723 | - mutex_unlock(&uuid_mutex); | ||
7724 | ret = btrfs_shrink_device(device, 0); | ||
7725 | if (!ret) | ||
7726 | btrfs_reada_remove_dev(device); | ||
7727 | - mutex_lock(&uuid_mutex); | ||
7728 | if (ret) | ||
7729 | goto error_undo; | ||
7730 | |||
7731 | @@ -2291,7 +2294,6 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, | ||
7732 | } | ||
7733 | |||
7734 | out: | ||
7735 | - mutex_unlock(&uuid_mutex); | ||
7736 | return ret; | ||
7737 | |||
7738 | error_undo: | ||
7739 | diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c | ||
7740 | index 502bd491336a8..2383d52b1f424 100644 | ||
7741 | --- a/fs/f2fs/inode.c | ||
7742 | +++ b/fs/f2fs/inode.c | ||
7743 | @@ -455,7 +455,7 @@ make_now: | ||
7744 | inode->i_op = &f2fs_dir_inode_operations; | ||
7745 | inode->i_fop = &f2fs_dir_operations; | ||
7746 | inode->i_mapping->a_ops = &f2fs_dblock_aops; | ||
7747 | - inode_nohighmem(inode); | ||
7748 | + mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); | ||
7749 | } else if (S_ISLNK(inode->i_mode)) { | ||
7750 | if (file_is_encrypt(inode)) | ||
7751 | inode->i_op = &f2fs_encrypted_symlink_inode_operations; | ||
7752 | diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c | ||
7753 | index 81a18ba18e301..ed95c27e93026 100644 | ||
7754 | --- a/fs/f2fs/namei.c | ||
7755 | +++ b/fs/f2fs/namei.c | ||
7756 | @@ -679,7 +679,7 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | ||
7757 | inode->i_op = &f2fs_dir_inode_operations; | ||
7758 | inode->i_fop = &f2fs_dir_operations; | ||
7759 | inode->i_mapping->a_ops = &f2fs_dblock_aops; | ||
7760 | - inode_nohighmem(inode); | ||
7761 | + mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); | ||
7762 | |||
7763 | set_inode_flag(inode, FI_INC_LINK); | ||
7764 | f2fs_lock_op(sbi); | ||
7765 | diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c | ||
7766 | index 7205a89fbb5f3..fa4d2aba5a701 100644 | ||
7767 | --- a/fs/fuse/dev.c | ||
7768 | +++ b/fs/fuse/dev.c | ||
7769 | @@ -839,6 +839,12 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) | ||
7770 | goto out_put_old; | ||
7771 | } | ||
7772 | |||
7773 | + /* | ||
7774 | + * Release while we have extra ref on stolen page. Otherwise | ||
7775 | + * anon_pipe_buf_release() might think the page can be reused. | ||
7776 | + */ | ||
7777 | + pipe_buf_release(cs->pipe, buf); | ||
7778 | + | ||
7779 | get_page(newpage); | ||
7780 | |||
7781 | if (!(buf->flags & PIPE_BUF_FLAG_LRU)) | ||
7782 | @@ -2027,8 +2033,12 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, | ||
7783 | |||
7784 | pipe_lock(pipe); | ||
7785 | out_free: | ||
7786 | - for (idx = 0; idx < nbuf; idx++) | ||
7787 | - pipe_buf_release(pipe, &bufs[idx]); | ||
7788 | + for (idx = 0; idx < nbuf; idx++) { | ||
7789 | + struct pipe_buffer *buf = &bufs[idx]; | ||
7790 | + | ||
7791 | + if (buf->ops) | ||
7792 | + pipe_buf_release(pipe, buf); | ||
7793 | + } | ||
7794 | pipe_unlock(pipe); | ||
7795 | |||
7796 | kvfree(bufs); | ||
7797 | diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c | ||
7798 | index 616de103dccc5..d41733540df91 100644 | ||
7799 | --- a/fs/jfs/jfs_mount.c | ||
7800 | +++ b/fs/jfs/jfs_mount.c | ||
7801 | @@ -80,14 +80,14 @@ int jfs_mount(struct super_block *sb) | ||
7802 | * (initialize mount inode from the superblock) | ||
7803 | */ | ||
7804 | if ((rc = chkSuper(sb))) { | ||
7805 | - goto errout20; | ||
7806 | + goto out; | ||
7807 | } | ||
7808 | |||
7809 | ipaimap = diReadSpecial(sb, AGGREGATE_I, 0); | ||
7810 | if (ipaimap == NULL) { | ||
7811 | jfs_err("jfs_mount: Failed to read AGGREGATE_I"); | ||
7812 | rc = -EIO; | ||
7813 | - goto errout20; | ||
7814 | + goto out; | ||
7815 | } | ||
7816 | sbi->ipaimap = ipaimap; | ||
7817 | |||
7818 | @@ -98,7 +98,7 @@ int jfs_mount(struct super_block *sb) | ||
7819 | */ | ||
7820 | if ((rc = diMount(ipaimap))) { | ||
7821 | jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc); | ||
7822 | - goto errout21; | ||
7823 | + goto err_ipaimap; | ||
7824 | } | ||
7825 | |||
7826 | /* | ||
7827 | @@ -107,7 +107,7 @@ int jfs_mount(struct super_block *sb) | ||
7828 | ipbmap = diReadSpecial(sb, BMAP_I, 0); | ||
7829 | if (ipbmap == NULL) { | ||
7830 | rc = -EIO; | ||
7831 | - goto errout22; | ||
7832 | + goto err_umount_ipaimap; | ||
7833 | } | ||
7834 | |||
7835 | jfs_info("jfs_mount: ipbmap:0x%p", ipbmap); | ||
7836 | @@ -119,7 +119,7 @@ int jfs_mount(struct super_block *sb) | ||
7837 | */ | ||
7838 | if ((rc = dbMount(ipbmap))) { | ||
7839 | jfs_err("jfs_mount: dbMount failed w/rc = %d", rc); | ||
7840 | - goto errout22; | ||
7841 | + goto err_ipbmap; | ||
7842 | } | ||
7843 | |||
7844 | /* | ||
7845 | @@ -138,7 +138,7 @@ int jfs_mount(struct super_block *sb) | ||
7846 | if (!ipaimap2) { | ||
7847 | jfs_err("jfs_mount: Failed to read AGGREGATE_I"); | ||
7848 | rc = -EIO; | ||
7849 | - goto errout35; | ||
7850 | + goto err_umount_ipbmap; | ||
7851 | } | ||
7852 | sbi->ipaimap2 = ipaimap2; | ||
7853 | |||
7854 | @@ -150,7 +150,7 @@ int jfs_mount(struct super_block *sb) | ||
7855 | if ((rc = diMount(ipaimap2))) { | ||
7856 | jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d", | ||
7857 | rc); | ||
7858 | - goto errout35; | ||
7859 | + goto err_ipaimap2; | ||
7860 | } | ||
7861 | } else | ||
7862 | /* Secondary aggregate inode table is not valid */ | ||
7863 | @@ -167,7 +167,7 @@ int jfs_mount(struct super_block *sb) | ||
7864 | jfs_err("jfs_mount: Failed to read FILESYSTEM_I"); | ||
7865 | /* open fileset secondary inode allocation map */ | ||
7866 | rc = -EIO; | ||
7867 | - goto errout40; | ||
7868 | + goto err_umount_ipaimap2; | ||
7869 | } | ||
7870 | jfs_info("jfs_mount: ipimap:0x%p", ipimap); | ||
7871 | |||
7872 | @@ -177,41 +177,34 @@ int jfs_mount(struct super_block *sb) | ||
7873 | /* initialize fileset inode allocation map */ | ||
7874 | if ((rc = diMount(ipimap))) { | ||
7875 | jfs_err("jfs_mount: diMount failed w/rc = %d", rc); | ||
7876 | - goto errout41; | ||
7877 | + goto err_ipimap; | ||
7878 | } | ||
7879 | |||
7880 | - goto out; | ||
7881 | + return rc; | ||
7882 | |||
7883 | /* | ||
7884 | * unwind on error | ||
7885 | */ | ||
7886 | - errout41: /* close fileset inode allocation map inode */ | ||
7887 | +err_ipimap: | ||
7888 | + /* close fileset inode allocation map inode */ | ||
7889 | diFreeSpecial(ipimap); | ||
7890 | - | ||
7891 | - errout40: /* fileset closed */ | ||
7892 | - | ||
7893 | +err_umount_ipaimap2: | ||
7894 | /* close secondary aggregate inode allocation map */ | ||
7895 | - if (ipaimap2) { | ||
7896 | + if (ipaimap2) | ||
7897 | diUnmount(ipaimap2, 1); | ||
7898 | +err_ipaimap2: | ||
7899 | + /* close aggregate inodes */ | ||
7900 | + if (ipaimap2) | ||
7901 | diFreeSpecial(ipaimap2); | ||
7902 | - } | ||
7903 | - | ||
7904 | - errout35: | ||
7905 | - | ||
7906 | - /* close aggregate block allocation map */ | ||
7907 | +err_umount_ipbmap: /* close aggregate block allocation map */ | ||
7908 | dbUnmount(ipbmap, 1); | ||
7909 | +err_ipbmap: /* close aggregate inodes */ | ||
7910 | diFreeSpecial(ipbmap); | ||
7911 | - | ||
7912 | - errout22: /* close aggregate inode allocation map */ | ||
7913 | - | ||
7914 | +err_umount_ipaimap: /* close aggregate inode allocation map */ | ||
7915 | diUnmount(ipaimap, 1); | ||
7916 | - | ||
7917 | - errout21: /* close aggregate inodes */ | ||
7918 | +err_ipaimap: /* close aggregate inodes */ | ||
7919 | diFreeSpecial(ipaimap); | ||
7920 | - errout20: /* aggregate closed */ | ||
7921 | - | ||
7922 | - out: | ||
7923 | - | ||
7924 | +out: | ||
7925 | if (rc) | ||
7926 | jfs_err("Mount JFS Failure: %d", rc); | ||
7927 | |||
7928 | diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c | ||
7929 | index 3eda40a320a53..1f12297109b41 100644 | ||
7930 | --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c | ||
7931 | +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c | ||
7932 | @@ -378,10 +378,10 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, | ||
7933 | goto noconnect; | ||
7934 | |||
7935 | ds = mirror->mirror_ds->ds; | ||
7936 | + if (READ_ONCE(ds->ds_clp)) | ||
7937 | + goto out; | ||
7938 | /* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ | ||
7939 | smp_rmb(); | ||
7940 | - if (ds->ds_clp) | ||
7941 | - goto out; | ||
7942 | |||
7943 | /* FIXME: For now we assume the server sent only one version of NFS | ||
7944 | * to use for the DS. | ||
7945 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c | ||
7946 | index 5ecaf7b6b0fa1..fb3d1532f11dd 100644 | ||
7947 | --- a/fs/nfs/nfs4proc.c | ||
7948 | +++ b/fs/nfs/nfs4proc.c | ||
7949 | @@ -1549,15 +1549,16 @@ static bool nfs_stateid_is_sequential(struct nfs4_state *state, | ||
7950 | { | ||
7951 | if (test_bit(NFS_OPEN_STATE, &state->flags)) { | ||
7952 | /* The common case - we're updating to a new sequence number */ | ||
7953 | - if (nfs4_stateid_match_other(stateid, &state->open_stateid) && | ||
7954 | - nfs4_stateid_is_next(&state->open_stateid, stateid)) { | ||
7955 | - return true; | ||
7956 | + if (nfs4_stateid_match_other(stateid, &state->open_stateid)) { | ||
7957 | + if (nfs4_stateid_is_next(&state->open_stateid, stateid)) | ||
7958 | + return true; | ||
7959 | + return false; | ||
7960 | } | ||
7961 | - } else { | ||
7962 | - /* This is the first OPEN in this generation */ | ||
7963 | - if (stateid->seqid == cpu_to_be32(1)) | ||
7964 | - return true; | ||
7965 | + /* The server returned a new stateid */ | ||
7966 | } | ||
7967 | + /* This is the first OPEN in this generation */ | ||
7968 | + if (stateid->seqid == cpu_to_be32(1)) | ||
7969 | + return true; | ||
7970 | return false; | ||
7971 | } | ||
7972 | |||
7973 | diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c | ||
7974 | index 249cf9037dbd7..aff44a7b98f86 100644 | ||
7975 | --- a/fs/nfs/pnfs_nfs.c | ||
7976 | +++ b/fs/nfs/pnfs_nfs.c | ||
7977 | @@ -641,7 +641,7 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv, | ||
7978 | } | ||
7979 | |||
7980 | smp_wmb(); | ||
7981 | - ds->ds_clp = clp; | ||
7982 | + WRITE_ONCE(ds->ds_clp, clp); | ||
7983 | dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr); | ||
7984 | out: | ||
7985 | return status; | ||
7986 | @@ -714,7 +714,7 @@ static int _nfs4_pnfs_v4_ds_connect(struct nfs_server *mds_srv, | ||
7987 | } | ||
7988 | |||
7989 | smp_wmb(); | ||
7990 | - ds->ds_clp = clp; | ||
7991 | + WRITE_ONCE(ds->ds_clp, clp); | ||
7992 | dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr); | ||
7993 | out: | ||
7994 | return status; | ||
7995 | diff --git a/fs/nfs/write.c b/fs/nfs/write.c | ||
7996 | index 613c3ef23e07b..30d8e7bc1cef3 100644 | ||
7997 | --- a/fs/nfs/write.c | ||
7998 | +++ b/fs/nfs/write.c | ||
7999 | @@ -1050,25 +1050,11 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst, | ||
8000 | struct nfs_page *req, *tmp; | ||
8001 | int ret = 0; | ||
8002 | |||
8003 | -restart: | ||
8004 | list_for_each_entry_safe(req, tmp, src, wb_list) { | ||
8005 | kref_get(&req->wb_kref); | ||
8006 | if (!nfs_lock_request(req)) { | ||
8007 | - int status; | ||
8008 | - | ||
8009 | - /* Prevent deadlock with nfs_lock_and_join_requests */ | ||
8010 | - if (!list_empty(dst)) { | ||
8011 | - nfs_release_request(req); | ||
8012 | - continue; | ||
8013 | - } | ||
8014 | - /* Ensure we make progress to prevent livelock */ | ||
8015 | - mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex); | ||
8016 | - status = nfs_wait_on_request(req); | ||
8017 | nfs_release_request(req); | ||
8018 | - mutex_lock(&NFS_I(cinfo->inode)->commit_mutex); | ||
8019 | - if (status < 0) | ||
8020 | - break; | ||
8021 | - goto restart; | ||
8022 | + continue; | ||
8023 | } | ||
8024 | nfs_request_remove_commit_list(req, cinfo); | ||
8025 | clear_bit(PG_COMMIT_TO_DS, &req->wb_flags); | ||
8026 | @@ -1935,6 +1921,7 @@ static int __nfs_commit_inode(struct inode *inode, int how, | ||
8027 | int may_wait = how & FLUSH_SYNC; | ||
8028 | int ret, nscan; | ||
8029 | |||
8030 | + how &= ~FLUSH_SYNC; | ||
8031 | nfs_init_cinfo_from_inode(&cinfo, inode); | ||
8032 | nfs_commit_begin(cinfo.mds); | ||
8033 | for (;;) { | ||
8034 | diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c | ||
8035 | index 58d4546a208e6..c30747bdfb127 100644 | ||
8036 | --- a/fs/ocfs2/file.c | ||
8037 | +++ b/fs/ocfs2/file.c | ||
8038 | @@ -478,10 +478,11 @@ int ocfs2_truncate_file(struct inode *inode, | ||
8039 | * greater than page size, so we have to truncate them | ||
8040 | * anyway. | ||
8041 | */ | ||
8042 | - unmap_mapping_range(inode->i_mapping, new_i_size + PAGE_SIZE - 1, 0, 1); | ||
8043 | - truncate_inode_pages(inode->i_mapping, new_i_size); | ||
8044 | |||
8045 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | ||
8046 | + unmap_mapping_range(inode->i_mapping, | ||
8047 | + new_i_size + PAGE_SIZE - 1, 0, 1); | ||
8048 | + truncate_inode_pages(inode->i_mapping, new_i_size); | ||
8049 | status = ocfs2_truncate_inline(inode, di_bh, new_i_size, | ||
8050 | i_size_read(inode), 1); | ||
8051 | if (status) | ||
8052 | @@ -500,6 +501,9 @@ int ocfs2_truncate_file(struct inode *inode, | ||
8053 | goto bail_unlock_sem; | ||
8054 | } | ||
8055 | |||
8056 | + unmap_mapping_range(inode->i_mapping, new_i_size + PAGE_SIZE - 1, 0, 1); | ||
8057 | + truncate_inode_pages(inode->i_mapping, new_i_size); | ||
8058 | + | ||
8059 | status = ocfs2_commit_truncate(osb, inode, di_bh); | ||
8060 | if (status < 0) { | ||
8061 | mlog_errno(status); | ||
8062 | diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c | ||
8063 | index fe484cf93e5cd..8bbe9486e3a62 100644 | ||
8064 | --- a/fs/orangefs/dcache.c | ||
8065 | +++ b/fs/orangefs/dcache.c | ||
8066 | @@ -26,8 +26,10 @@ static int orangefs_revalidate_lookup(struct dentry *dentry) | ||
8067 | gossip_debug(GOSSIP_DCACHE_DEBUG, "%s: attempting lookup.\n", __func__); | ||
8068 | |||
8069 | new_op = op_alloc(ORANGEFS_VFS_OP_LOOKUP); | ||
8070 | - if (!new_op) | ||
8071 | + if (!new_op) { | ||
8072 | + ret = -ENOMEM; | ||
8073 | goto out_put_parent; | ||
8074 | + } | ||
8075 | |||
8076 | new_op->upcall.req.lookup.sym_follow = ORANGEFS_LOOKUP_LINK_NO_FOLLOW; | ||
8077 | new_op->upcall.req.lookup.parent_refn = parent->refn; | ||
8078 | diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c | ||
8079 | index 81c9eab8529b6..6bf5fb12395ac 100644 | ||
8080 | --- a/fs/overlayfs/file.c | ||
8081 | +++ b/fs/overlayfs/file.c | ||
8082 | @@ -296,6 +296,51 @@ out_unlock: | ||
8083 | return ret; | ||
8084 | } | ||
8085 | |||
8086 | +/* | ||
8087 | + * Calling iter_file_splice_write() directly from overlay's f_op may deadlock | ||
8088 | + * due to lock order inversion between pipe->mutex in iter_file_splice_write() | ||
8089 | + * and file_start_write(real.file) in ovl_write_iter(). | ||
8090 | + * | ||
8091 | + * So do everything ovl_write_iter() does and call iter_file_splice_write() on | ||
8092 | + * the real file. | ||
8093 | + */ | ||
8094 | +static ssize_t ovl_splice_write(struct pipe_inode_info *pipe, struct file *out, | ||
8095 | + loff_t *ppos, size_t len, unsigned int flags) | ||
8096 | +{ | ||
8097 | + struct fd real; | ||
8098 | + const struct cred *old_cred; | ||
8099 | + struct inode *inode = file_inode(out); | ||
8100 | + struct inode *realinode = ovl_inode_real(inode); | ||
8101 | + ssize_t ret; | ||
8102 | + | ||
8103 | + inode_lock(inode); | ||
8104 | + /* Update mode */ | ||
8105 | + ovl_copyattr(realinode, inode); | ||
8106 | + ret = file_remove_privs(out); | ||
8107 | + if (ret) | ||
8108 | + goto out_unlock; | ||
8109 | + | ||
8110 | + ret = ovl_real_fdget(out, &real); | ||
8111 | + if (ret) | ||
8112 | + goto out_unlock; | ||
8113 | + | ||
8114 | + old_cred = ovl_override_creds(inode->i_sb); | ||
8115 | + file_start_write(real.file); | ||
8116 | + | ||
8117 | + ret = iter_file_splice_write(pipe, real.file, ppos, len, flags); | ||
8118 | + | ||
8119 | + file_end_write(real.file); | ||
8120 | + /* Update size */ | ||
8121 | + ovl_copyattr(realinode, inode); | ||
8122 | + revert_creds(old_cred); | ||
8123 | + fdput(real); | ||
8124 | + | ||
8125 | +out_unlock: | ||
8126 | + inode_unlock(inode); | ||
8127 | + | ||
8128 | + return ret; | ||
8129 | +} | ||
8130 | + | ||
8131 | static int ovl_fsync(struct file *file, loff_t start, loff_t end, int datasync) | ||
8132 | { | ||
8133 | struct fd real; | ||
8134 | @@ -653,7 +698,7 @@ const struct file_operations ovl_file_operations = { | ||
8135 | .unlocked_ioctl = ovl_ioctl, | ||
8136 | .compat_ioctl = ovl_compat_ioctl, | ||
8137 | .splice_read = generic_file_splice_read, | ||
8138 | - .splice_write = iter_file_splice_write, | ||
8139 | + .splice_write = ovl_splice_write, | ||
8140 | |||
8141 | .copy_file_range = ovl_copy_file_range, | ||
8142 | .remap_file_range = ovl_remap_file_range, | ||
8143 | diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c | ||
8144 | index c5562c871c8be..1a188fbdf34e5 100644 | ||
8145 | --- a/fs/quota/quota_tree.c | ||
8146 | +++ b/fs/quota/quota_tree.c | ||
8147 | @@ -423,6 +423,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, | ||
8148 | quota_error(dquot->dq_sb, "Quota structure has offset to " | ||
8149 | "other block (%u) than it should (%u)", blk, | ||
8150 | (uint)(dquot->dq_off >> info->dqi_blocksize_bits)); | ||
8151 | + ret = -EIO; | ||
8152 | goto out_buf; | ||
8153 | } | ||
8154 | ret = read_blk(info, blk, buf); | ||
8155 | @@ -488,6 +489,13 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, | ||
8156 | goto out_buf; | ||
8157 | } | ||
8158 | newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); | ||
8159 | + if (newblk < QT_TREEOFF || newblk >= info->dqi_blocks) { | ||
8160 | + quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)", | ||
8161 | + newblk, info->dqi_blocks); | ||
8162 | + ret = -EUCLEAN; | ||
8163 | + goto out_buf; | ||
8164 | + } | ||
8165 | + | ||
8166 | if (depth == info->dqi_qtree_depth - 1) { | ||
8167 | ret = free_dqentry(info, dquot, newblk); | ||
8168 | newblk = 0; | ||
8169 | @@ -587,6 +595,13 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info, | ||
8170 | blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); | ||
8171 | if (!blk) /* No reference? */ | ||
8172 | goto out_buf; | ||
8173 | + if (blk < QT_TREEOFF || blk >= info->dqi_blocks) { | ||
8174 | + quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)", | ||
8175 | + blk, info->dqi_blocks); | ||
8176 | + ret = -EUCLEAN; | ||
8177 | + goto out_buf; | ||
8178 | + } | ||
8179 | + | ||
8180 | if (depth < info->dqi_qtree_depth - 1) | ||
8181 | ret = find_tree_dqentry(info, dquot, blk, depth+1); | ||
8182 | else | ||
8183 | diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c | ||
8184 | index 0caa151cae4ee..efe078fe5d4a9 100644 | ||
8185 | --- a/fs/tracefs/inode.c | ||
8186 | +++ b/fs/tracefs/inode.c | ||
8187 | @@ -427,7 +427,8 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent, | ||
8188 | if (unlikely(!inode)) | ||
8189 | return failed_creating(dentry); | ||
8190 | |||
8191 | - inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; | ||
8192 | + /* Do not set bits for OTH */ | ||
8193 | + inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP; | ||
8194 | inode->i_op = ops; | ||
8195 | inode->i_fop = &simple_dir_operations; | ||
8196 | |||
8197 | diff --git a/include/linux/console.h b/include/linux/console.h | ||
8198 | index d09951d5a94e4..d1d03c9c7a512 100644 | ||
8199 | --- a/include/linux/console.h | ||
8200 | +++ b/include/linux/console.h | ||
8201 | @@ -153,6 +153,8 @@ struct console { | ||
8202 | short flags; | ||
8203 | short index; | ||
8204 | int cflag; | ||
8205 | + uint ispeed; | ||
8206 | + uint ospeed; | ||
8207 | void *data; | ||
8208 | struct console *next; | ||
8209 | }; | ||
8210 | diff --git a/include/linux/filter.h b/include/linux/filter.h | ||
8211 | index c4f89340f4986..440014875acf4 100644 | ||
8212 | --- a/include/linux/filter.h | ||
8213 | +++ b/include/linux/filter.h | ||
8214 | @@ -952,6 +952,7 @@ extern int bpf_jit_enable; | ||
8215 | extern int bpf_jit_harden; | ||
8216 | extern int bpf_jit_kallsyms; | ||
8217 | extern long bpf_jit_limit; | ||
8218 | +extern long bpf_jit_limit_max; | ||
8219 | |||
8220 | typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size); | ||
8221 | |||
8222 | diff --git a/include/linux/libata.h b/include/linux/libata.h | ||
8223 | index 3d5adbaf8214f..2e448d65a04c7 100644 | ||
8224 | --- a/include/linux/libata.h | ||
8225 | +++ b/include/linux/libata.h | ||
8226 | @@ -391,7 +391,7 @@ enum { | ||
8227 | /* This should match the actual table size of | ||
8228 | * ata_eh_cmd_timeout_table in libata-eh.c. | ||
8229 | */ | ||
8230 | - ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6, | ||
8231 | + ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 7, | ||
8232 | |||
8233 | /* Horkage types. May be set by libata or controller on drives | ||
8234 | (some horkage may be drive/controller pair dependent */ | ||
8235 | diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h | ||
8236 | index a3763247547c3..a21dc5413653e 100644 | ||
8237 | --- a/include/linux/lsm_hooks.h | ||
8238 | +++ b/include/linux/lsm_hooks.h | ||
8239 | @@ -1241,22 +1241,22 @@ | ||
8240 | * | ||
8241 | * @binder_set_context_mgr: | ||
8242 | * Check whether @mgr is allowed to be the binder context manager. | ||
8243 | - * @mgr contains the task_struct for the task being registered. | ||
8244 | + * @mgr contains the struct cred for the current binder process. | ||
8245 | * Return 0 if permission is granted. | ||
8246 | * @binder_transaction: | ||
8247 | * Check whether @from is allowed to invoke a binder transaction call | ||
8248 | * to @to. | ||
8249 | - * @from contains the task_struct for the sending task. | ||
8250 | - * @to contains the task_struct for the receiving task. | ||
8251 | + * @from contains the struct cred for the sending process. | ||
8252 | + * @to contains the struct cred for the receiving process. | ||
8253 | * @binder_transfer_binder: | ||
8254 | * Check whether @from is allowed to transfer a binder reference to @to. | ||
8255 | - * @from contains the task_struct for the sending task. | ||
8256 | - * @to contains the task_struct for the receiving task. | ||
8257 | + * @from contains the struct cred for the sending process. | ||
8258 | + * @to contains the struct cred for the receiving process. | ||
8259 | * @binder_transfer_file: | ||
8260 | * Check whether @from is allowed to transfer @file to @to. | ||
8261 | - * @from contains the task_struct for the sending task. | ||
8262 | + * @from contains the struct cred for the sending process. | ||
8263 | * @file contains the struct file being transferred. | ||
8264 | - * @to contains the task_struct for the receiving task. | ||
8265 | + * @to contains the struct cred for the receiving process. | ||
8266 | * | ||
8267 | * @ptrace_access_check: | ||
8268 | * Check permission before allowing the current process to trace the | ||
8269 | @@ -1456,13 +1456,13 @@ | ||
8270 | * @what: kernel feature being accessed | ||
8271 | */ | ||
8272 | union security_list_options { | ||
8273 | - int (*binder_set_context_mgr)(struct task_struct *mgr); | ||
8274 | - int (*binder_transaction)(struct task_struct *from, | ||
8275 | - struct task_struct *to); | ||
8276 | - int (*binder_transfer_binder)(struct task_struct *from, | ||
8277 | - struct task_struct *to); | ||
8278 | - int (*binder_transfer_file)(struct task_struct *from, | ||
8279 | - struct task_struct *to, | ||
8280 | + int (*binder_set_context_mgr)(const struct cred *mgr); | ||
8281 | + int (*binder_transaction)(const struct cred *from, | ||
8282 | + const struct cred *to); | ||
8283 | + int (*binder_transfer_binder)(const struct cred *from, | ||
8284 | + const struct cred *to); | ||
8285 | + int (*binder_transfer_file)(const struct cred *from, | ||
8286 | + const struct cred *to, | ||
8287 | struct file *file); | ||
8288 | |||
8289 | int (*ptrace_access_check)(struct task_struct *child, | ||
8290 | diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h | ||
8291 | index 9fe156d1c018e..a68972b097b72 100644 | ||
8292 | --- a/include/linux/rpmsg.h | ||
8293 | +++ b/include/linux/rpmsg.h | ||
8294 | @@ -177,7 +177,7 @@ static inline struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev | ||
8295 | /* This shouldn't be possible */ | ||
8296 | WARN_ON(1); | ||
8297 | |||
8298 | - return ERR_PTR(-ENXIO); | ||
8299 | + return NULL; | ||
8300 | } | ||
8301 | |||
8302 | static inline int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len) | ||
8303 | diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h | ||
8304 | index 2413427e439c7..d10150587d819 100644 | ||
8305 | --- a/include/linux/sched/task_stack.h | ||
8306 | +++ b/include/linux/sched/task_stack.h | ||
8307 | @@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task) | ||
8308 | |||
8309 | static inline unsigned long *end_of_stack(const struct task_struct *task) | ||
8310 | { | ||
8311 | +#ifdef CONFIG_STACK_GROWSUP | ||
8312 | + return (unsigned long *)((unsigned long)task->stack + THREAD_SIZE) - 1; | ||
8313 | +#else | ||
8314 | return task->stack; | ||
8315 | +#endif | ||
8316 | } | ||
8317 | |||
8318 | #elif !defined(__HAVE_THREAD_FUNCTIONS) | ||
8319 | diff --git a/include/linux/security.h b/include/linux/security.h | ||
8320 | index df90399a8af98..3f6b8195ae9eb 100644 | ||
8321 | --- a/include/linux/security.h | ||
8322 | +++ b/include/linux/security.h | ||
8323 | @@ -249,13 +249,13 @@ extern int security_init(void); | ||
8324 | extern int early_security_init(void); | ||
8325 | |||
8326 | /* Security operations */ | ||
8327 | -int security_binder_set_context_mgr(struct task_struct *mgr); | ||
8328 | -int security_binder_transaction(struct task_struct *from, | ||
8329 | - struct task_struct *to); | ||
8330 | -int security_binder_transfer_binder(struct task_struct *from, | ||
8331 | - struct task_struct *to); | ||
8332 | -int security_binder_transfer_file(struct task_struct *from, | ||
8333 | - struct task_struct *to, struct file *file); | ||
8334 | +int security_binder_set_context_mgr(const struct cred *mgr); | ||
8335 | +int security_binder_transaction(const struct cred *from, | ||
8336 | + const struct cred *to); | ||
8337 | +int security_binder_transfer_binder(const struct cred *from, | ||
8338 | + const struct cred *to); | ||
8339 | +int security_binder_transfer_file(const struct cred *from, | ||
8340 | + const struct cred *to, struct file *file); | ||
8341 | int security_ptrace_access_check(struct task_struct *child, unsigned int mode); | ||
8342 | int security_ptrace_traceme(struct task_struct *parent); | ||
8343 | int security_capget(struct task_struct *target, | ||
8344 | @@ -481,25 +481,25 @@ static inline int early_security_init(void) | ||
8345 | return 0; | ||
8346 | } | ||
8347 | |||
8348 | -static inline int security_binder_set_context_mgr(struct task_struct *mgr) | ||
8349 | +static inline int security_binder_set_context_mgr(const struct cred *mgr) | ||
8350 | { | ||
8351 | return 0; | ||
8352 | } | ||
8353 | |||
8354 | -static inline int security_binder_transaction(struct task_struct *from, | ||
8355 | - struct task_struct *to) | ||
8356 | +static inline int security_binder_transaction(const struct cred *from, | ||
8357 | + const struct cred *to) | ||
8358 | { | ||
8359 | return 0; | ||
8360 | } | ||
8361 | |||
8362 | -static inline int security_binder_transfer_binder(struct task_struct *from, | ||
8363 | - struct task_struct *to) | ||
8364 | +static inline int security_binder_transfer_binder(const struct cred *from, | ||
8365 | + const struct cred *to) | ||
8366 | { | ||
8367 | return 0; | ||
8368 | } | ||
8369 | |||
8370 | -static inline int security_binder_transfer_file(struct task_struct *from, | ||
8371 | - struct task_struct *to, | ||
8372 | +static inline int security_binder_transfer_file(const struct cred *from, | ||
8373 | + const struct cred *to, | ||
8374 | struct file *file) | ||
8375 | { | ||
8376 | return 0; | ||
8377 | @@ -985,6 +985,11 @@ static inline void security_transfer_creds(struct cred *new, | ||
8378 | { | ||
8379 | } | ||
8380 | |||
8381 | +static inline void security_cred_getsecid(const struct cred *c, u32 *secid) | ||
8382 | +{ | ||
8383 | + *secid = 0; | ||
8384 | +} | ||
8385 | + | ||
8386 | static inline int security_kernel_act_as(struct cred *cred, u32 secid) | ||
8387 | { | ||
8388 | return 0; | ||
8389 | diff --git a/include/net/llc.h b/include/net/llc.h | ||
8390 | index df282d9b40170..9c10b121b49b0 100644 | ||
8391 | --- a/include/net/llc.h | ||
8392 | +++ b/include/net/llc.h | ||
8393 | @@ -72,7 +72,9 @@ struct llc_sap { | ||
8394 | static inline | ||
8395 | struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex) | ||
8396 | { | ||
8397 | - return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES]; | ||
8398 | + u32 bucket = hash_32(ifindex, LLC_SK_DEV_HASH_BITS); | ||
8399 | + | ||
8400 | + return &sap->sk_dev_hash[bucket]; | ||
8401 | } | ||
8402 | |||
8403 | static inline | ||
8404 | diff --git a/include/net/neighbour.h b/include/net/neighbour.h | ||
8405 | index 2be8d6b0dfb69..b6494e87c897c 100644 | ||
8406 | --- a/include/net/neighbour.h | ||
8407 | +++ b/include/net/neighbour.h | ||
8408 | @@ -253,6 +253,7 @@ static inline void *neighbour_priv(const struct neighbour *n) | ||
8409 | #define NEIGH_UPDATE_F_OVERRIDE 0x00000001 | ||
8410 | #define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 | ||
8411 | #define NEIGH_UPDATE_F_OVERRIDE_ISROUTER 0x00000004 | ||
8412 | +#define NEIGH_UPDATE_F_USE 0x10000000 | ||
8413 | #define NEIGH_UPDATE_F_EXT_LEARNED 0x20000000 | ||
8414 | #define NEIGH_UPDATE_F_ISROUTER 0x40000000 | ||
8415 | #define NEIGH_UPDATE_F_ADMIN 0x80000000 | ||
8416 | @@ -505,10 +506,15 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb, | ||
8417 | { | ||
8418 | const struct hh_cache *hh = &n->hh; | ||
8419 | |||
8420 | - if ((n->nud_state & NUD_CONNECTED) && hh->hh_len && !skip_cache) | ||
8421 | + /* n->nud_state and hh->hh_len could be changed under us. | ||
8422 | + * neigh_hh_output() is taking care of the race later. | ||
8423 | + */ | ||
8424 | + if (!skip_cache && | ||
8425 | + (READ_ONCE(n->nud_state) & NUD_CONNECTED) && | ||
8426 | + READ_ONCE(hh->hh_len)) | ||
8427 | return neigh_hh_output(hh, skb); | ||
8428 | - else | ||
8429 | - return n->output(n, skb); | ||
8430 | + | ||
8431 | + return n->output(n, skb); | ||
8432 | } | ||
8433 | |||
8434 | static inline struct neighbour * | ||
8435 | diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h | ||
8436 | index 0cb0a4bcb5447..939fda8f97215 100644 | ||
8437 | --- a/include/net/sch_generic.h | ||
8438 | +++ b/include/net/sch_generic.h | ||
8439 | @@ -299,6 +299,8 @@ struct Qdisc_ops { | ||
8440 | struct netlink_ext_ack *extack); | ||
8441 | void (*attach)(struct Qdisc *sch); | ||
8442 | int (*change_tx_queue_len)(struct Qdisc *, unsigned int); | ||
8443 | + void (*change_real_num_tx)(struct Qdisc *sch, | ||
8444 | + unsigned int new_real_tx); | ||
8445 | |||
8446 | int (*dump)(struct Qdisc *, struct sk_buff *); | ||
8447 | int (*dump_stats)(struct Qdisc *, struct gnet_dump *); | ||
8448 | @@ -675,6 +677,8 @@ void qdisc_class_hash_grow(struct Qdisc *, struct Qdisc_class_hash *); | ||
8449 | void qdisc_class_hash_destroy(struct Qdisc_class_hash *); | ||
8450 | |||
8451 | int dev_qdisc_change_tx_queue_len(struct net_device *dev); | ||
8452 | +void dev_qdisc_change_real_num_tx(struct net_device *dev, | ||
8453 | + unsigned int new_real_tx); | ||
8454 | void dev_init_scheduler(struct net_device *dev); | ||
8455 | void dev_shutdown(struct net_device *dev); | ||
8456 | void dev_activate(struct net_device *dev); | ||
8457 | diff --git a/include/net/strparser.h b/include/net/strparser.h | ||
8458 | index 1d20b98493a10..bec1439bd3be6 100644 | ||
8459 | --- a/include/net/strparser.h | ||
8460 | +++ b/include/net/strparser.h | ||
8461 | @@ -54,10 +54,24 @@ struct strp_msg { | ||
8462 | int offset; | ||
8463 | }; | ||
8464 | |||
8465 | +struct _strp_msg { | ||
8466 | + /* Internal cb structure. struct strp_msg must be first for passing | ||
8467 | + * to upper layer. | ||
8468 | + */ | ||
8469 | + struct strp_msg strp; | ||
8470 | + int accum_len; | ||
8471 | +}; | ||
8472 | + | ||
8473 | +struct sk_skb_cb { | ||
8474 | +#define SK_SKB_CB_PRIV_LEN 20 | ||
8475 | + unsigned char data[SK_SKB_CB_PRIV_LEN]; | ||
8476 | + struct _strp_msg strp; | ||
8477 | +}; | ||
8478 | + | ||
8479 | static inline struct strp_msg *strp_msg(struct sk_buff *skb) | ||
8480 | { | ||
8481 | return (struct strp_msg *)((void *)skb->cb + | ||
8482 | - offsetof(struct qdisc_skb_cb, data)); | ||
8483 | + offsetof(struct sk_skb_cb, strp)); | ||
8484 | } | ||
8485 | |||
8486 | /* Structure for an attached lower socket */ | ||
8487 | diff --git a/include/net/udp.h b/include/net/udp.h | ||
8488 | index fabf507bce5d1..d9d39cc20a847 100644 | ||
8489 | --- a/include/net/udp.h | ||
8490 | +++ b/include/net/udp.h | ||
8491 | @@ -480,8 +480,9 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk, | ||
8492 | * CHECKSUM_NONE in __udp_gso_segment. UDP GRO indeed builds partial | ||
8493 | * packets in udp_gro_complete_segment. As does UDP GSO, verified by | ||
8494 | * udp_send_skb. But when those packets are looped in dev_loopback_xmit | ||
8495 | - * their ip_summed is set to CHECKSUM_UNNECESSARY. Reset in this | ||
8496 | - * specific case, where PARTIAL is both correct and required. | ||
8497 | + * their ip_summed CHECKSUM_NONE is changed to CHECKSUM_UNNECESSARY. | ||
8498 | + * Reset in this specific case, where PARTIAL is both correct and | ||
8499 | + * required. | ||
8500 | */ | ||
8501 | if (skb->pkt_type == PACKET_LOOPBACK) | ||
8502 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
8503 | diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h | ||
8504 | index 29d6e93fd15e3..b485d8b0d5a79 100644 | ||
8505 | --- a/include/uapi/linux/pci_regs.h | ||
8506 | +++ b/include/uapi/linux/pci_regs.h | ||
8507 | @@ -502,6 +502,12 @@ | ||
8508 | #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ | ||
8509 | #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ | ||
8510 | #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ | ||
8511 | +#define PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */ | ||
8512 | +#define PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */ | ||
8513 | +#define PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */ | ||
8514 | +#define PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */ | ||
8515 | +#define PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */ | ||
8516 | +#define PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00a0 /* 4096 Bytes */ | ||
8517 | #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ | ||
8518 | #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ | ||
8519 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ | ||
8520 | diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c | ||
8521 | index d9a3d995bd966..1238ef9c569df 100644 | ||
8522 | --- a/kernel/bpf/core.c | ||
8523 | +++ b/kernel/bpf/core.c | ||
8524 | @@ -523,6 +523,7 @@ int bpf_jit_enable __read_mostly = IS_BUILTIN(CONFIG_BPF_JIT_ALWAYS_ON); | ||
8525 | int bpf_jit_harden __read_mostly; | ||
8526 | int bpf_jit_kallsyms __read_mostly; | ||
8527 | long bpf_jit_limit __read_mostly; | ||
8528 | +long bpf_jit_limit_max __read_mostly; | ||
8529 | |||
8530 | static __always_inline void | ||
8531 | bpf_get_prog_addr_region(const struct bpf_prog *prog, | ||
8532 | @@ -759,7 +760,8 @@ u64 __weak bpf_jit_alloc_exec_limit(void) | ||
8533 | static int __init bpf_jit_charge_init(void) | ||
8534 | { | ||
8535 | /* Only used as heuristic here to derive limit. */ | ||
8536 | - bpf_jit_limit = min_t(u64, round_up(bpf_jit_alloc_exec_limit() >> 2, | ||
8537 | + bpf_jit_limit_max = bpf_jit_alloc_exec_limit(); | ||
8538 | + bpf_jit_limit = min_t(u64, round_up(bpf_jit_limit_max >> 2, | ||
8539 | PAGE_SIZE), LONG_MAX); | ||
8540 | return 0; | ||
8541 | } | ||
8542 | diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c | ||
8543 | index ede370ec245d9..1904ffcee0f1e 100644 | ||
8544 | --- a/kernel/cgroup/cgroup.c | ||
8545 | +++ b/kernel/cgroup/cgroup.c | ||
8546 | @@ -1721,6 +1721,7 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask) | ||
8547 | struct cgroup *dcgrp = &dst_root->cgrp; | ||
8548 | struct cgroup_subsys *ss; | ||
8549 | int ssid, i, ret; | ||
8550 | + u16 dfl_disable_ss_mask = 0; | ||
8551 | |||
8552 | lockdep_assert_held(&cgroup_mutex); | ||
8553 | |||
8554 | @@ -1737,8 +1738,28 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask) | ||
8555 | /* can't move between two non-dummy roots either */ | ||
8556 | if (ss->root != &cgrp_dfl_root && dst_root != &cgrp_dfl_root) | ||
8557 | return -EBUSY; | ||
8558 | + | ||
8559 | + /* | ||
8560 | + * Collect ssid's that need to be disabled from default | ||
8561 | + * hierarchy. | ||
8562 | + */ | ||
8563 | + if (ss->root == &cgrp_dfl_root) | ||
8564 | + dfl_disable_ss_mask |= 1 << ssid; | ||
8565 | + | ||
8566 | } while_each_subsys_mask(); | ||
8567 | |||
8568 | + if (dfl_disable_ss_mask) { | ||
8569 | + struct cgroup *scgrp = &cgrp_dfl_root.cgrp; | ||
8570 | + | ||
8571 | + /* | ||
8572 | + * Controllers from default hierarchy that need to be rebound | ||
8573 | + * are all disabled together in one go. | ||
8574 | + */ | ||
8575 | + cgrp_dfl_root.subsys_mask &= ~dfl_disable_ss_mask; | ||
8576 | + WARN_ON(cgroup_apply_control(scgrp)); | ||
8577 | + cgroup_finalize_control(scgrp, 0); | ||
8578 | + } | ||
8579 | + | ||
8580 | do_each_subsys_mask(ss, ssid, ss_mask) { | ||
8581 | struct cgroup_root *src_root = ss->root; | ||
8582 | struct cgroup *scgrp = &src_root->cgrp; | ||
8583 | @@ -1747,10 +1768,12 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask) | ||
8584 | |||
8585 | WARN_ON(!css || cgroup_css(dcgrp, ss)); | ||
8586 | |||
8587 | - /* disable from the source */ | ||
8588 | - src_root->subsys_mask &= ~(1 << ssid); | ||
8589 | - WARN_ON(cgroup_apply_control(scgrp)); | ||
8590 | - cgroup_finalize_control(scgrp, 0); | ||
8591 | + if (src_root != &cgrp_dfl_root) { | ||
8592 | + /* disable from the source */ | ||
8593 | + src_root->subsys_mask &= ~(1 << ssid); | ||
8594 | + WARN_ON(cgroup_apply_control(scgrp)); | ||
8595 | + cgroup_finalize_control(scgrp, 0); | ||
8596 | + } | ||
8597 | |||
8598 | /* rebind */ | ||
8599 | RCU_INIT_POINTER(scgrp->subsys[ssid], NULL); | ||
8600 | diff --git a/kernel/kprobes.c b/kernel/kprobes.c | ||
8601 | index a7812c115e487..1668439b269d3 100644 | ||
8602 | --- a/kernel/kprobes.c | ||
8603 | +++ b/kernel/kprobes.c | ||
8604 | @@ -2712,14 +2712,13 @@ static const struct file_operations fops_kp = { | ||
8605 | static int __init debugfs_kprobe_init(void) | ||
8606 | { | ||
8607 | struct dentry *dir; | ||
8608 | - unsigned int value = 1; | ||
8609 | |||
8610 | dir = debugfs_create_dir("kprobes", NULL); | ||
8611 | |||
8612 | debugfs_create_file("list", 0400, dir, NULL, | ||
8613 | &debugfs_kprobes_operations); | ||
8614 | |||
8615 | - debugfs_create_file("enabled", 0600, dir, &value, &fops_kp); | ||
8616 | + debugfs_create_file("enabled", 0600, dir, NULL, &fops_kp); | ||
8617 | |||
8618 | debugfs_create_file("blacklist", 0400, dir, NULL, | ||
8619 | &debugfs_kprobe_blacklist_ops); | ||
8620 | diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c | ||
8621 | index 3ec8fd2e80e53..db109d38f301e 100644 | ||
8622 | --- a/kernel/locking/lockdep.c | ||
8623 | +++ b/kernel/locking/lockdep.c | ||
8624 | @@ -830,7 +830,7 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass) | ||
8625 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | ||
8626 | return NULL; | ||
8627 | |||
8628 | - hlist_for_each_entry_rcu(class, hash_head, hash_entry) { | ||
8629 | + hlist_for_each_entry_rcu_notrace(class, hash_head, hash_entry) { | ||
8630 | if (class->key == key) { | ||
8631 | /* | ||
8632 | * Huh! same key, different name? Did someone trample | ||
8633 | diff --git a/kernel/power/swap.c b/kernel/power/swap.c | ||
8634 | index 0516c422206d8..bcc9769e8a3b5 100644 | ||
8635 | --- a/kernel/power/swap.c | ||
8636 | +++ b/kernel/power/swap.c | ||
8637 | @@ -292,7 +292,7 @@ static int hib_submit_io(int op, int op_flags, pgoff_t page_off, void *addr, | ||
8638 | return error; | ||
8639 | } | ||
8640 | |||
8641 | -static blk_status_t hib_wait_io(struct hib_bio_batch *hb) | ||
8642 | +static int hib_wait_io(struct hib_bio_batch *hb) | ||
8643 | { | ||
8644 | wait_event(hb->wait, atomic_read(&hb->count) == 0); | ||
8645 | return blk_status_to_errno(hb->error); | ||
8646 | @@ -1509,9 +1509,10 @@ end: | ||
8647 | int swsusp_check(void) | ||
8648 | { | ||
8649 | int error; | ||
8650 | + void *holder; | ||
8651 | |||
8652 | hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device, | ||
8653 | - FMODE_READ, NULL); | ||
8654 | + FMODE_READ | FMODE_EXCL, &holder); | ||
8655 | if (!IS_ERR(hib_resume_bdev)) { | ||
8656 | set_blocksize(hib_resume_bdev, PAGE_SIZE); | ||
8657 | clear_page(swsusp_header); | ||
8658 | @@ -1533,7 +1534,7 @@ int swsusp_check(void) | ||
8659 | |||
8660 | put: | ||
8661 | if (error) | ||
8662 | - blkdev_put(hib_resume_bdev, FMODE_READ); | ||
8663 | + blkdev_put(hib_resume_bdev, FMODE_READ | FMODE_EXCL); | ||
8664 | else | ||
8665 | pr_debug("Image signature found, resuming\n"); | ||
8666 | } else { | ||
8667 | diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h | ||
8668 | index df90d4d7ad2e2..4c4d7683a4e5b 100644 | ||
8669 | --- a/kernel/rcu/tree_exp.h | ||
8670 | +++ b/kernel/rcu/tree_exp.h | ||
8671 | @@ -738,7 +738,7 @@ static void sync_sched_exp_online_cleanup(int cpu) | ||
8672 | my_cpu = get_cpu(); | ||
8673 | /* Quiescent state either not needed or already requested, leave. */ | ||
8674 | if (!(READ_ONCE(rnp->expmask) & rdp->grpmask) || | ||
8675 | - __this_cpu_read(rcu_data.cpu_no_qs.b.exp)) { | ||
8676 | + rdp->cpu_no_qs.b.exp) { | ||
8677 | put_cpu(); | ||
8678 | return; | ||
8679 | } | ||
8680 | diff --git a/kernel/signal.c b/kernel/signal.c | ||
8681 | index 8c97fc72d78bd..3f61367fd1685 100644 | ||
8682 | --- a/kernel/signal.c | ||
8683 | +++ b/kernel/signal.c | ||
8684 | @@ -2101,15 +2101,6 @@ static inline bool may_ptrace_stop(void) | ||
8685 | return true; | ||
8686 | } | ||
8687 | |||
8688 | -/* | ||
8689 | - * Return non-zero if there is a SIGKILL that should be waking us up. | ||
8690 | - * Called with the siglock held. | ||
8691 | - */ | ||
8692 | -static bool sigkill_pending(struct task_struct *tsk) | ||
8693 | -{ | ||
8694 | - return sigismember(&tsk->pending.signal, SIGKILL) || | ||
8695 | - sigismember(&tsk->signal->shared_pending.signal, SIGKILL); | ||
8696 | -} | ||
8697 | |||
8698 | /* | ||
8699 | * This must be called with current->sighand->siglock held. | ||
8700 | @@ -2136,17 +2127,16 @@ static void ptrace_stop(int exit_code, int why, int clear_code, kernel_siginfo_t | ||
8701 | * calling arch_ptrace_stop, so we must release it now. | ||
8702 | * To preserve proper semantics, we must do this before | ||
8703 | * any signal bookkeeping like checking group_stop_count. | ||
8704 | - * Meanwhile, a SIGKILL could come in before we retake the | ||
8705 | - * siglock. That must prevent us from sleeping in TASK_TRACED. | ||
8706 | - * So after regaining the lock, we must check for SIGKILL. | ||
8707 | */ | ||
8708 | spin_unlock_irq(¤t->sighand->siglock); | ||
8709 | arch_ptrace_stop(exit_code, info); | ||
8710 | spin_lock_irq(¤t->sighand->siglock); | ||
8711 | - if (sigkill_pending(current)) | ||
8712 | - return; | ||
8713 | } | ||
8714 | |||
8715 | + /* | ||
8716 | + * schedule() will not sleep if there is a pending signal that | ||
8717 | + * can awaken the task. | ||
8718 | + */ | ||
8719 | set_special_state(TASK_TRACED); | ||
8720 | |||
8721 | /* | ||
8722 | diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c | ||
8723 | index 9e31bfc818ff8..10657b8dc2c2d 100644 | ||
8724 | --- a/kernel/trace/tracing_map.c | ||
8725 | +++ b/kernel/trace/tracing_map.c | ||
8726 | @@ -834,29 +834,35 @@ int tracing_map_init(struct tracing_map *map) | ||
8727 | return err; | ||
8728 | } | ||
8729 | |||
8730 | -static int cmp_entries_dup(const struct tracing_map_sort_entry **a, | ||
8731 | - const struct tracing_map_sort_entry **b) | ||
8732 | +static int cmp_entries_dup(const void *A, const void *B) | ||
8733 | { | ||
8734 | + const struct tracing_map_sort_entry *a, *b; | ||
8735 | int ret = 0; | ||
8736 | |||
8737 | - if (memcmp((*a)->key, (*b)->key, (*a)->elt->map->key_size)) | ||
8738 | + a = *(const struct tracing_map_sort_entry **)A; | ||
8739 | + b = *(const struct tracing_map_sort_entry **)B; | ||
8740 | + | ||
8741 | + if (memcmp(a->key, b->key, a->elt->map->key_size)) | ||
8742 | ret = 1; | ||
8743 | |||
8744 | return ret; | ||
8745 | } | ||
8746 | |||
8747 | -static int cmp_entries_sum(const struct tracing_map_sort_entry **a, | ||
8748 | - const struct tracing_map_sort_entry **b) | ||
8749 | +static int cmp_entries_sum(const void *A, const void *B) | ||
8750 | { | ||
8751 | const struct tracing_map_elt *elt_a, *elt_b; | ||
8752 | + const struct tracing_map_sort_entry *a, *b; | ||
8753 | struct tracing_map_sort_key *sort_key; | ||
8754 | struct tracing_map_field *field; | ||
8755 | tracing_map_cmp_fn_t cmp_fn; | ||
8756 | void *val_a, *val_b; | ||
8757 | int ret = 0; | ||
8758 | |||
8759 | - elt_a = (*a)->elt; | ||
8760 | - elt_b = (*b)->elt; | ||
8761 | + a = *(const struct tracing_map_sort_entry **)A; | ||
8762 | + b = *(const struct tracing_map_sort_entry **)B; | ||
8763 | + | ||
8764 | + elt_a = a->elt; | ||
8765 | + elt_b = b->elt; | ||
8766 | |||
8767 | sort_key = &elt_a->map->sort_key; | ||
8768 | |||
8769 | @@ -873,18 +879,21 @@ static int cmp_entries_sum(const struct tracing_map_sort_entry **a, | ||
8770 | return ret; | ||
8771 | } | ||
8772 | |||
8773 | -static int cmp_entries_key(const struct tracing_map_sort_entry **a, | ||
8774 | - const struct tracing_map_sort_entry **b) | ||
8775 | +static int cmp_entries_key(const void *A, const void *B) | ||
8776 | { | ||
8777 | const struct tracing_map_elt *elt_a, *elt_b; | ||
8778 | + const struct tracing_map_sort_entry *a, *b; | ||
8779 | struct tracing_map_sort_key *sort_key; | ||
8780 | struct tracing_map_field *field; | ||
8781 | tracing_map_cmp_fn_t cmp_fn; | ||
8782 | void *val_a, *val_b; | ||
8783 | int ret = 0; | ||
8784 | |||
8785 | - elt_a = (*a)->elt; | ||
8786 | - elt_b = (*b)->elt; | ||
8787 | + a = *(const struct tracing_map_sort_entry **)A; | ||
8788 | + b = *(const struct tracing_map_sort_entry **)B; | ||
8789 | + | ||
8790 | + elt_a = a->elt; | ||
8791 | + elt_b = b->elt; | ||
8792 | |||
8793 | sort_key = &elt_a->map->sort_key; | ||
8794 | |||
8795 | @@ -989,10 +998,8 @@ static void sort_secondary(struct tracing_map *map, | ||
8796 | struct tracing_map_sort_key *primary_key, | ||
8797 | struct tracing_map_sort_key *secondary_key) | ||
8798 | { | ||
8799 | - int (*primary_fn)(const struct tracing_map_sort_entry **, | ||
8800 | - const struct tracing_map_sort_entry **); | ||
8801 | - int (*secondary_fn)(const struct tracing_map_sort_entry **, | ||
8802 | - const struct tracing_map_sort_entry **); | ||
8803 | + int (*primary_fn)(const void *, const void *); | ||
8804 | + int (*secondary_fn)(const void *, const void *); | ||
8805 | unsigned i, start = 0, n_sub = 1; | ||
8806 | |||
8807 | if (is_key(map, primary_key->field_idx)) | ||
8808 | @@ -1061,8 +1068,7 @@ int tracing_map_sort_entries(struct tracing_map *map, | ||
8809 | unsigned int n_sort_keys, | ||
8810 | struct tracing_map_sort_entry ***sort_entries) | ||
8811 | { | ||
8812 | - int (*cmp_entries_fn)(const struct tracing_map_sort_entry **, | ||
8813 | - const struct tracing_map_sort_entry **); | ||
8814 | + int (*cmp_entries_fn)(const void *, const void *); | ||
8815 | struct tracing_map_sort_entry *sort_entry, **entries; | ||
8816 | int i, n_entries, ret; | ||
8817 | |||
8818 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c | ||
8819 | index 885d4792abdfc..77e6964ae1a99 100644 | ||
8820 | --- a/kernel/workqueue.c | ||
8821 | +++ b/kernel/workqueue.c | ||
8822 | @@ -5302,9 +5302,6 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask) | ||
8823 | int ret = -EINVAL; | ||
8824 | cpumask_var_t saved_cpumask; | ||
8825 | |||
8826 | - if (!zalloc_cpumask_var(&saved_cpumask, GFP_KERNEL)) | ||
8827 | - return -ENOMEM; | ||
8828 | - | ||
8829 | /* | ||
8830 | * Not excluding isolated cpus on purpose. | ||
8831 | * If the user wishes to include them, we allow that. | ||
8832 | @@ -5312,6 +5309,15 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask) | ||
8833 | cpumask_and(cpumask, cpumask, cpu_possible_mask); | ||
8834 | if (!cpumask_empty(cpumask)) { | ||
8835 | apply_wqattrs_lock(); | ||
8836 | + if (cpumask_equal(cpumask, wq_unbound_cpumask)) { | ||
8837 | + ret = 0; | ||
8838 | + goto out_unlock; | ||
8839 | + } | ||
8840 | + | ||
8841 | + if (!zalloc_cpumask_var(&saved_cpumask, GFP_KERNEL)) { | ||
8842 | + ret = -ENOMEM; | ||
8843 | + goto out_unlock; | ||
8844 | + } | ||
8845 | |||
8846 | /* save the old wq_unbound_cpumask. */ | ||
8847 | cpumask_copy(saved_cpumask, wq_unbound_cpumask); | ||
8848 | @@ -5324,10 +5330,11 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask) | ||
8849 | if (ret < 0) | ||
8850 | cpumask_copy(wq_unbound_cpumask, saved_cpumask); | ||
8851 | |||
8852 | + free_cpumask_var(saved_cpumask); | ||
8853 | +out_unlock: | ||
8854 | apply_wqattrs_unlock(); | ||
8855 | } | ||
8856 | |||
8857 | - free_cpumask_var(saved_cpumask); | ||
8858 | return ret; | ||
8859 | } | ||
8860 | |||
8861 | diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c | ||
8862 | index 25d59a95bd668..abea25310ac73 100644 | ||
8863 | --- a/lib/decompress_unxz.c | ||
8864 | +++ b/lib/decompress_unxz.c | ||
8865 | @@ -167,7 +167,7 @@ | ||
8866 | * memeq and memzero are not used much and any remotely sane implementation | ||
8867 | * is fast enough. memcpy/memmove speed matters in multi-call mode, but | ||
8868 | * the kernel image is decompressed in single-call mode, in which only | ||
8869 | - * memcpy speed can matter and only if there is a lot of uncompressible data | ||
8870 | + * memmove speed can matter and only if there is a lot of uncompressible data | ||
8871 | * (LZMA2 stores uncompressible chunks in uncompressed form). Thus, the | ||
8872 | * functions below should just be kept small; it's probably not worth | ||
8873 | * optimizing for speed. | ||
8874 | diff --git a/lib/iov_iter.c b/lib/iov_iter.c | ||
8875 | index 41b06af195368..957e3e58df652 100644 | ||
8876 | --- a/lib/iov_iter.c | ||
8877 | +++ b/lib/iov_iter.c | ||
8878 | @@ -1302,7 +1302,7 @@ ssize_t iov_iter_get_pages(struct iov_iter *i, | ||
8879 | res = get_user_pages_fast(addr, n, | ||
8880 | iov_iter_rw(i) != WRITE ? FOLL_WRITE : 0, | ||
8881 | pages); | ||
8882 | - if (unlikely(res < 0)) | ||
8883 | + if (unlikely(res <= 0)) | ||
8884 | return res; | ||
8885 | return (res == n ? len : res * PAGE_SIZE) - *start; | ||
8886 | 0;}),({ | ||
8887 | @@ -1384,8 +1384,9 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, | ||
8888 | return -ENOMEM; | ||
8889 | res = get_user_pages_fast(addr, n, | ||
8890 | iov_iter_rw(i) != WRITE ? FOLL_WRITE : 0, p); | ||
8891 | - if (unlikely(res < 0)) { | ||
8892 | + if (unlikely(res <= 0)) { | ||
8893 | kvfree(p); | ||
8894 | + *pages = NULL; | ||
8895 | return res; | ||
8896 | } | ||
8897 | *pages = p; | ||
8898 | diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c | ||
8899 | index 156f26fdc4c91..dd80989ca5a6b 100644 | ||
8900 | --- a/lib/xz/xz_dec_lzma2.c | ||
8901 | +++ b/lib/xz/xz_dec_lzma2.c | ||
8902 | @@ -387,7 +387,14 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b, | ||
8903 | |||
8904 | *left -= copy_size; | ||
8905 | |||
8906 | - memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size); | ||
8907 | + /* | ||
8908 | + * If doing in-place decompression in single-call mode and the | ||
8909 | + * uncompressed size of the file is larger than the caller | ||
8910 | + * thought (i.e. it is invalid input!), the buffers below may | ||
8911 | + * overlap and cause undefined behavior with memcpy(). | ||
8912 | + * With valid inputs memcpy() would be fine here. | ||
8913 | + */ | ||
8914 | + memmove(dict->buf + dict->pos, b->in + b->in_pos, copy_size); | ||
8915 | dict->pos += copy_size; | ||
8916 | |||
8917 | if (dict->full < dict->pos) | ||
8918 | @@ -397,7 +404,11 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b, | ||
8919 | if (dict->pos == dict->end) | ||
8920 | dict->pos = 0; | ||
8921 | |||
8922 | - memcpy(b->out + b->out_pos, b->in + b->in_pos, | ||
8923 | + /* | ||
8924 | + * Like above but for multi-call mode: use memmove() | ||
8925 | + * to avoid undefined behavior with invalid input. | ||
8926 | + */ | ||
8927 | + memmove(b->out + b->out_pos, b->in + b->in_pos, | ||
8928 | copy_size); | ||
8929 | } | ||
8930 | |||
8931 | @@ -421,6 +432,12 @@ static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b) | ||
8932 | if (dict->pos == dict->end) | ||
8933 | dict->pos = 0; | ||
8934 | |||
8935 | + /* | ||
8936 | + * These buffers cannot overlap even if doing in-place | ||
8937 | + * decompression because in multi-call mode dict->buf | ||
8938 | + * has been allocated by us in this file; it's not | ||
8939 | + * provided by the caller like in single-call mode. | ||
8940 | + */ | ||
8941 | memcpy(b->out + b->out_pos, dict->buf + dict->start, | ||
8942 | copy_size); | ||
8943 | } | ||
8944 | diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c | ||
8945 | index bd1d182419d7e..0b161f90d8d80 100644 | ||
8946 | --- a/lib/xz/xz_dec_stream.c | ||
8947 | +++ b/lib/xz/xz_dec_stream.c | ||
8948 | @@ -402,12 +402,12 @@ static enum xz_ret dec_stream_header(struct xz_dec *s) | ||
8949 | * we will accept other check types too, but then the check won't | ||
8950 | * be verified and a warning (XZ_UNSUPPORTED_CHECK) will be given. | ||
8951 | */ | ||
8952 | + if (s->temp.buf[HEADER_MAGIC_SIZE + 1] > XZ_CHECK_MAX) | ||
8953 | + return XZ_OPTIONS_ERROR; | ||
8954 | + | ||
8955 | s->check_type = s->temp.buf[HEADER_MAGIC_SIZE + 1]; | ||
8956 | |||
8957 | #ifdef XZ_DEC_ANY_CHECK | ||
8958 | - if (s->check_type > XZ_CHECK_MAX) | ||
8959 | - return XZ_OPTIONS_ERROR; | ||
8960 | - | ||
8961 | if (s->check_type > XZ_CHECK_CRC32) | ||
8962 | return XZ_UNSUPPORTED_CHECK; | ||
8963 | #else | ||
8964 | diff --git a/mm/oom_kill.c b/mm/oom_kill.c | ||
8965 | index f1b810ddf2327..dcbb9a28706fc 100644 | ||
8966 | --- a/mm/oom_kill.c | ||
8967 | +++ b/mm/oom_kill.c | ||
8968 | @@ -1114,25 +1114,22 @@ bool out_of_memory(struct oom_control *oc) | ||
8969 | } | ||
8970 | |||
8971 | /* | ||
8972 | - * The pagefault handler calls here because it is out of memory, so kill a | ||
8973 | - * memory-hogging task. If oom_lock is held by somebody else, a parallel oom | ||
8974 | - * killing is already in progress so do nothing. | ||
8975 | + * The pagefault handler calls here because some allocation has failed. We have | ||
8976 | + * to take care of the memcg OOM here because this is the only safe context without | ||
8977 | + * any locks held but let the oom killer triggered from the allocation context care | ||
8978 | + * about the global OOM. | ||
8979 | */ | ||
8980 | void pagefault_out_of_memory(void) | ||
8981 | { | ||
8982 | - struct oom_control oc = { | ||
8983 | - .zonelist = NULL, | ||
8984 | - .nodemask = NULL, | ||
8985 | - .memcg = NULL, | ||
8986 | - .gfp_mask = 0, | ||
8987 | - .order = 0, | ||
8988 | - }; | ||
8989 | + static DEFINE_RATELIMIT_STATE(pfoom_rs, DEFAULT_RATELIMIT_INTERVAL, | ||
8990 | + DEFAULT_RATELIMIT_BURST); | ||
8991 | |||
8992 | if (mem_cgroup_oom_synchronize(true)) | ||
8993 | return; | ||
8994 | |||
8995 | - if (!mutex_trylock(&oom_lock)) | ||
8996 | + if (fatal_signal_pending(current)) | ||
8997 | return; | ||
8998 | - out_of_memory(&oc); | ||
8999 | - mutex_unlock(&oom_lock); | ||
9000 | + | ||
9001 | + if (__ratelimit(&pfoom_rs)) | ||
9002 | + pr_warn("Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF\n"); | ||
9003 | } | ||
9004 | diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c | ||
9005 | index 443b3b1c95818..490e5f3ae614a 100644 | ||
9006 | --- a/mm/zsmalloc.c | ||
9007 | +++ b/mm/zsmalloc.c | ||
9008 | @@ -1835,10 +1835,11 @@ static inline void zs_pool_dec_isolated(struct zs_pool *pool) | ||
9009 | VM_BUG_ON(atomic_long_read(&pool->isolated_pages) <= 0); | ||
9010 | atomic_long_dec(&pool->isolated_pages); | ||
9011 | /* | ||
9012 | - * There's no possibility of racing, since wait_for_isolated_drain() | ||
9013 | - * checks the isolated count under &class->lock after enqueuing | ||
9014 | - * on migration_wait. | ||
9015 | + * Checking pool->destroying must happen after atomic_long_dec() | ||
9016 | + * for pool->isolated_pages above. Paired with the smp_mb() in | ||
9017 | + * zs_unregister_migration(). | ||
9018 | */ | ||
9019 | + smp_mb__after_atomic(); | ||
9020 | if (atomic_long_read(&pool->isolated_pages) == 0 && pool->destroying) | ||
9021 | wake_up_all(&pool->migration_wait); | ||
9022 | } | ||
9023 | diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c | ||
9024 | index 3f47abf9ef4a6..cd7c0429cddf8 100644 | ||
9025 | --- a/net/8021q/vlan.c | ||
9026 | +++ b/net/8021q/vlan.c | ||
9027 | @@ -116,9 +116,6 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head) | ||
9028 | } | ||
9029 | |||
9030 | vlan_vid_del(real_dev, vlan->vlan_proto, vlan_id); | ||
9031 | - | ||
9032 | - /* Get rid of the vlan's reference to real_dev */ | ||
9033 | - dev_put(real_dev); | ||
9034 | } | ||
9035 | |||
9036 | int vlan_check_real_dev(struct net_device *real_dev, | ||
9037 | diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c | ||
9038 | index 2a78da4072de9..415a29d42cdf0 100644 | ||
9039 | --- a/net/8021q/vlan_dev.c | ||
9040 | +++ b/net/8021q/vlan_dev.c | ||
9041 | @@ -790,6 +790,9 @@ static void vlan_dev_free(struct net_device *dev) | ||
9042 | |||
9043 | free_percpu(vlan->vlan_pcpu_stats); | ||
9044 | vlan->vlan_pcpu_stats = NULL; | ||
9045 | + | ||
9046 | + /* Get rid of the vlan's reference to real_dev */ | ||
9047 | + dev_put(vlan->real_dev); | ||
9048 | } | ||
9049 | |||
9050 | void vlan_setup(struct net_device *dev) | ||
9051 | diff --git a/net/9p/client.c b/net/9p/client.c | ||
9052 | index 1d48afc7033ca..b03fce66eb8de 100644 | ||
9053 | --- a/net/9p/client.c | ||
9054 | +++ b/net/9p/client.c | ||
9055 | @@ -538,6 +538,8 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | ||
9056 | kfree(ename); | ||
9057 | } else { | ||
9058 | err = p9pdu_readf(&req->rc, c->proto_version, "d", &ecode); | ||
9059 | + if (err) | ||
9060 | + goto out_err; | ||
9061 | err = -ecode; | ||
9062 | |||
9063 | p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode); | ||
9064 | diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c | ||
9065 | index 82e76ff01267a..08e9f332adad3 100644 | ||
9066 | --- a/net/bluetooth/l2cap_sock.c | ||
9067 | +++ b/net/bluetooth/l2cap_sock.c | ||
9068 | @@ -1347,6 +1347,9 @@ static void l2cap_sock_close_cb(struct l2cap_chan *chan) | ||
9069 | { | ||
9070 | struct sock *sk = chan->data; | ||
9071 | |||
9072 | + if (!sk) | ||
9073 | + return; | ||
9074 | + | ||
9075 | l2cap_sock_kill(sk); | ||
9076 | } | ||
9077 | |||
9078 | @@ -1355,6 +1358,9 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err) | ||
9079 | struct sock *sk = chan->data; | ||
9080 | struct sock *parent; | ||
9081 | |||
9082 | + if (!sk) | ||
9083 | + return; | ||
9084 | + | ||
9085 | BT_DBG("chan %p state %s", chan, state_to_string(chan->state)); | ||
9086 | |||
9087 | /* This callback can be called both for server (BT_LISTEN) | ||
9088 | @@ -1538,8 +1544,10 @@ static void l2cap_sock_destruct(struct sock *sk) | ||
9089 | { | ||
9090 | BT_DBG("sk %p", sk); | ||
9091 | |||
9092 | - if (l2cap_pi(sk)->chan) | ||
9093 | + if (l2cap_pi(sk)->chan) { | ||
9094 | + l2cap_pi(sk)->chan->data = NULL; | ||
9095 | l2cap_chan_put(l2cap_pi(sk)->chan); | ||
9096 | + } | ||
9097 | |||
9098 | if (l2cap_pi(sk)->rx_busy_skb) { | ||
9099 | kfree_skb(l2cap_pi(sk)->rx_busy_skb); | ||
9100 | diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c | ||
9101 | index 1915943bb646a..2c616c1c62958 100644 | ||
9102 | --- a/net/bluetooth/sco.c | ||
9103 | +++ b/net/bluetooth/sco.c | ||
9104 | @@ -133,6 +133,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon) | ||
9105 | return NULL; | ||
9106 | |||
9107 | spin_lock_init(&conn->lock); | ||
9108 | + INIT_DELAYED_WORK(&conn->timeout_work, sco_sock_timeout); | ||
9109 | |||
9110 | hcon->sco_data = conn; | ||
9111 | conn->hcon = hcon; | ||
9112 | @@ -196,11 +197,11 @@ static void sco_conn_del(struct hci_conn *hcon, int err) | ||
9113 | sco_chan_del(sk, err); | ||
9114 | bh_unlock_sock(sk); | ||
9115 | sock_put(sk); | ||
9116 | - | ||
9117 | - /* Ensure no more work items will run before freeing conn. */ | ||
9118 | - cancel_delayed_work_sync(&conn->timeout_work); | ||
9119 | } | ||
9120 | |||
9121 | + /* Ensure no more work items will run before freeing conn. */ | ||
9122 | + cancel_delayed_work_sync(&conn->timeout_work); | ||
9123 | + | ||
9124 | hcon->sco_data = NULL; | ||
9125 | kfree(conn); | ||
9126 | } | ||
9127 | @@ -213,8 +214,6 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, | ||
9128 | sco_pi(sk)->conn = conn; | ||
9129 | conn->sk = sk; | ||
9130 | |||
9131 | - INIT_DELAYED_WORK(&conn->timeout_work, sco_sock_timeout); | ||
9132 | - | ||
9133 | if (parent) | ||
9134 | bt_accept_enqueue(parent, sk, true); | ||
9135 | } | ||
9136 | @@ -280,7 +279,8 @@ static int sco_connect(struct hci_dev *hdev, struct sock *sk) | ||
9137 | return err; | ||
9138 | } | ||
9139 | |||
9140 | -static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len) | ||
9141 | +static int sco_send_frame(struct sock *sk, void *buf, int len, | ||
9142 | + unsigned int msg_flags) | ||
9143 | { | ||
9144 | struct sco_conn *conn = sco_pi(sk)->conn; | ||
9145 | struct sk_buff *skb; | ||
9146 | @@ -292,15 +292,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len) | ||
9147 | |||
9148 | BT_DBG("sk %p len %d", sk, len); | ||
9149 | |||
9150 | - skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err); | ||
9151 | + skb = bt_skb_send_alloc(sk, len, msg_flags & MSG_DONTWAIT, &err); | ||
9152 | if (!skb) | ||
9153 | return err; | ||
9154 | |||
9155 | - if (memcpy_from_msg(skb_put(skb, len), msg, len)) { | ||
9156 | - kfree_skb(skb); | ||
9157 | - return -EFAULT; | ||
9158 | - } | ||
9159 | - | ||
9160 | + memcpy(skb_put(skb, len), buf, len); | ||
9161 | hci_send_sco(conn->hcon, skb); | ||
9162 | |||
9163 | return len; | ||
9164 | @@ -714,6 +710,7 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg, | ||
9165 | size_t len) | ||
9166 | { | ||
9167 | struct sock *sk = sock->sk; | ||
9168 | + void *buf; | ||
9169 | int err; | ||
9170 | |||
9171 | BT_DBG("sock %p, sk %p", sock, sk); | ||
9172 | @@ -725,14 +722,24 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg, | ||
9173 | if (msg->msg_flags & MSG_OOB) | ||
9174 | return -EOPNOTSUPP; | ||
9175 | |||
9176 | + buf = kmalloc(len, GFP_KERNEL); | ||
9177 | + if (!buf) | ||
9178 | + return -ENOMEM; | ||
9179 | + | ||
9180 | + if (memcpy_from_msg(buf, msg, len)) { | ||
9181 | + kfree(buf); | ||
9182 | + return -EFAULT; | ||
9183 | + } | ||
9184 | + | ||
9185 | lock_sock(sk); | ||
9186 | |||
9187 | if (sk->sk_state == BT_CONNECTED) | ||
9188 | - err = sco_send_frame(sk, msg, len); | ||
9189 | + err = sco_send_frame(sk, buf, len, msg->msg_flags); | ||
9190 | else | ||
9191 | err = -ENOTCONN; | ||
9192 | |||
9193 | release_sock(sk); | ||
9194 | + kfree(buf); | ||
9195 | return err; | ||
9196 | } | ||
9197 | |||
9198 | diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c | ||
9199 | index 266c189f1e809..ca75d1b8f415c 100644 | ||
9200 | --- a/net/can/j1939/main.c | ||
9201 | +++ b/net/can/j1939/main.c | ||
9202 | @@ -75,6 +75,13 @@ static void j1939_can_recv(struct sk_buff *iskb, void *data) | ||
9203 | skcb->addr.pgn = (cf->can_id >> 8) & J1939_PGN_MAX; | ||
9204 | /* set default message type */ | ||
9205 | skcb->addr.type = J1939_TP; | ||
9206 | + | ||
9207 | + if (!j1939_address_is_valid(skcb->addr.sa)) { | ||
9208 | + netdev_err_once(priv->ndev, "%s: sa is broadcast address, ignoring!\n", | ||
9209 | + __func__); | ||
9210 | + goto done; | ||
9211 | + } | ||
9212 | + | ||
9213 | if (j1939_pgn_is_pdu1(skcb->addr.pgn)) { | ||
9214 | /* Type 1: with destination address */ | ||
9215 | skcb->addr.da = skcb->addr.pgn; | ||
9216 | diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c | ||
9217 | index 7a54170da09df..811682e06951b 100644 | ||
9218 | --- a/net/can/j1939/transport.c | ||
9219 | +++ b/net/can/j1939/transport.c | ||
9220 | @@ -2065,6 +2065,12 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb) | ||
9221 | break; | ||
9222 | |||
9223 | case J1939_ETP_CMD_ABORT: /* && J1939_TP_CMD_ABORT */ | ||
9224 | + if (j1939_cb_is_broadcast(skcb)) { | ||
9225 | + netdev_err_once(priv->ndev, "%s: abort to broadcast (%02x), ignoring!\n", | ||
9226 | + __func__, skcb->addr.sa); | ||
9227 | + return; | ||
9228 | + } | ||
9229 | + | ||
9230 | if (j1939_tp_im_transmitter(skcb)) | ||
9231 | j1939_xtp_rx_abort(priv, skb, true); | ||
9232 | |||
9233 | diff --git a/net/core/dev.c b/net/core/dev.c | ||
9234 | index e4e492bf72af0..ff336417c9b90 100644 | ||
9235 | --- a/net/core/dev.c | ||
9236 | +++ b/net/core/dev.c | ||
9237 | @@ -2589,6 +2589,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) | ||
9238 | if (dev->num_tc) | ||
9239 | netif_setup_tc(dev, txq); | ||
9240 | |||
9241 | + dev_qdisc_change_real_num_tx(dev, txq); | ||
9242 | + | ||
9243 | dev->real_num_tx_queues = txq; | ||
9244 | |||
9245 | if (disabling) { | ||
9246 | @@ -3487,7 +3489,8 @@ int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *skb) | ||
9247 | skb_reset_mac_header(skb); | ||
9248 | __skb_pull(skb, skb_network_offset(skb)); | ||
9249 | skb->pkt_type = PACKET_LOOPBACK; | ||
9250 | - skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
9251 | + if (skb->ip_summed == CHECKSUM_NONE) | ||
9252 | + skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
9253 | WARN_ON(!skb_dst(skb)); | ||
9254 | skb_dst_force(skb); | ||
9255 | netif_rx_ni(skb); | ||
9256 | diff --git a/net/core/filter.c b/net/core/filter.c | ||
9257 | index 0e161a6dff7e5..5ebc973ed4c50 100644 | ||
9258 | --- a/net/core/filter.c | ||
9259 | +++ b/net/core/filter.c | ||
9260 | @@ -8356,6 +8356,27 @@ static u32 sk_skb_convert_ctx_access(enum bpf_access_type type, | ||
9261 | *insn++ = BPF_LDX_MEM(BPF_SIZEOF(void *), si->dst_reg, | ||
9262 | si->src_reg, off); | ||
9263 | break; | ||
9264 | + case offsetof(struct __sk_buff, cb[0]) ... | ||
9265 | + offsetofend(struct __sk_buff, cb[4]) - 1: | ||
9266 | + BUILD_BUG_ON(sizeof_field(struct sk_skb_cb, data) < 20); | ||
9267 | + BUILD_BUG_ON((offsetof(struct sk_buff, cb) + | ||
9268 | + offsetof(struct sk_skb_cb, data)) % | ||
9269 | + sizeof(__u64)); | ||
9270 | + | ||
9271 | + prog->cb_access = 1; | ||
9272 | + off = si->off; | ||
9273 | + off -= offsetof(struct __sk_buff, cb[0]); | ||
9274 | + off += offsetof(struct sk_buff, cb); | ||
9275 | + off += offsetof(struct sk_skb_cb, data); | ||
9276 | + if (type == BPF_WRITE) | ||
9277 | + *insn++ = BPF_STX_MEM(BPF_SIZE(si->code), si->dst_reg, | ||
9278 | + si->src_reg, off); | ||
9279 | + else | ||
9280 | + *insn++ = BPF_LDX_MEM(BPF_SIZE(si->code), si->dst_reg, | ||
9281 | + si->src_reg, off); | ||
9282 | + break; | ||
9283 | + | ||
9284 | + | ||
9285 | default: | ||
9286 | return bpf_convert_ctx_access(type, si, insn_buf, prog, | ||
9287 | target_size); | ||
9288 | diff --git a/net/core/neighbour.c b/net/core/neighbour.c | ||
9289 | index f94d405358a21..02e55041a8813 100644 | ||
9290 | --- a/net/core/neighbour.c | ||
9291 | +++ b/net/core/neighbour.c | ||
9292 | @@ -380,7 +380,7 @@ EXPORT_SYMBOL(neigh_ifdown); | ||
9293 | |||
9294 | static struct neighbour *neigh_alloc(struct neigh_table *tbl, | ||
9295 | struct net_device *dev, | ||
9296 | - bool exempt_from_gc) | ||
9297 | + u8 flags, bool exempt_from_gc) | ||
9298 | { | ||
9299 | struct neighbour *n = NULL; | ||
9300 | unsigned long now = jiffies; | ||
9301 | @@ -413,6 +413,7 @@ do_alloc: | ||
9302 | n->updated = n->used = now; | ||
9303 | n->nud_state = NUD_NONE; | ||
9304 | n->output = neigh_blackhole; | ||
9305 | + n->flags = flags; | ||
9306 | seqlock_init(&n->hh.hh_lock); | ||
9307 | n->parms = neigh_parms_clone(&tbl->parms); | ||
9308 | timer_setup(&n->timer, neigh_timer_handler, 0); | ||
9309 | @@ -576,19 +577,18 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, | ||
9310 | } | ||
9311 | EXPORT_SYMBOL(neigh_lookup_nodev); | ||
9312 | |||
9313 | -static struct neighbour *___neigh_create(struct neigh_table *tbl, | ||
9314 | - const void *pkey, | ||
9315 | - struct net_device *dev, | ||
9316 | - bool exempt_from_gc, bool want_ref) | ||
9317 | +static struct neighbour * | ||
9318 | +___neigh_create(struct neigh_table *tbl, const void *pkey, | ||
9319 | + struct net_device *dev, u8 flags, | ||
9320 | + bool exempt_from_gc, bool want_ref) | ||
9321 | { | ||
9322 | - struct neighbour *n1, *rc, *n = neigh_alloc(tbl, dev, exempt_from_gc); | ||
9323 | - u32 hash_val; | ||
9324 | - unsigned int key_len = tbl->key_len; | ||
9325 | - int error; | ||
9326 | + u32 hash_val, key_len = tbl->key_len; | ||
9327 | + struct neighbour *n1, *rc, *n; | ||
9328 | struct neigh_hash_table *nht; | ||
9329 | + int error; | ||
9330 | |||
9331 | + n = neigh_alloc(tbl, dev, flags, exempt_from_gc); | ||
9332 | trace_neigh_create(tbl, dev, pkey, n, exempt_from_gc); | ||
9333 | - | ||
9334 | if (!n) { | ||
9335 | rc = ERR_PTR(-ENOBUFS); | ||
9336 | goto out; | ||
9337 | @@ -675,7 +675,7 @@ out_neigh_release: | ||
9338 | struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey, | ||
9339 | struct net_device *dev, bool want_ref) | ||
9340 | { | ||
9341 | - return ___neigh_create(tbl, pkey, dev, false, want_ref); | ||
9342 | + return ___neigh_create(tbl, pkey, dev, 0, false, want_ref); | ||
9343 | } | ||
9344 | EXPORT_SYMBOL(__neigh_create); | ||
9345 | |||
9346 | @@ -1221,7 +1221,7 @@ static void neigh_update_hhs(struct neighbour *neigh) | ||
9347 | lladdr instead of overriding it | ||
9348 | if it is different. | ||
9349 | NEIGH_UPDATE_F_ADMIN means that the change is administrative. | ||
9350 | - | ||
9351 | + NEIGH_UPDATE_F_USE means that the entry is user triggered. | ||
9352 | NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing | ||
9353 | NTF_ROUTER flag. | ||
9354 | NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as | ||
9355 | @@ -1259,6 +1259,12 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr, | ||
9356 | goto out; | ||
9357 | |||
9358 | ext_learn_change = neigh_update_ext_learned(neigh, flags, ¬ify); | ||
9359 | + if (flags & NEIGH_UPDATE_F_USE) { | ||
9360 | + new = old & ~NUD_PERMANENT; | ||
9361 | + neigh->nud_state = new; | ||
9362 | + err = 0; | ||
9363 | + goto out; | ||
9364 | + } | ||
9365 | |||
9366 | if (!(new & NUD_VALID)) { | ||
9367 | neigh_del_timer(neigh); | ||
9368 | @@ -1945,7 +1951,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, | ||
9369 | |||
9370 | exempt_from_gc = ndm->ndm_state & NUD_PERMANENT || | ||
9371 | ndm->ndm_flags & NTF_EXT_LEARNED; | ||
9372 | - neigh = ___neigh_create(tbl, dst, dev, exempt_from_gc, true); | ||
9373 | + neigh = ___neigh_create(tbl, dst, dev, | ||
9374 | + ndm->ndm_flags & NTF_EXT_LEARNED, | ||
9375 | + exempt_from_gc, true); | ||
9376 | if (IS_ERR(neigh)) { | ||
9377 | err = PTR_ERR(neigh); | ||
9378 | goto out; | ||
9379 | @@ -1964,22 +1972,20 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, | ||
9380 | |||
9381 | if (protocol) | ||
9382 | neigh->protocol = protocol; | ||
9383 | - | ||
9384 | if (ndm->ndm_flags & NTF_EXT_LEARNED) | ||
9385 | flags |= NEIGH_UPDATE_F_EXT_LEARNED; | ||
9386 | - | ||
9387 | if (ndm->ndm_flags & NTF_ROUTER) | ||
9388 | flags |= NEIGH_UPDATE_F_ISROUTER; | ||
9389 | + if (ndm->ndm_flags & NTF_USE) | ||
9390 | + flags |= NEIGH_UPDATE_F_USE; | ||
9391 | |||
9392 | - if (ndm->ndm_flags & NTF_USE) { | ||
9393 | + err = __neigh_update(neigh, lladdr, ndm->ndm_state, flags, | ||
9394 | + NETLINK_CB(skb).portid, extack); | ||
9395 | + if (!err && ndm->ndm_flags & NTF_USE) { | ||
9396 | neigh_event_send(neigh, NULL); | ||
9397 | err = 0; | ||
9398 | - } else | ||
9399 | - err = __neigh_update(neigh, lladdr, ndm->ndm_state, flags, | ||
9400 | - NETLINK_CB(skb).portid, extack); | ||
9401 | - | ||
9402 | + } | ||
9403 | neigh_release(neigh); | ||
9404 | - | ||
9405 | out: | ||
9406 | return err; | ||
9407 | } | ||
9408 | diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c | ||
9409 | index 98474d85fb51f..05b0c60bfba2b 100644 | ||
9410 | --- a/net/core/net-sysfs.c | ||
9411 | +++ b/net/core/net-sysfs.c | ||
9412 | @@ -174,6 +174,14 @@ static int change_carrier(struct net_device *dev, unsigned long new_carrier) | ||
9413 | static ssize_t carrier_store(struct device *dev, struct device_attribute *attr, | ||
9414 | const char *buf, size_t len) | ||
9415 | { | ||
9416 | + struct net_device *netdev = to_net_dev(dev); | ||
9417 | + | ||
9418 | + /* The check is also done in change_carrier; this helps returning early | ||
9419 | + * without hitting the trylock/restart in netdev_store. | ||
9420 | + */ | ||
9421 | + if (!netdev->netdev_ops->ndo_change_carrier) | ||
9422 | + return -EOPNOTSUPP; | ||
9423 | + | ||
9424 | return netdev_store(dev, attr, buf, len, change_carrier); | ||
9425 | } | ||
9426 | |||
9427 | @@ -195,6 +203,12 @@ static ssize_t speed_show(struct device *dev, | ||
9428 | struct net_device *netdev = to_net_dev(dev); | ||
9429 | int ret = -EINVAL; | ||
9430 | |||
9431 | + /* The check is also done in __ethtool_get_link_ksettings; this helps | ||
9432 | + * returning early without hitting the trylock/restart below. | ||
9433 | + */ | ||
9434 | + if (!netdev->ethtool_ops->get_link_ksettings) | ||
9435 | + return ret; | ||
9436 | + | ||
9437 | if (!rtnl_trylock()) | ||
9438 | return restart_syscall(); | ||
9439 | |||
9440 | @@ -215,6 +229,12 @@ static ssize_t duplex_show(struct device *dev, | ||
9441 | struct net_device *netdev = to_net_dev(dev); | ||
9442 | int ret = -EINVAL; | ||
9443 | |||
9444 | + /* The check is also done in __ethtool_get_link_ksettings; this helps | ||
9445 | + * returning early without hitting the trylock/restart below. | ||
9446 | + */ | ||
9447 | + if (!netdev->ethtool_ops->get_link_ksettings) | ||
9448 | + return ret; | ||
9449 | + | ||
9450 | if (!rtnl_trylock()) | ||
9451 | return restart_syscall(); | ||
9452 | |||
9453 | @@ -438,6 +458,14 @@ static ssize_t proto_down_store(struct device *dev, | ||
9454 | struct device_attribute *attr, | ||
9455 | const char *buf, size_t len) | ||
9456 | { | ||
9457 | + struct net_device *netdev = to_net_dev(dev); | ||
9458 | + | ||
9459 | + /* The check is also done in change_proto_down; this helps returning | ||
9460 | + * early without hitting the trylock/restart in netdev_store. | ||
9461 | + */ | ||
9462 | + if (!netdev->netdev_ops->ndo_change_proto_down) | ||
9463 | + return -EOPNOTSUPP; | ||
9464 | + | ||
9465 | return netdev_store(dev, attr, buf, len, change_proto_down); | ||
9466 | } | ||
9467 | NETDEVICE_SHOW_RW(proto_down, fmt_dec); | ||
9468 | @@ -448,6 +476,12 @@ static ssize_t phys_port_id_show(struct device *dev, | ||
9469 | struct net_device *netdev = to_net_dev(dev); | ||
9470 | ssize_t ret = -EINVAL; | ||
9471 | |||
9472 | + /* The check is also done in dev_get_phys_port_id; this helps returning | ||
9473 | + * early without hitting the trylock/restart below. | ||
9474 | + */ | ||
9475 | + if (!netdev->netdev_ops->ndo_get_phys_port_id) | ||
9476 | + return -EOPNOTSUPP; | ||
9477 | + | ||
9478 | if (!rtnl_trylock()) | ||
9479 | return restart_syscall(); | ||
9480 | |||
9481 | @@ -470,6 +504,13 @@ static ssize_t phys_port_name_show(struct device *dev, | ||
9482 | struct net_device *netdev = to_net_dev(dev); | ||
9483 | ssize_t ret = -EINVAL; | ||
9484 | |||
9485 | + /* The checks are also done in dev_get_phys_port_name; this helps | ||
9486 | + * returning early without hitting the trylock/restart below. | ||
9487 | + */ | ||
9488 | + if (!netdev->netdev_ops->ndo_get_phys_port_name && | ||
9489 | + !netdev->netdev_ops->ndo_get_devlink_port) | ||
9490 | + return -EOPNOTSUPP; | ||
9491 | + | ||
9492 | if (!rtnl_trylock()) | ||
9493 | return restart_syscall(); | ||
9494 | |||
9495 | @@ -492,6 +533,14 @@ static ssize_t phys_switch_id_show(struct device *dev, | ||
9496 | struct net_device *netdev = to_net_dev(dev); | ||
9497 | ssize_t ret = -EINVAL; | ||
9498 | |||
9499 | + /* The checks are also done in dev_get_phys_port_name; this helps | ||
9500 | + * returning early without hitting the trylock/restart below. This works | ||
9501 | + * because recurse is false when calling dev_get_port_parent_id. | ||
9502 | + */ | ||
9503 | + if (!netdev->netdev_ops->ndo_get_port_parent_id && | ||
9504 | + !netdev->netdev_ops->ndo_get_devlink_port) | ||
9505 | + return -EOPNOTSUPP; | ||
9506 | + | ||
9507 | if (!rtnl_trylock()) | ||
9508 | return restart_syscall(); | ||
9509 | |||
9510 | @@ -1097,6 +1146,12 @@ static ssize_t tx_maxrate_store(struct netdev_queue *queue, | ||
9511 | if (!capable(CAP_NET_ADMIN)) | ||
9512 | return -EPERM; | ||
9513 | |||
9514 | + /* The check is also done later; this helps returning early without | ||
9515 | + * hitting the trylock/restart below. | ||
9516 | + */ | ||
9517 | + if (!dev->netdev_ops->ndo_set_tx_maxrate) | ||
9518 | + return -EOPNOTSUPP; | ||
9519 | + | ||
9520 | err = kstrtou32(buf, 10, &rate); | ||
9521 | if (err < 0) | ||
9522 | return err; | ||
9523 | diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c | ||
9524 | index 9bf15512601bf..cd1d40195e461 100644 | ||
9525 | --- a/net/core/net_namespace.c | ||
9526 | +++ b/net/core/net_namespace.c | ||
9527 | @@ -480,7 +480,9 @@ struct net *copy_net_ns(unsigned long flags, | ||
9528 | |||
9529 | if (rv < 0) { | ||
9530 | put_userns: | ||
9531 | +#ifdef CONFIG_KEYS | ||
9532 | key_remove_domain(net->key_domain); | ||
9533 | +#endif | ||
9534 | put_user_ns(user_ns); | ||
9535 | net_drop_ns(net); | ||
9536 | dec_ucounts: | ||
9537 | @@ -612,7 +614,9 @@ static void cleanup_net(struct work_struct *work) | ||
9538 | list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) { | ||
9539 | list_del_init(&net->exit_list); | ||
9540 | dec_net_namespaces(net->ucounts); | ||
9541 | +#ifdef CONFIG_KEYS | ||
9542 | key_remove_domain(net->key_domain); | ||
9543 | +#endif | ||
9544 | put_user_ns(net->user_ns); | ||
9545 | net_drop_ns(net); | ||
9546 | } | ||
9547 | diff --git a/net/core/stream.c b/net/core/stream.c | ||
9548 | index 4f1d4aa5fb38d..a166a32b411fa 100644 | ||
9549 | --- a/net/core/stream.c | ||
9550 | +++ b/net/core/stream.c | ||
9551 | @@ -195,9 +195,6 @@ void sk_stream_kill_queues(struct sock *sk) | ||
9552 | /* First the read buffer. */ | ||
9553 | __skb_queue_purge(&sk->sk_receive_queue); | ||
9554 | |||
9555 | - /* Next, the error queue. */ | ||
9556 | - __skb_queue_purge(&sk->sk_error_queue); | ||
9557 | - | ||
9558 | /* Next, the write queue. */ | ||
9559 | WARN_ON(!skb_queue_empty(&sk->sk_write_queue)); | ||
9560 | |||
9561 | diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c | ||
9562 | index 669cbe1609d9e..48041f50ecfb4 100644 | ||
9563 | --- a/net/core/sysctl_net_core.c | ||
9564 | +++ b/net/core/sysctl_net_core.c | ||
9565 | @@ -424,7 +424,7 @@ static struct ctl_table net_core_table[] = { | ||
9566 | .mode = 0600, | ||
9567 | .proc_handler = proc_dolongvec_minmax_bpf_restricted, | ||
9568 | .extra1 = &long_one, | ||
9569 | - .extra2 = &long_max, | ||
9570 | + .extra2 = &bpf_jit_limit_max, | ||
9571 | }, | ||
9572 | #endif | ||
9573 | { | ||
9574 | diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c | ||
9575 | index 5c8d0fb498256..9f53d25e047e3 100644 | ||
9576 | --- a/net/ipv4/tcp.c | ||
9577 | +++ b/net/ipv4/tcp.c | ||
9578 | @@ -955,7 +955,7 @@ static int tcp_send_mss(struct sock *sk, int *size_goal, int flags) | ||
9579 | */ | ||
9580 | static void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb) | ||
9581 | { | ||
9582 | - if (skb && !skb->len) { | ||
9583 | + if (skb && TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { | ||
9584 | tcp_unlink_write_queue(skb, sk); | ||
9585 | if (tcp_write_queue_empty(sk)) | ||
9586 | tcp_chrono_stop(sk, TCP_CHRONO_BUSY); | ||
9587 | diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c | ||
9588 | index 366c3792b8604..d1f29a3eb70be 100644 | ||
9589 | --- a/net/ipv6/addrconf.c | ||
9590 | +++ b/net/ipv6/addrconf.c | ||
9591 | @@ -3111,6 +3111,9 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) | ||
9592 | memcpy(&addr.s6_addr32[3], idev->dev->dev_addr, 4); | ||
9593 | |||
9594 | if (idev->dev->flags&IFF_POINTOPOINT) { | ||
9595 | + if (idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_NONE) | ||
9596 | + return; | ||
9597 | + | ||
9598 | addr.s6_addr32[0] = htonl(0xfe800000); | ||
9599 | scope = IFA_LINK; | ||
9600 | plen = 64; | ||
9601 | diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c | ||
9602 | index 0f57c682afdd8..818fc99756256 100644 | ||
9603 | --- a/net/ipv6/udp.c | ||
9604 | +++ b/net/ipv6/udp.c | ||
9605 | @@ -1363,7 +1363,6 @@ do_udp_sendmsg: | ||
9606 | if (!fl6.flowi6_oif) | ||
9607 | fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; | ||
9608 | |||
9609 | - fl6.flowi6_mark = ipc6.sockc.mark; | ||
9610 | fl6.flowi6_uid = sk->sk_uid; | ||
9611 | |||
9612 | if (msg->msg_controllen) { | ||
9613 | @@ -1399,6 +1398,7 @@ do_udp_sendmsg: | ||
9614 | ipc6.opt = opt; | ||
9615 | |||
9616 | fl6.flowi6_proto = sk->sk_protocol; | ||
9617 | + fl6.flowi6_mark = ipc6.sockc.mark; | ||
9618 | fl6.daddr = *daddr; | ||
9619 | if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) | ||
9620 | fl6.saddr = np->saddr; | ||
9621 | diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c | ||
9622 | index 7365b43f8f980..e3a2d018f4ec5 100644 | ||
9623 | --- a/net/netfilter/nf_conntrack_proto_udp.c | ||
9624 | +++ b/net/netfilter/nf_conntrack_proto_udp.c | ||
9625 | @@ -105,15 +105,18 @@ int nf_conntrack_udp_packet(struct nf_conn *ct, | ||
9626 | */ | ||
9627 | if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { | ||
9628 | unsigned long extra = timeouts[UDP_CT_UNREPLIED]; | ||
9629 | + bool stream = false; | ||
9630 | |||
9631 | /* Still active after two seconds? Extend timeout. */ | ||
9632 | - if (time_after(jiffies, ct->proto.udp.stream_ts)) | ||
9633 | + if (time_after(jiffies, ct->proto.udp.stream_ts)) { | ||
9634 | extra = timeouts[UDP_CT_REPLIED]; | ||
9635 | + stream = true; | ||
9636 | + } | ||
9637 | |||
9638 | nf_ct_refresh_acct(ct, ctinfo, skb, extra); | ||
9639 | |||
9640 | /* Also, more likely to be important, and not a probe */ | ||
9641 | - if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) | ||
9642 | + if (stream && !test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) | ||
9643 | nf_conntrack_event_cache(IPCT_ASSURED, ct); | ||
9644 | } else { | ||
9645 | nf_ct_refresh_acct(ct, ctinfo, skb, | ||
9646 | diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c | ||
9647 | index 6f0a2bad8ad5e..a8cb562da3fea 100644 | ||
9648 | --- a/net/netfilter/nfnetlink_queue.c | ||
9649 | +++ b/net/netfilter/nfnetlink_queue.c | ||
9650 | @@ -562,7 +562,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, | ||
9651 | goto nla_put_failure; | ||
9652 | |||
9653 | if (indev && entskb->dev && | ||
9654 | - entskb->mac_header != entskb->network_header) { | ||
9655 | + skb_mac_header_was_set(entskb)) { | ||
9656 | struct nfqnl_msg_packet_hw phw; | ||
9657 | int len; | ||
9658 | |||
9659 | diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c | ||
9660 | index 95415d2b81c93..6fdea0e57db8a 100644 | ||
9661 | --- a/net/netfilter/nft_dynset.c | ||
9662 | +++ b/net/netfilter/nft_dynset.c | ||
9663 | @@ -164,17 +164,8 @@ static int nft_dynset_init(const struct nft_ctx *ctx, | ||
9664 | return -EBUSY; | ||
9665 | |||
9666 | priv->op = ntohl(nla_get_be32(tb[NFTA_DYNSET_OP])); | ||
9667 | - switch (priv->op) { | ||
9668 | - case NFT_DYNSET_OP_ADD: | ||
9669 | - case NFT_DYNSET_OP_DELETE: | ||
9670 | - break; | ||
9671 | - case NFT_DYNSET_OP_UPDATE: | ||
9672 | - if (!(set->flags & NFT_SET_TIMEOUT)) | ||
9673 | - return -EOPNOTSUPP; | ||
9674 | - break; | ||
9675 | - default: | ||
9676 | + if (priv->op > NFT_DYNSET_OP_DELETE) | ||
9677 | return -EOPNOTSUPP; | ||
9678 | - } | ||
9679 | |||
9680 | timeout = 0; | ||
9681 | if (tb[NFTA_DYNSET_TIMEOUT] != NULL) { | ||
9682 | diff --git a/net/rxrpc/rtt.c b/net/rxrpc/rtt.c | ||
9683 | index 928d8b34a3eee..f3f87c9f0209d 100644 | ||
9684 | --- a/net/rxrpc/rtt.c | ||
9685 | +++ b/net/rxrpc/rtt.c | ||
9686 | @@ -23,7 +23,7 @@ static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer) | ||
9687 | |||
9688 | static u32 __rxrpc_set_rto(const struct rxrpc_peer *peer) | ||
9689 | { | ||
9690 | - return _usecs_to_jiffies((peer->srtt_us >> 3) + peer->rttvar_us); | ||
9691 | + return usecs_to_jiffies((peer->srtt_us >> 3) + peer->rttvar_us); | ||
9692 | } | ||
9693 | |||
9694 | static u32 rxrpc_bound_rto(u32 rto) | ||
9695 | diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c | ||
9696 | index 9bc5cbe9809b8..d973f8a15e117 100644 | ||
9697 | --- a/net/sched/sch_generic.c | ||
9698 | +++ b/net/sched/sch_generic.c | ||
9699 | @@ -1313,6 +1313,15 @@ static int qdisc_change_tx_queue_len(struct net_device *dev, | ||
9700 | return 0; | ||
9701 | } | ||
9702 | |||
9703 | +void dev_qdisc_change_real_num_tx(struct net_device *dev, | ||
9704 | + unsigned int new_real_tx) | ||
9705 | +{ | ||
9706 | + struct Qdisc *qdisc = dev->qdisc; | ||
9707 | + | ||
9708 | + if (qdisc->ops->change_real_num_tx) | ||
9709 | + qdisc->ops->change_real_num_tx(qdisc, new_real_tx); | ||
9710 | +} | ||
9711 | + | ||
9712 | int dev_qdisc_change_tx_queue_len(struct net_device *dev) | ||
9713 | { | ||
9714 | bool up = dev->flags & IFF_UP; | ||
9715 | diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c | ||
9716 | index e79f1afe0cfd6..db18d8a860f9c 100644 | ||
9717 | --- a/net/sched/sch_mq.c | ||
9718 | +++ b/net/sched/sch_mq.c | ||
9719 | @@ -125,6 +125,29 @@ static void mq_attach(struct Qdisc *sch) | ||
9720 | priv->qdiscs = NULL; | ||
9721 | } | ||
9722 | |||
9723 | +static void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx) | ||
9724 | +{ | ||
9725 | +#ifdef CONFIG_NET_SCHED | ||
9726 | + struct net_device *dev = qdisc_dev(sch); | ||
9727 | + struct Qdisc *qdisc; | ||
9728 | + unsigned int i; | ||
9729 | + | ||
9730 | + for (i = new_real_tx; i < dev->real_num_tx_queues; i++) { | ||
9731 | + qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping; | ||
9732 | + /* Only update the default qdiscs we created, | ||
9733 | + * qdiscs with handles are always hashed. | ||
9734 | + */ | ||
9735 | + if (qdisc != &noop_qdisc && !qdisc->handle) | ||
9736 | + qdisc_hash_del(qdisc); | ||
9737 | + } | ||
9738 | + for (i = dev->real_num_tx_queues; i < new_real_tx; i++) { | ||
9739 | + qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping; | ||
9740 | + if (qdisc != &noop_qdisc && !qdisc->handle) | ||
9741 | + qdisc_hash_add(qdisc, false); | ||
9742 | + } | ||
9743 | +#endif | ||
9744 | +} | ||
9745 | + | ||
9746 | static int mq_dump(struct Qdisc *sch, struct sk_buff *skb) | ||
9747 | { | ||
9748 | struct net_device *dev = qdisc_dev(sch); | ||
9749 | @@ -288,6 +311,7 @@ struct Qdisc_ops mq_qdisc_ops __read_mostly = { | ||
9750 | .init = mq_init, | ||
9751 | .destroy = mq_destroy, | ||
9752 | .attach = mq_attach, | ||
9753 | + .change_real_num_tx = mq_change_real_num_tx, | ||
9754 | .dump = mq_dump, | ||
9755 | .owner = THIS_MODULE, | ||
9756 | }; | ||
9757 | diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c | ||
9758 | index 5eb3b1b7ae5e7..50e15add6068f 100644 | ||
9759 | --- a/net/sched/sch_mqprio.c | ||
9760 | +++ b/net/sched/sch_mqprio.c | ||
9761 | @@ -306,6 +306,28 @@ static void mqprio_attach(struct Qdisc *sch) | ||
9762 | priv->qdiscs = NULL; | ||
9763 | } | ||
9764 | |||
9765 | +static void mqprio_change_real_num_tx(struct Qdisc *sch, | ||
9766 | + unsigned int new_real_tx) | ||
9767 | +{ | ||
9768 | + struct net_device *dev = qdisc_dev(sch); | ||
9769 | + struct Qdisc *qdisc; | ||
9770 | + unsigned int i; | ||
9771 | + | ||
9772 | + for (i = new_real_tx; i < dev->real_num_tx_queues; i++) { | ||
9773 | + qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping; | ||
9774 | + /* Only update the default qdiscs we created, | ||
9775 | + * qdiscs with handles are always hashed. | ||
9776 | + */ | ||
9777 | + if (qdisc != &noop_qdisc && !qdisc->handle) | ||
9778 | + qdisc_hash_del(qdisc); | ||
9779 | + } | ||
9780 | + for (i = dev->real_num_tx_queues; i < new_real_tx; i++) { | ||
9781 | + qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping; | ||
9782 | + if (qdisc != &noop_qdisc && !qdisc->handle) | ||
9783 | + qdisc_hash_add(qdisc, false); | ||
9784 | + } | ||
9785 | +} | ||
9786 | + | ||
9787 | static struct netdev_queue *mqprio_queue_get(struct Qdisc *sch, | ||
9788 | unsigned long cl) | ||
9789 | { | ||
9790 | @@ -629,6 +651,7 @@ static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = { | ||
9791 | .init = mqprio_init, | ||
9792 | .destroy = mqprio_destroy, | ||
9793 | .attach = mqprio_attach, | ||
9794 | + .change_real_num_tx = mqprio_change_real_num_tx, | ||
9795 | .dump = mqprio_dump, | ||
9796 | .owner = THIS_MODULE, | ||
9797 | }; | ||
9798 | diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c | ||
9799 | index e14a66ce4884d..b268e61304515 100644 | ||
9800 | --- a/net/sched/sch_taprio.c | ||
9801 | +++ b/net/sched/sch_taprio.c | ||
9802 | @@ -94,18 +94,22 @@ static ktime_t sched_base_time(const struct sched_gate_list *sched) | ||
9803 | return ns_to_ktime(sched->base_time); | ||
9804 | } | ||
9805 | |||
9806 | -static ktime_t taprio_get_time(struct taprio_sched *q) | ||
9807 | +static ktime_t taprio_mono_to_any(const struct taprio_sched *q, ktime_t mono) | ||
9808 | { | ||
9809 | - ktime_t mono = ktime_get(); | ||
9810 | + /* This pairs with WRITE_ONCE() in taprio_parse_clockid() */ | ||
9811 | + enum tk_offsets tk_offset = READ_ONCE(q->tk_offset); | ||
9812 | |||
9813 | - switch (q->tk_offset) { | ||
9814 | + switch (tk_offset) { | ||
9815 | case TK_OFFS_MAX: | ||
9816 | return mono; | ||
9817 | default: | ||
9818 | - return ktime_mono_to_any(mono, q->tk_offset); | ||
9819 | + return ktime_mono_to_any(mono, tk_offset); | ||
9820 | } | ||
9821 | +} | ||
9822 | |||
9823 | - return KTIME_MAX; | ||
9824 | +static ktime_t taprio_get_time(const struct taprio_sched *q) | ||
9825 | +{ | ||
9826 | + return taprio_mono_to_any(q, ktime_get()); | ||
9827 | } | ||
9828 | |||
9829 | static void taprio_free_sched_cb(struct rcu_head *head) | ||
9830 | @@ -321,7 +325,7 @@ static ktime_t get_tcp_tstamp(struct taprio_sched *q, struct sk_buff *skb) | ||
9831 | return 0; | ||
9832 | } | ||
9833 | |||
9834 | - return ktime_mono_to_any(skb->skb_mstamp_ns, q->tk_offset); | ||
9835 | + return taprio_mono_to_any(q, skb->skb_mstamp_ns); | ||
9836 | } | ||
9837 | |||
9838 | /* There are a few scenarios where we will have to modify the txtime from | ||
9839 | @@ -1342,6 +1346,7 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb, | ||
9840 | } | ||
9841 | } else if (tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]) { | ||
9842 | int clockid = nla_get_s32(tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]); | ||
9843 | + enum tk_offsets tk_offset; | ||
9844 | |||
9845 | /* We only support static clockids and we don't allow | ||
9846 | * for it to be modified after the first init. | ||
9847 | @@ -1356,22 +1361,24 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb, | ||
9848 | |||
9849 | switch (clockid) { | ||
9850 | case CLOCK_REALTIME: | ||
9851 | - q->tk_offset = TK_OFFS_REAL; | ||
9852 | + tk_offset = TK_OFFS_REAL; | ||
9853 | break; | ||
9854 | case CLOCK_MONOTONIC: | ||
9855 | - q->tk_offset = TK_OFFS_MAX; | ||
9856 | + tk_offset = TK_OFFS_MAX; | ||
9857 | break; | ||
9858 | case CLOCK_BOOTTIME: | ||
9859 | - q->tk_offset = TK_OFFS_BOOT; | ||
9860 | + tk_offset = TK_OFFS_BOOT; | ||
9861 | break; | ||
9862 | case CLOCK_TAI: | ||
9863 | - q->tk_offset = TK_OFFS_TAI; | ||
9864 | + tk_offset = TK_OFFS_TAI; | ||
9865 | break; | ||
9866 | default: | ||
9867 | NL_SET_ERR_MSG(extack, "Invalid 'clockid'"); | ||
9868 | err = -EINVAL; | ||
9869 | goto out; | ||
9870 | } | ||
9871 | + /* This pairs with READ_ONCE() in taprio_mono_to_any */ | ||
9872 | + WRITE_ONCE(q->tk_offset, tk_offset); | ||
9873 | |||
9874 | q->clockid = clockid; | ||
9875 | } else { | ||
9876 | diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c | ||
9877 | index 51986f7ead819..6b0f09c5b195f 100644 | ||
9878 | --- a/net/smc/af_smc.c | ||
9879 | +++ b/net/smc/af_smc.c | ||
9880 | @@ -139,14 +139,18 @@ static int __smc_release(struct smc_sock *smc) | ||
9881 | sock_set_flag(sk, SOCK_DEAD); | ||
9882 | sk->sk_shutdown |= SHUTDOWN_MASK; | ||
9883 | } else { | ||
9884 | - if (sk->sk_state != SMC_LISTEN && sk->sk_state != SMC_INIT) | ||
9885 | - sock_put(sk); /* passive closing */ | ||
9886 | - if (sk->sk_state == SMC_LISTEN) { | ||
9887 | - /* wake up clcsock accept */ | ||
9888 | - rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR); | ||
9889 | + if (sk->sk_state != SMC_CLOSED) { | ||
9890 | + if (sk->sk_state != SMC_LISTEN && | ||
9891 | + sk->sk_state != SMC_INIT) | ||
9892 | + sock_put(sk); /* passive closing */ | ||
9893 | + if (sk->sk_state == SMC_LISTEN) { | ||
9894 | + /* wake up clcsock accept */ | ||
9895 | + rc = kernel_sock_shutdown(smc->clcsock, | ||
9896 | + SHUT_RDWR); | ||
9897 | + } | ||
9898 | + sk->sk_state = SMC_CLOSED; | ||
9899 | + sk->sk_state_change(sk); | ||
9900 | } | ||
9901 | - sk->sk_state = SMC_CLOSED; | ||
9902 | - sk->sk_state_change(sk); | ||
9903 | smc_restore_fallback_changes(smc); | ||
9904 | } | ||
9905 | |||
9906 | @@ -783,7 +787,7 @@ static void smc_connect_work(struct work_struct *work) | ||
9907 | if (smc->clcsock->sk->sk_err) { | ||
9908 | smc->sk.sk_err = smc->clcsock->sk->sk_err; | ||
9909 | } else if ((1 << smc->clcsock->sk->sk_state) & | ||
9910 | - (TCPF_SYN_SENT | TCP_SYN_RECV)) { | ||
9911 | + (TCPF_SYN_SENT | TCPF_SYN_RECV)) { | ||
9912 | rc = sk_stream_wait_connect(smc->clcsock->sk, &timeo); | ||
9913 | if ((rc == -EPIPE) && | ||
9914 | ((1 << smc->clcsock->sk->sk_state) & | ||
9915 | diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c | ||
9916 | index b3815c1e8f2ea..cd9954c4ad808 100644 | ||
9917 | --- a/net/strparser/strparser.c | ||
9918 | +++ b/net/strparser/strparser.c | ||
9919 | @@ -27,18 +27,10 @@ | ||
9920 | |||
9921 | static struct workqueue_struct *strp_wq; | ||
9922 | |||
9923 | -struct _strp_msg { | ||
9924 | - /* Internal cb structure. struct strp_msg must be first for passing | ||
9925 | - * to upper layer. | ||
9926 | - */ | ||
9927 | - struct strp_msg strp; | ||
9928 | - int accum_len; | ||
9929 | -}; | ||
9930 | - | ||
9931 | static inline struct _strp_msg *_strp_msg(struct sk_buff *skb) | ||
9932 | { | ||
9933 | return (struct _strp_msg *)((void *)skb->cb + | ||
9934 | - offsetof(struct qdisc_skb_cb, data)); | ||
9935 | + offsetof(struct sk_skb_cb, strp)); | ||
9936 | } | ||
9937 | |||
9938 | /* Lower lock held */ | ||
9939 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c | ||
9940 | index 3653898f465ff..93b6afd28405e 100644 | ||
9941 | --- a/net/sunrpc/xprt.c | ||
9942 | +++ b/net/sunrpc/xprt.c | ||
9943 | @@ -1538,15 +1538,14 @@ xprt_transmit(struct rpc_task *task) | ||
9944 | { | ||
9945 | struct rpc_rqst *next, *req = task->tk_rqstp; | ||
9946 | struct rpc_xprt *xprt = req->rq_xprt; | ||
9947 | - int counter, status; | ||
9948 | + int status; | ||
9949 | |||
9950 | spin_lock(&xprt->queue_lock); | ||
9951 | - counter = 0; | ||
9952 | - while (!list_empty(&xprt->xmit_queue)) { | ||
9953 | - if (++counter == 20) | ||
9954 | + for (;;) { | ||
9955 | + next = list_first_entry_or_null(&xprt->xmit_queue, | ||
9956 | + struct rpc_rqst, rq_xmit); | ||
9957 | + if (!next) | ||
9958 | break; | ||
9959 | - next = list_first_entry(&xprt->xmit_queue, | ||
9960 | - struct rpc_rqst, rq_xmit); | ||
9961 | xprt_pin_rqst(next); | ||
9962 | spin_unlock(&xprt->queue_lock); | ||
9963 | status = xprt_request_transmit(next, task); | ||
9964 | @@ -1554,13 +1553,16 @@ xprt_transmit(struct rpc_task *task) | ||
9965 | status = 0; | ||
9966 | spin_lock(&xprt->queue_lock); | ||
9967 | xprt_unpin_rqst(next); | ||
9968 | - if (status == 0) { | ||
9969 | - if (!xprt_request_data_received(task) || | ||
9970 | - test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) | ||
9971 | - continue; | ||
9972 | - } else if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) | ||
9973 | - task->tk_status = status; | ||
9974 | - break; | ||
9975 | + if (status < 0) { | ||
9976 | + if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) | ||
9977 | + task->tk_status = status; | ||
9978 | + break; | ||
9979 | + } | ||
9980 | + /* Was @task transmitted, and has it received a reply? */ | ||
9981 | + if (xprt_request_data_received(task) && | ||
9982 | + !test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) | ||
9983 | + break; | ||
9984 | + cond_resched_lock(&xprt->queue_lock); | ||
9985 | } | ||
9986 | spin_unlock(&xprt->queue_lock); | ||
9987 | } | ||
9988 | diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c | ||
9989 | index d4104144bab1b..bc8055f4571bc 100644 | ||
9990 | --- a/net/vmw_vsock/af_vsock.c | ||
9991 | +++ b/net/vmw_vsock/af_vsock.c | ||
9992 | @@ -1151,6 +1151,8 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr, | ||
9993 | * non-blocking call. | ||
9994 | */ | ||
9995 | err = -EALREADY; | ||
9996 | + if (flags & O_NONBLOCK) | ||
9997 | + goto out; | ||
9998 | break; | ||
9999 | default: | ||
10000 | if ((sk->sk_state == TCP_LISTEN) || | ||
10001 | diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c | ||
10002 | index 186315ca88b3f..2701549ee7b3a 100644 | ||
10003 | --- a/samples/kprobes/kretprobe_example.c | ||
10004 | +++ b/samples/kprobes/kretprobe_example.c | ||
10005 | @@ -84,7 +84,7 @@ static int __init kretprobe_init(void) | ||
10006 | ret = register_kretprobe(&my_kretprobe); | ||
10007 | if (ret < 0) { | ||
10008 | pr_err("register_kretprobe failed, returned %d\n", ret); | ||
10009 | - return -1; | ||
10010 | + return ret; | ||
10011 | } | ||
10012 | pr_info("Planted return probe at %s: %p\n", | ||
10013 | my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr); | ||
10014 | diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl | ||
10015 | index b2d8b8aa2d99e..8f636a23bc3f2 100755 | ||
10016 | --- a/scripts/leaking_addresses.pl | ||
10017 | +++ b/scripts/leaking_addresses.pl | ||
10018 | @@ -455,8 +455,9 @@ sub parse_file | ||
10019 | |||
10020 | open my $fh, "<", $file or return; | ||
10021 | while ( <$fh> ) { | ||
10022 | + chomp; | ||
10023 | if (may_leak_address($_)) { | ||
10024 | - print $file . ': ' . $_; | ||
10025 | + printf("$file: $_\n"); | ||
10026 | } | ||
10027 | } | ||
10028 | close $fh; | ||
10029 | diff --git a/security/apparmor/label.c b/security/apparmor/label.c | ||
10030 | index 5f324d63ceaa3..747a734a08246 100644 | ||
10031 | --- a/security/apparmor/label.c | ||
10032 | +++ b/security/apparmor/label.c | ||
10033 | @@ -1459,7 +1459,7 @@ bool aa_update_label_name(struct aa_ns *ns, struct aa_label *label, gfp_t gfp) | ||
10034 | if (label->hname || labels_ns(label) != ns) | ||
10035 | return res; | ||
10036 | |||
10037 | - if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) == -1) | ||
10038 | + if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) < 0) | ||
10039 | return res; | ||
10040 | |||
10041 | ls = labels_set(label); | ||
10042 | @@ -1709,7 +1709,7 @@ int aa_label_asxprint(char **strp, struct aa_ns *ns, struct aa_label *label, | ||
10043 | |||
10044 | /** | ||
10045 | * aa_label_acntsxprint - allocate a __counted string buffer and print label | ||
10046 | - * @strp: buffer to write to. (MAY BE NULL if @size == 0) | ||
10047 | + * @strp: buffer to write to. | ||
10048 | * @ns: namespace profile is being viewed from | ||
10049 | * @label: label to view (NOT NULL) | ||
10050 | * @flags: flags controlling what label info is printed | ||
10051 | diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c | ||
10052 | index 81e3245aec86c..b82291d10e730 100644 | ||
10053 | --- a/security/integrity/evm/evm_main.c | ||
10054 | +++ b/security/integrity/evm/evm_main.c | ||
10055 | @@ -56,7 +56,7 @@ static struct xattr_list evm_config_default_xattrnames[] = { | ||
10056 | |||
10057 | LIST_HEAD(evm_config_xattrnames); | ||
10058 | |||
10059 | -static int evm_fixmode; | ||
10060 | +static int evm_fixmode __ro_after_init; | ||
10061 | static int __init evm_set_fixmode(char *str) | ||
10062 | { | ||
10063 | if (strncmp(str, "fix", 3) == 0) | ||
10064 | diff --git a/security/security.c b/security/security.c | ||
10065 | index 1bc000f834e2d..c34ec4c7d98cc 100644 | ||
10066 | --- a/security/security.c | ||
10067 | +++ b/security/security.c | ||
10068 | @@ -670,25 +670,25 @@ static void __init lsm_early_task(struct task_struct *task) | ||
10069 | |||
10070 | /* Security operations */ | ||
10071 | |||
10072 | -int security_binder_set_context_mgr(struct task_struct *mgr) | ||
10073 | +int security_binder_set_context_mgr(const struct cred *mgr) | ||
10074 | { | ||
10075 | return call_int_hook(binder_set_context_mgr, 0, mgr); | ||
10076 | } | ||
10077 | |||
10078 | -int security_binder_transaction(struct task_struct *from, | ||
10079 | - struct task_struct *to) | ||
10080 | +int security_binder_transaction(const struct cred *from, | ||
10081 | + const struct cred *to) | ||
10082 | { | ||
10083 | return call_int_hook(binder_transaction, 0, from, to); | ||
10084 | } | ||
10085 | |||
10086 | -int security_binder_transfer_binder(struct task_struct *from, | ||
10087 | - struct task_struct *to) | ||
10088 | +int security_binder_transfer_binder(const struct cred *from, | ||
10089 | + const struct cred *to) | ||
10090 | { | ||
10091 | return call_int_hook(binder_transfer_binder, 0, from, to); | ||
10092 | } | ||
10093 | |||
10094 | -int security_binder_transfer_file(struct task_struct *from, | ||
10095 | - struct task_struct *to, struct file *file) | ||
10096 | +int security_binder_transfer_file(const struct cred *from, | ||
10097 | + const struct cred *to, struct file *file) | ||
10098 | { | ||
10099 | return call_int_hook(binder_transfer_file, 0, from, to, file); | ||
10100 | } | ||
10101 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c | ||
10102 | index 717a398ef4d05..8b9cbe1e8ee22 100644 | ||
10103 | --- a/security/selinux/hooks.c | ||
10104 | +++ b/security/selinux/hooks.c | ||
10105 | @@ -2050,22 +2050,19 @@ static inline u32 open_file_to_av(struct file *file) | ||
10106 | |||
10107 | /* Hook functions begin here. */ | ||
10108 | |||
10109 | -static int selinux_binder_set_context_mgr(struct task_struct *mgr) | ||
10110 | +static int selinux_binder_set_context_mgr(const struct cred *mgr) | ||
10111 | { | ||
10112 | - u32 mysid = current_sid(); | ||
10113 | - u32 mgrsid = task_sid(mgr); | ||
10114 | - | ||
10115 | return avc_has_perm(&selinux_state, | ||
10116 | - mysid, mgrsid, SECCLASS_BINDER, | ||
10117 | + current_sid(), cred_sid(mgr), SECCLASS_BINDER, | ||
10118 | BINDER__SET_CONTEXT_MGR, NULL); | ||
10119 | } | ||
10120 | |||
10121 | -static int selinux_binder_transaction(struct task_struct *from, | ||
10122 | - struct task_struct *to) | ||
10123 | +static int selinux_binder_transaction(const struct cred *from, | ||
10124 | + const struct cred *to) | ||
10125 | { | ||
10126 | u32 mysid = current_sid(); | ||
10127 | - u32 fromsid = task_sid(from); | ||
10128 | - u32 tosid = task_sid(to); | ||
10129 | + u32 fromsid = cred_sid(from); | ||
10130 | + u32 tosid = cred_sid(to); | ||
10131 | int rc; | ||
10132 | |||
10133 | if (mysid != fromsid) { | ||
10134 | @@ -2076,27 +2073,24 @@ static int selinux_binder_transaction(struct task_struct *from, | ||
10135 | return rc; | ||
10136 | } | ||
10137 | |||
10138 | - return avc_has_perm(&selinux_state, | ||
10139 | - fromsid, tosid, SECCLASS_BINDER, BINDER__CALL, | ||
10140 | - NULL); | ||
10141 | + return avc_has_perm(&selinux_state, fromsid, tosid, | ||
10142 | + SECCLASS_BINDER, BINDER__CALL, NULL); | ||
10143 | } | ||
10144 | |||
10145 | -static int selinux_binder_transfer_binder(struct task_struct *from, | ||
10146 | - struct task_struct *to) | ||
10147 | +static int selinux_binder_transfer_binder(const struct cred *from, | ||
10148 | + const struct cred *to) | ||
10149 | { | ||
10150 | - u32 fromsid = task_sid(from); | ||
10151 | - u32 tosid = task_sid(to); | ||
10152 | - | ||
10153 | return avc_has_perm(&selinux_state, | ||
10154 | - fromsid, tosid, SECCLASS_BINDER, BINDER__TRANSFER, | ||
10155 | + cred_sid(from), cred_sid(to), | ||
10156 | + SECCLASS_BINDER, BINDER__TRANSFER, | ||
10157 | NULL); | ||
10158 | } | ||
10159 | |||
10160 | -static int selinux_binder_transfer_file(struct task_struct *from, | ||
10161 | - struct task_struct *to, | ||
10162 | +static int selinux_binder_transfer_file(const struct cred *from, | ||
10163 | + const struct cred *to, | ||
10164 | struct file *file) | ||
10165 | { | ||
10166 | - u32 sid = task_sid(to); | ||
10167 | + u32 sid = cred_sid(to); | ||
10168 | struct file_security_struct *fsec = selinux_file(file); | ||
10169 | struct dentry *dentry = file->f_path.dentry; | ||
10170 | struct inode_security_struct *isec; | ||
10171 | diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c | ||
10172 | index 3823ab2c4e4be..6b6fec04c412b 100644 | ||
10173 | --- a/security/smack/smackfs.c | ||
10174 | +++ b/security/smack/smackfs.c | ||
10175 | @@ -693,9 +693,7 @@ static void smk_cipso_doi(void) | ||
10176 | printk(KERN_WARNING "%s:%d remove rc = %d\n", | ||
10177 | __func__, __LINE__, rc); | ||
10178 | |||
10179 | - doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); | ||
10180 | - if (doip == NULL) | ||
10181 | - panic("smack: Failed to initialize cipso DOI.\n"); | ||
10182 | + doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL | __GFP_NOFAIL); | ||
10183 | doip->map.std = NULL; | ||
10184 | doip->doi = smk_cipso_doi_value; | ||
10185 | doip->type = CIPSO_V4_MAP_PASS; | ||
10186 | @@ -714,7 +712,7 @@ static void smk_cipso_doi(void) | ||
10187 | if (rc != 0) { | ||
10188 | printk(KERN_WARNING "%s:%d map add rc = %d\n", | ||
10189 | __func__, __LINE__, rc); | ||
10190 | - kfree(doip); | ||
10191 | + netlbl_cfg_cipsov4_del(doip->doi, &nai); | ||
10192 | return; | ||
10193 | } | ||
10194 | } | ||
10195 | @@ -831,6 +829,7 @@ static int smk_open_cipso(struct inode *inode, struct file *file) | ||
10196 | static ssize_t smk_set_cipso(struct file *file, const char __user *buf, | ||
10197 | size_t count, loff_t *ppos, int format) | ||
10198 | { | ||
10199 | + struct netlbl_lsm_catmap *old_cat; | ||
10200 | struct smack_known *skp; | ||
10201 | struct netlbl_lsm_secattr ncats; | ||
10202 | char mapcatset[SMK_CIPSOLEN]; | ||
10203 | @@ -920,9 +919,11 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, | ||
10204 | |||
10205 | rc = smk_netlbl_mls(maplevel, mapcatset, &ncats, SMK_CIPSOLEN); | ||
10206 | if (rc >= 0) { | ||
10207 | - netlbl_catmap_free(skp->smk_netlabel.attr.mls.cat); | ||
10208 | + old_cat = skp->smk_netlabel.attr.mls.cat; | ||
10209 | skp->smk_netlabel.attr.mls.cat = ncats.attr.mls.cat; | ||
10210 | skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl; | ||
10211 | + synchronize_rcu(); | ||
10212 | + netlbl_catmap_free(old_cat); | ||
10213 | rc = count; | ||
10214 | } | ||
10215 | |||
10216 | diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c | ||
10217 | index 7eb54df5556df..50ec8b8ff68c9 100644 | ||
10218 | --- a/sound/core/oss/mixer_oss.c | ||
10219 | +++ b/sound/core/oss/mixer_oss.c | ||
10220 | @@ -130,11 +130,13 @@ static int snd_mixer_oss_devmask(struct snd_mixer_oss_file *fmixer) | ||
10221 | |||
10222 | if (mixer == NULL) | ||
10223 | return -EIO; | ||
10224 | + mutex_lock(&mixer->reg_mutex); | ||
10225 | for (chn = 0; chn < 31; chn++) { | ||
10226 | pslot = &mixer->slots[chn]; | ||
10227 | if (pslot->put_volume || pslot->put_recsrc) | ||
10228 | result |= 1 << chn; | ||
10229 | } | ||
10230 | + mutex_unlock(&mixer->reg_mutex); | ||
10231 | return result; | ||
10232 | } | ||
10233 | |||
10234 | @@ -146,11 +148,13 @@ static int snd_mixer_oss_stereodevs(struct snd_mixer_oss_file *fmixer) | ||
10235 | |||
10236 | if (mixer == NULL) | ||
10237 | return -EIO; | ||
10238 | + mutex_lock(&mixer->reg_mutex); | ||
10239 | for (chn = 0; chn < 31; chn++) { | ||
10240 | pslot = &mixer->slots[chn]; | ||
10241 | if (pslot->put_volume && pslot->stereo) | ||
10242 | result |= 1 << chn; | ||
10243 | } | ||
10244 | + mutex_unlock(&mixer->reg_mutex); | ||
10245 | return result; | ||
10246 | } | ||
10247 | |||
10248 | @@ -161,6 +165,7 @@ static int snd_mixer_oss_recmask(struct snd_mixer_oss_file *fmixer) | ||
10249 | |||
10250 | if (mixer == NULL) | ||
10251 | return -EIO; | ||
10252 | + mutex_lock(&mixer->reg_mutex); | ||
10253 | if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */ | ||
10254 | result = mixer->mask_recsrc; | ||
10255 | } else { | ||
10256 | @@ -172,6 +177,7 @@ static int snd_mixer_oss_recmask(struct snd_mixer_oss_file *fmixer) | ||
10257 | result |= 1 << chn; | ||
10258 | } | ||
10259 | } | ||
10260 | + mutex_unlock(&mixer->reg_mutex); | ||
10261 | return result; | ||
10262 | } | ||
10263 | |||
10264 | @@ -182,11 +188,12 @@ static int snd_mixer_oss_get_recsrc(struct snd_mixer_oss_file *fmixer) | ||
10265 | |||
10266 | if (mixer == NULL) | ||
10267 | return -EIO; | ||
10268 | + mutex_lock(&mixer->reg_mutex); | ||
10269 | if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */ | ||
10270 | - int err; | ||
10271 | unsigned int index; | ||
10272 | - if ((err = mixer->get_recsrc(fmixer, &index)) < 0) | ||
10273 | - return err; | ||
10274 | + result = mixer->get_recsrc(fmixer, &index); | ||
10275 | + if (result < 0) | ||
10276 | + goto unlock; | ||
10277 | result = 1 << index; | ||
10278 | } else { | ||
10279 | struct snd_mixer_oss_slot *pslot; | ||
10280 | @@ -201,7 +208,10 @@ static int snd_mixer_oss_get_recsrc(struct snd_mixer_oss_file *fmixer) | ||
10281 | } | ||
10282 | } | ||
10283 | } | ||
10284 | - return mixer->oss_recsrc = result; | ||
10285 | + mixer->oss_recsrc = result; | ||
10286 | + unlock: | ||
10287 | + mutex_unlock(&mixer->reg_mutex); | ||
10288 | + return result; | ||
10289 | } | ||
10290 | |||
10291 | static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsrc) | ||
10292 | @@ -214,6 +224,7 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr | ||
10293 | |||
10294 | if (mixer == NULL) | ||
10295 | return -EIO; | ||
10296 | + mutex_lock(&mixer->reg_mutex); | ||
10297 | if (mixer->get_recsrc && mixer->put_recsrc) { /* exclusive input */ | ||
10298 | if (recsrc & ~mixer->oss_recsrc) | ||
10299 | recsrc &= ~mixer->oss_recsrc; | ||
10300 | @@ -239,6 +250,7 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr | ||
10301 | } | ||
10302 | } | ||
10303 | } | ||
10304 | + mutex_unlock(&mixer->reg_mutex); | ||
10305 | return result; | ||
10306 | } | ||
10307 | |||
10308 | @@ -250,6 +262,7 @@ static int snd_mixer_oss_get_volume(struct snd_mixer_oss_file *fmixer, int slot) | ||
10309 | |||
10310 | if (mixer == NULL || slot > 30) | ||
10311 | return -EIO; | ||
10312 | + mutex_lock(&mixer->reg_mutex); | ||
10313 | pslot = &mixer->slots[slot]; | ||
10314 | left = pslot->volume[0]; | ||
10315 | right = pslot->volume[1]; | ||
10316 | @@ -257,15 +270,21 @@ static int snd_mixer_oss_get_volume(struct snd_mixer_oss_file *fmixer, int slot) | ||
10317 | result = pslot->get_volume(fmixer, pslot, &left, &right); | ||
10318 | if (!pslot->stereo) | ||
10319 | right = left; | ||
10320 | - if (snd_BUG_ON(left < 0 || left > 100)) | ||
10321 | - return -EIO; | ||
10322 | - if (snd_BUG_ON(right < 0 || right > 100)) | ||
10323 | - return -EIO; | ||
10324 | + if (snd_BUG_ON(left < 0 || left > 100)) { | ||
10325 | + result = -EIO; | ||
10326 | + goto unlock; | ||
10327 | + } | ||
10328 | + if (snd_BUG_ON(right < 0 || right > 100)) { | ||
10329 | + result = -EIO; | ||
10330 | + goto unlock; | ||
10331 | + } | ||
10332 | if (result >= 0) { | ||
10333 | pslot->volume[0] = left; | ||
10334 | pslot->volume[1] = right; | ||
10335 | result = (left & 0xff) | ((right & 0xff) << 8); | ||
10336 | } | ||
10337 | + unlock: | ||
10338 | + mutex_unlock(&mixer->reg_mutex); | ||
10339 | return result; | ||
10340 | } | ||
10341 | |||
10342 | @@ -278,6 +297,7 @@ static int snd_mixer_oss_set_volume(struct snd_mixer_oss_file *fmixer, | ||
10343 | |||
10344 | if (mixer == NULL || slot > 30) | ||
10345 | return -EIO; | ||
10346 | + mutex_lock(&mixer->reg_mutex); | ||
10347 | pslot = &mixer->slots[slot]; | ||
10348 | if (left > 100) | ||
10349 | left = 100; | ||
10350 | @@ -288,10 +308,13 @@ static int snd_mixer_oss_set_volume(struct snd_mixer_oss_file *fmixer, | ||
10351 | if (pslot->put_volume) | ||
10352 | result = pslot->put_volume(fmixer, pslot, left, right); | ||
10353 | if (result < 0) | ||
10354 | - return result; | ||
10355 | + goto unlock; | ||
10356 | pslot->volume[0] = left; | ||
10357 | pslot->volume[1] = right; | ||
10358 | - return (left & 0xff) | ((right & 0xff) << 8); | ||
10359 | + result = (left & 0xff) | ((right & 0xff) << 8); | ||
10360 | + unlock: | ||
10361 | + mutex_unlock(&mixer->reg_mutex); | ||
10362 | + return result; | ||
10363 | } | ||
10364 | |||
10365 | static int snd_mixer_oss_ioctl1(struct snd_mixer_oss_file *fmixer, unsigned int cmd, unsigned long arg) | ||
10366 | diff --git a/sound/core/timer.c b/sound/core/timer.c | ||
10367 | index b5a0ba79bf746..d684aa4150aad 100644 | ||
10368 | --- a/sound/core/timer.c | ||
10369 | +++ b/sound/core/timer.c | ||
10370 | @@ -595,13 +595,13 @@ static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop) | ||
10371 | if (!timer) | ||
10372 | return -EINVAL; | ||
10373 | spin_lock_irqsave(&timer->lock, flags); | ||
10374 | + list_del_init(&timeri->ack_list); | ||
10375 | + list_del_init(&timeri->active_list); | ||
10376 | if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | | ||
10377 | SNDRV_TIMER_IFLG_START))) { | ||
10378 | result = -EBUSY; | ||
10379 | goto unlock; | ||
10380 | } | ||
10381 | - list_del_init(&timeri->ack_list); | ||
10382 | - list_del_init(&timeri->active_list); | ||
10383 | if (timer->card && timer->card->shutdown) | ||
10384 | goto unlock; | ||
10385 | if (stop) { | ||
10386 | @@ -636,23 +636,22 @@ static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop) | ||
10387 | static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop) | ||
10388 | { | ||
10389 | unsigned long flags; | ||
10390 | + bool running; | ||
10391 | |||
10392 | spin_lock_irqsave(&slave_active_lock, flags); | ||
10393 | - if (!(timeri->flags & SNDRV_TIMER_IFLG_RUNNING)) { | ||
10394 | - spin_unlock_irqrestore(&slave_active_lock, flags); | ||
10395 | - return -EBUSY; | ||
10396 | - } | ||
10397 | + running = timeri->flags & SNDRV_TIMER_IFLG_RUNNING; | ||
10398 | timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; | ||
10399 | if (timeri->timer) { | ||
10400 | spin_lock(&timeri->timer->lock); | ||
10401 | list_del_init(&timeri->ack_list); | ||
10402 | list_del_init(&timeri->active_list); | ||
10403 | - snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : | ||
10404 | - SNDRV_TIMER_EVENT_PAUSE); | ||
10405 | + if (running) | ||
10406 | + snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : | ||
10407 | + SNDRV_TIMER_EVENT_PAUSE); | ||
10408 | spin_unlock(&timeri->timer->lock); | ||
10409 | } | ||
10410 | spin_unlock_irqrestore(&slave_active_lock, flags); | ||
10411 | - return 0; | ||
10412 | + return running ? 0 : -EBUSY; | ||
10413 | } | ||
10414 | |||
10415 | /* | ||
10416 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c | ||
10417 | index ebb1ee69dd0c3..95d472d433e70 100644 | ||
10418 | --- a/sound/pci/hda/hda_intel.c | ||
10419 | +++ b/sound/pci/hda/hda_intel.c | ||
10420 | @@ -671,13 +671,17 @@ static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) | ||
10421 | * the update-IRQ timing. The IRQ is issued before actually the | ||
10422 | * data is processed. So, we need to process it afterwords in a | ||
10423 | * workqueue. | ||
10424 | + * | ||
10425 | + * Returns 1 if OK to proceed, 0 for delay handling, -1 for skipping update | ||
10426 | */ | ||
10427 | static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) | ||
10428 | { | ||
10429 | struct snd_pcm_substream *substream = azx_dev->core.substream; | ||
10430 | + struct snd_pcm_runtime *runtime = substream->runtime; | ||
10431 | int stream = substream->stream; | ||
10432 | u32 wallclk; | ||
10433 | unsigned int pos; | ||
10434 | + snd_pcm_uframes_t hwptr, target; | ||
10435 | |||
10436 | wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk; | ||
10437 | if (wallclk < (azx_dev->core.period_wallclk * 2) / 3) | ||
10438 | @@ -714,6 +718,24 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) | ||
10439 | /* NG - it's below the first next period boundary */ | ||
10440 | return chip->bdl_pos_adj ? 0 : -1; | ||
10441 | azx_dev->core.start_wallclk += wallclk; | ||
10442 | + | ||
10443 | + if (azx_dev->core.no_period_wakeup) | ||
10444 | + return 1; /* OK, no need to check period boundary */ | ||
10445 | + | ||
10446 | + if (runtime->hw_ptr_base != runtime->hw_ptr_interrupt) | ||
10447 | + return 1; /* OK, already in hwptr updating process */ | ||
10448 | + | ||
10449 | + /* check whether the period gets really elapsed */ | ||
10450 | + pos = bytes_to_frames(runtime, pos); | ||
10451 | + hwptr = runtime->hw_ptr_base + pos; | ||
10452 | + if (hwptr < runtime->status->hw_ptr) | ||
10453 | + hwptr += runtime->buffer_size; | ||
10454 | + target = runtime->hw_ptr_interrupt + runtime->period_size; | ||
10455 | + if (hwptr < target) { | ||
10456 | + /* too early wakeup, process it later */ | ||
10457 | + return chip->bdl_pos_adj ? 0 : -1; | ||
10458 | + } | ||
10459 | + | ||
10460 | return 1; /* OK, it's fine */ | ||
10461 | } | ||
10462 | |||
10463 | @@ -907,11 +929,7 @@ static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev) | ||
10464 | if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
10465 | return azx_skl_get_dpib_pos(chip, azx_dev); | ||
10466 | |||
10467 | - /* For capture, we need to read posbuf, but it requires a delay | ||
10468 | - * for the possible boundary overlap; the read of DPIB fetches the | ||
10469 | - * actual posbuf | ||
10470 | - */ | ||
10471 | - udelay(20); | ||
10472 | + /* read of DPIB fetches the actual posbuf */ | ||
10473 | azx_skl_get_dpib_pos(chip, azx_dev); | ||
10474 | return azx_get_pos_posbuf(chip, azx_dev); | ||
10475 | } | ||
10476 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
10477 | index 49aefb7875e72..94fc17b28e9c7 100644 | ||
10478 | --- a/sound/pci/hda/patch_realtek.c | ||
10479 | +++ b/sound/pci/hda/patch_realtek.c | ||
10480 | @@ -2541,6 +2541,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | ||
10481 | SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), | ||
10482 | SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), | ||
10483 | SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), | ||
10484 | + SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), | ||
10485 | SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), | ||
10486 | SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS), | ||
10487 | SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED), | ||
10488 | @@ -7976,6 +7977,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
10489 | SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), | ||
10490 | SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), | ||
10491 | SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), | ||
10492 | + SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), | ||
10493 | SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), | ||
10494 | SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), | ||
10495 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | ||
10496 | @@ -8102,6 +8104,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
10497 | SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT), | ||
10498 | SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), | ||
10499 | SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED), | ||
10500 | + SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED), | ||
10501 | SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), | ||
10502 | SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT), | ||
10503 | SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED), | ||
10504 | @@ -8132,6 +8135,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
10505 | SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), | ||
10506 | SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), | ||
10507 | SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE), | ||
10508 | + SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401), | ||
10509 | SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE), | ||
10510 | SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE), | ||
10511 | SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE), | ||
10512 | diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c | ||
10513 | index 6825e874785f2..ebee58eca4d51 100644 | ||
10514 | --- a/sound/soc/codecs/cs42l42.c | ||
10515 | +++ b/sound/soc/codecs/cs42l42.c | ||
10516 | @@ -91,7 +91,7 @@ static const struct reg_default cs42l42_reg_defaults[] = { | ||
10517 | { CS42L42_ASP_RX_INT_MASK, 0x1F }, | ||
10518 | { CS42L42_ASP_TX_INT_MASK, 0x0F }, | ||
10519 | { CS42L42_CODEC_INT_MASK, 0x03 }, | ||
10520 | - { CS42L42_SRCPL_INT_MASK, 0xFF }, | ||
10521 | + { CS42L42_SRCPL_INT_MASK, 0x7F }, | ||
10522 | { CS42L42_VPMON_INT_MASK, 0x01 }, | ||
10523 | { CS42L42_PLL_LOCK_INT_MASK, 0x01 }, | ||
10524 | { CS42L42_TSRS_PLUG_INT_MASK, 0x0F }, | ||
10525 | @@ -128,7 +128,7 @@ static const struct reg_default cs42l42_reg_defaults[] = { | ||
10526 | { CS42L42_MIXER_CHA_VOL, 0x3F }, | ||
10527 | { CS42L42_MIXER_ADC_VOL, 0x3F }, | ||
10528 | { CS42L42_MIXER_CHB_VOL, 0x3F }, | ||
10529 | - { CS42L42_EQ_COEF_IN0, 0x22 }, | ||
10530 | + { CS42L42_EQ_COEF_IN0, 0x00 }, | ||
10531 | { CS42L42_EQ_COEF_IN1, 0x00 }, | ||
10532 | { CS42L42_EQ_COEF_IN2, 0x00 }, | ||
10533 | { CS42L42_EQ_COEF_IN3, 0x00 }, | ||
10534 | @@ -1798,8 +1798,9 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client, | ||
10535 | NULL, cs42l42_irq_thread, | ||
10536 | IRQF_ONESHOT | IRQF_TRIGGER_LOW, | ||
10537 | "cs42l42", cs42l42); | ||
10538 | - | ||
10539 | - if (ret != 0) | ||
10540 | + if (ret == -EPROBE_DEFER) | ||
10541 | + goto err_disable; | ||
10542 | + else if (ret != 0) | ||
10543 | dev_err(&i2c_client->dev, | ||
10544 | "Failed to request IRQ: %d\n", ret); | ||
10545 | |||
10546 | diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c | ||
10547 | index f65e6c7b139f5..6695530bba9b3 100644 | ||
10548 | --- a/sound/synth/emux/emux.c | ||
10549 | +++ b/sound/synth/emux/emux.c | ||
10550 | @@ -88,7 +88,7 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch | ||
10551 | emu->name = kstrdup(name, GFP_KERNEL); | ||
10552 | emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice), | ||
10553 | GFP_KERNEL); | ||
10554 | - if (emu->voices == NULL) | ||
10555 | + if (emu->name == NULL || emu->voices == NULL) | ||
10556 | return -ENOMEM; | ||
10557 | |||
10558 | /* create soundfont list */ | ||
10559 | diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c | ||
10560 | index 43a2a62d66f7e..49629d4bb327a 100644 | ||
10561 | --- a/sound/usb/6fire/comm.c | ||
10562 | +++ b/sound/usb/6fire/comm.c | ||
10563 | @@ -95,7 +95,7 @@ static int usb6fire_comm_send_buffer(u8 *buffer, struct usb_device *dev) | ||
10564 | int actual_len; | ||
10565 | |||
10566 | ret = usb_interrupt_msg(dev, usb_sndintpipe(dev, COMM_EP), | ||
10567 | - buffer, buffer[1] + 2, &actual_len, HZ); | ||
10568 | + buffer, buffer[1] + 2, &actual_len, 1000); | ||
10569 | if (ret < 0) | ||
10570 | return ret; | ||
10571 | else if (actual_len != buffer[1] + 2) | ||
10572 | diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c | ||
10573 | index 69137c14d0dcf..2333e8ff3411a 100644 | ||
10574 | --- a/sound/usb/6fire/firmware.c | ||
10575 | +++ b/sound/usb/6fire/firmware.c | ||
10576 | @@ -162,7 +162,7 @@ static int usb6fire_fw_ezusb_write(struct usb_device *device, | ||
10577 | |||
10578 | ret = usb_control_msg(device, usb_sndctrlpipe(device, 0), type, | ||
10579 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
10580 | - value, 0, data, len, HZ); | ||
10581 | + value, 0, data, len, 1000); | ||
10582 | if (ret < 0) | ||
10583 | return ret; | ||
10584 | else if (ret != len) | ||
10585 | @@ -175,7 +175,7 @@ static int usb6fire_fw_ezusb_read(struct usb_device *device, | ||
10586 | { | ||
10587 | int ret = usb_control_msg(device, usb_rcvctrlpipe(device, 0), type, | ||
10588 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, | ||
10589 | - 0, data, len, HZ); | ||
10590 | + 0, data, len, 1000); | ||
10591 | if (ret < 0) | ||
10592 | return ret; | ||
10593 | else if (ret != len) | ||
10594 | @@ -190,7 +190,7 @@ static int usb6fire_fw_fpga_write(struct usb_device *device, | ||
10595 | int ret; | ||
10596 | |||
10597 | ret = usb_bulk_msg(device, usb_sndbulkpipe(device, FPGA_EP), data, len, | ||
10598 | - &actual_len, HZ); | ||
10599 | + &actual_len, 1000); | ||
10600 | if (ret < 0) | ||
10601 | return ret; | ||
10602 | else if (actual_len != len) | ||
10603 | diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c | ||
10604 | index 1e38cdda2af69..8ca56ba600cf4 100644 | ||
10605 | --- a/sound/usb/line6/driver.c | ||
10606 | +++ b/sound/usb/line6/driver.c | ||
10607 | @@ -113,12 +113,12 @@ static int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, | ||
10608 | retval = usb_interrupt_msg(line6->usbdev, | ||
10609 | usb_sndintpipe(line6->usbdev, properties->ep_ctrl_w), | ||
10610 | (char *)frag_buf, frag_size, | ||
10611 | - &partial, LINE6_TIMEOUT * HZ); | ||
10612 | + &partial, LINE6_TIMEOUT); | ||
10613 | } else { | ||
10614 | retval = usb_bulk_msg(line6->usbdev, | ||
10615 | usb_sndbulkpipe(line6->usbdev, properties->ep_ctrl_w), | ||
10616 | (char *)frag_buf, frag_size, | ||
10617 | - &partial, LINE6_TIMEOUT * HZ); | ||
10618 | + &partial, LINE6_TIMEOUT); | ||
10619 | } | ||
10620 | |||
10621 | if (retval) { | ||
10622 | @@ -350,7 +350,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data, | ||
10623 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, | ||
10624 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
10625 | (datalen << 8) | 0x21, address, | ||
10626 | - NULL, 0, LINE6_TIMEOUT * HZ); | ||
10627 | + NULL, 0, LINE6_TIMEOUT); | ||
10628 | |||
10629 | if (ret < 0) { | ||
10630 | dev_err(line6->ifcdev, "read request failed (error %d)\n", ret); | ||
10631 | @@ -365,7 +365,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data, | ||
10632 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | | ||
10633 | USB_DIR_IN, | ||
10634 | 0x0012, 0x0000, len, 1, | ||
10635 | - LINE6_TIMEOUT * HZ); | ||
10636 | + LINE6_TIMEOUT); | ||
10637 | if (ret < 0) { | ||
10638 | dev_err(line6->ifcdev, | ||
10639 | "receive length failed (error %d)\n", ret); | ||
10640 | @@ -393,7 +393,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data, | ||
10641 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, | ||
10642 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
10643 | 0x0013, 0x0000, data, datalen, | ||
10644 | - LINE6_TIMEOUT * HZ); | ||
10645 | + LINE6_TIMEOUT); | ||
10646 | |||
10647 | if (ret < 0) | ||
10648 | dev_err(line6->ifcdev, "read failed (error %d)\n", ret); | ||
10649 | @@ -425,7 +425,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data, | ||
10650 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, | ||
10651 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
10652 | 0x0022, address, data, datalen, | ||
10653 | - LINE6_TIMEOUT * HZ); | ||
10654 | + LINE6_TIMEOUT); | ||
10655 | |||
10656 | if (ret < 0) { | ||
10657 | dev_err(line6->ifcdev, | ||
10658 | @@ -441,7 +441,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data, | ||
10659 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | | ||
10660 | USB_DIR_IN, | ||
10661 | 0x0012, 0x0000, | ||
10662 | - status, 1, LINE6_TIMEOUT * HZ); | ||
10663 | + status, 1, LINE6_TIMEOUT); | ||
10664 | |||
10665 | if (ret < 0) { | ||
10666 | dev_err(line6->ifcdev, | ||
10667 | diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h | ||
10668 | index e5e572ed5f304..890c239e3fc01 100644 | ||
10669 | --- a/sound/usb/line6/driver.h | ||
10670 | +++ b/sound/usb/line6/driver.h | ||
10671 | @@ -27,7 +27,7 @@ | ||
10672 | #define LINE6_FALLBACK_INTERVAL 10 | ||
10673 | #define LINE6_FALLBACK_MAXPACKETSIZE 16 | ||
10674 | |||
10675 | -#define LINE6_TIMEOUT 1 | ||
10676 | +#define LINE6_TIMEOUT 1000 | ||
10677 | #define LINE6_BUFSIZE_LISTEN 64 | ||
10678 | #define LINE6_MIDI_MESSAGE_MAXLEN 256 | ||
10679 | |||
10680 | diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c | ||
10681 | index 5d9954a2d05e6..8b1610bdb8d5c 100644 | ||
10682 | --- a/sound/usb/line6/podhd.c | ||
10683 | +++ b/sound/usb/line6/podhd.c | ||
10684 | @@ -190,7 +190,7 @@ static int podhd_dev_start(struct usb_line6_podhd *pod) | ||
10685 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), | ||
10686 | 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
10687 | 0x11, 0, | ||
10688 | - NULL, 0, LINE6_TIMEOUT * HZ); | ||
10689 | + NULL, 0, LINE6_TIMEOUT); | ||
10690 | if (ret < 0) { | ||
10691 | dev_err(pod->line6.ifcdev, "read request failed (error %d)\n", ret); | ||
10692 | goto exit; | ||
10693 | @@ -200,7 +200,7 @@ static int podhd_dev_start(struct usb_line6_podhd *pod) | ||
10694 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, | ||
10695 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
10696 | 0x11, 0x0, | ||
10697 | - init_bytes, 3, LINE6_TIMEOUT * HZ); | ||
10698 | + init_bytes, 3, LINE6_TIMEOUT); | ||
10699 | if (ret < 0) { | ||
10700 | dev_err(pod->line6.ifcdev, | ||
10701 | "receive length failed (error %d)\n", ret); | ||
10702 | @@ -220,7 +220,7 @@ static int podhd_dev_start(struct usb_line6_podhd *pod) | ||
10703 | USB_REQ_SET_FEATURE, | ||
10704 | USB_TYPE_STANDARD | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
10705 | 1, 0, | ||
10706 | - NULL, 0, LINE6_TIMEOUT * HZ); | ||
10707 | + NULL, 0, LINE6_TIMEOUT); | ||
10708 | exit: | ||
10709 | kfree(init_bytes); | ||
10710 | return ret; | ||
10711 | diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c | ||
10712 | index d0a555dbe324f..21f86c71dad7f 100644 | ||
10713 | --- a/sound/usb/line6/toneport.c | ||
10714 | +++ b/sound/usb/line6/toneport.c | ||
10715 | @@ -128,7 +128,7 @@ static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) | ||
10716 | |||
10717 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, | ||
10718 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
10719 | - cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ); | ||
10720 | + cmd1, cmd2, NULL, 0, LINE6_TIMEOUT); | ||
10721 | |||
10722 | if (ret < 0) { | ||
10723 | dev_err(&usbdev->dev, "send failed (error %d)\n", ret); | ||
10724 | diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c | ||
10725 | index 307b72d5fffa9..77304a29a61d2 100644 | ||
10726 | --- a/sound/usb/misc/ua101.c | ||
10727 | +++ b/sound/usb/misc/ua101.c | ||
10728 | @@ -1020,7 +1020,7 @@ static int detect_usb_format(struct ua101 *ua) | ||
10729 | fmt_playback->bSubframeSize * ua->playback.channels; | ||
10730 | |||
10731 | epd = &ua->intf[INTF_CAPTURE]->altsetting[1].endpoint[0].desc; | ||
10732 | - if (!usb_endpoint_is_isoc_in(epd)) { | ||
10733 | + if (!usb_endpoint_is_isoc_in(epd) || usb_endpoint_maxp(epd) == 0) { | ||
10734 | dev_err(&ua->dev->dev, "invalid capture endpoint\n"); | ||
10735 | return -ENXIO; | ||
10736 | } | ||
10737 | @@ -1028,7 +1028,7 @@ static int detect_usb_format(struct ua101 *ua) | ||
10738 | ua->capture.max_packet_bytes = usb_endpoint_maxp(epd); | ||
10739 | |||
10740 | epd = &ua->intf[INTF_PLAYBACK]->altsetting[1].endpoint[0].desc; | ||
10741 | - if (!usb_endpoint_is_isoc_out(epd)) { | ||
10742 | + if (!usb_endpoint_is_isoc_out(epd) || usb_endpoint_maxp(epd) == 0) { | ||
10743 | dev_err(&ua->dev->dev, "invalid playback endpoint\n"); | ||
10744 | return -ENXIO; | ||
10745 | } | ||
10746 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c | ||
10747 | index d5d828817c5e8..72223545abfd8 100644 | ||
10748 | --- a/sound/usb/quirks.c | ||
10749 | +++ b/sound/usb/quirks.c | ||
10750 | @@ -1842,6 +1842,7 @@ static const struct registration_quirk registration_quirks[] = { | ||
10751 | REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ | ||
10752 | REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ | ||
10753 | REG_QUIRK_ENTRY(0x0ecb, 0x1f47, 2), /* JBL Quantum 800 */ | ||
10754 | + REG_QUIRK_ENTRY(0x0ecb, 0x1f4c, 2), /* JBL Quantum 400 */ | ||
10755 | REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ | ||
10756 | REG_QUIRK_ENTRY(0x0ecb, 0x203c, 2), /* JBL Quantum 600 */ | ||
10757 | REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ | ||
10758 | diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c | ||
10759 | index d606a358480da..41daf0fa95b9f 100644 | ||
10760 | --- a/tools/lib/bpf/btf.c | ||
10761 | +++ b/tools/lib/bpf/btf.c | ||
10762 | @@ -100,22 +100,18 @@ static int btf_parse_hdr(struct btf *btf) | ||
10763 | return -EINVAL; | ||
10764 | } | ||
10765 | |||
10766 | - if (meta_left < hdr->type_off) { | ||
10767 | - pr_debug("Invalid BTF type section offset:%u\n", hdr->type_off); | ||
10768 | + if (meta_left < hdr->str_off + hdr->str_len) { | ||
10769 | + pr_debug("Invalid BTF total size:%u\n", btf->data_size); | ||
10770 | return -EINVAL; | ||
10771 | } | ||
10772 | |||
10773 | - if (meta_left < hdr->str_off) { | ||
10774 | - pr_debug("Invalid BTF string section offset:%u\n", hdr->str_off); | ||
10775 | + if (hdr->type_off + hdr->type_len > hdr->str_off) { | ||
10776 | + pr_debug("Invalid BTF data sections layout: type data at %u + %u, strings data at %u + %u\n", | ||
10777 | + hdr->type_off, hdr->type_len, hdr->str_off, hdr->str_len); | ||
10778 | return -EINVAL; | ||
10779 | } | ||
10780 | |||
10781 | - if (hdr->type_off >= hdr->str_off) { | ||
10782 | - pr_debug("BTF type section offset >= string section offset. No type?\n"); | ||
10783 | - return -EINVAL; | ||
10784 | - } | ||
10785 | - | ||
10786 | - if (hdr->type_off & 0x02) { | ||
10787 | + if (hdr->type_off % 4) { | ||
10788 | pr_debug("BTF type section is not aligned to 4 bytes\n"); | ||
10789 | return -EINVAL; | ||
10790 | } | ||
10791 | diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c | ||
10792 | index f7ed5d122e229..c766813d56be0 100644 | ||
10793 | --- a/tools/perf/util/bpf-event.c | ||
10794 | +++ b/tools/perf/util/bpf-event.c | ||
10795 | @@ -467,7 +467,7 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, | ||
10796 | synthesize_bpf_prog_name(name, KSYM_NAME_LEN, info, btf, 0); | ||
10797 | fprintf(fp, "# bpf_prog_info %u: %s addr 0x%llx size %u\n", | ||
10798 | info->id, name, prog_addrs[0], prog_lens[0]); | ||
10799 | - return; | ||
10800 | + goto out; | ||
10801 | } | ||
10802 | |||
10803 | fprintf(fp, "# bpf_prog_info %u:\n", info->id); | ||
10804 | @@ -477,4 +477,6 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, | ||
10805 | fprintf(fp, "# \tsub_prog %u: %s addr 0x%llx size %u\n", | ||
10806 | i, name, prog_addrs[i], prog_lens[i]); | ||
10807 | } | ||
10808 | +out: | ||
10809 | + btf__free(btf); | ||
10810 | } | ||
10811 | diff --git a/tools/testing/selftests/bpf/progs/strobemeta.h b/tools/testing/selftests/bpf/progs/strobemeta.h | ||
10812 | index 067eb625d01c5..5ba8d39c4d544 100644 | ||
10813 | --- a/tools/testing/selftests/bpf/progs/strobemeta.h | ||
10814 | +++ b/tools/testing/selftests/bpf/progs/strobemeta.h | ||
10815 | @@ -349,7 +349,7 @@ static __always_inline uint64_t read_str_var(struct strobemeta_cfg *cfg, | ||
10816 | void *payload) | ||
10817 | { | ||
10818 | void *location; | ||
10819 | - uint32_t len; | ||
10820 | + uint64_t len; | ||
10821 | |||
10822 | data->str_lens[idx] = 0; | ||
10823 | location = calc_location(&cfg->str_locs[idx], tls_base); | ||
10824 | @@ -381,7 +381,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, | ||
10825 | struct strobe_map_descr* descr = &data->map_descrs[idx]; | ||
10826 | struct strobe_map_raw map; | ||
10827 | void *location; | ||
10828 | - uint32_t len; | ||
10829 | + uint64_t len; | ||
10830 | int i; | ||
10831 | |||
10832 | descr->tag_len = 0; /* presume no tag is set */ | ||
10833 | diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c | ||
10834 | index 48bbe8e0ce48d..4369bc46bf9c2 100644 | ||
10835 | --- a/tools/testing/selftests/bpf/test_progs.c | ||
10836 | +++ b/tools/testing/selftests/bpf/test_progs.c | ||
10837 | @@ -289,7 +289,7 @@ int extract_build_id(char *build_id, size_t size) | ||
10838 | |||
10839 | if (getline(&line, &len, fp) == -1) | ||
10840 | goto err; | ||
10841 | - fclose(fp); | ||
10842 | + pclose(fp); | ||
10843 | |||
10844 | if (len > size) | ||
10845 | len = size; | ||
10846 | @@ -298,7 +298,7 @@ int extract_build_id(char *build_id, size_t size) | ||
10847 | free(line); | ||
10848 | return 0; | ||
10849 | err: | ||
10850 | - fclose(fp); | ||
10851 | + pclose(fp); | ||
10852 | return -1; | ||
10853 | } | ||
10854 | |||
10855 | diff --git a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | ||
10856 | index 2cbc09aad7f64..92419b66b0578 100644 | ||
10857 | --- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | ||
10858 | +++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | ||
10859 | @@ -84,7 +84,7 @@ int get_warnings_count(void) | ||
10860 | f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); | ||
10861 | if (fscanf(f, "%d", &warnings) < 1) | ||
10862 | warnings = 0; | ||
10863 | - fclose(f); | ||
10864 | + pclose(f); | ||
10865 | |||
10866 | return warnings; | ||
10867 | } | ||
10868 | diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c | ||
10869 | index 76a24052f4b47..6a193425c367f 100644 | ||
10870 | --- a/tools/testing/selftests/net/udpgso_bench_rx.c | ||
10871 | +++ b/tools/testing/selftests/net/udpgso_bench_rx.c | ||
10872 | @@ -293,19 +293,17 @@ static void usage(const char *filepath) | ||
10873 | |||
10874 | static void parse_opts(int argc, char **argv) | ||
10875 | { | ||
10876 | + const char *bind_addr = NULL; | ||
10877 | int c; | ||
10878 | |||
10879 | - /* bind to any by default */ | ||
10880 | - setup_sockaddr(PF_INET6, "::", &cfg_bind_addr); | ||
10881 | while ((c = getopt(argc, argv, "4b:C:Gl:n:p:rR:S:tv")) != -1) { | ||
10882 | switch (c) { | ||
10883 | case '4': | ||
10884 | cfg_family = PF_INET; | ||
10885 | cfg_alen = sizeof(struct sockaddr_in); | ||
10886 | - setup_sockaddr(PF_INET, "0.0.0.0", &cfg_bind_addr); | ||
10887 | break; | ||
10888 | case 'b': | ||
10889 | - setup_sockaddr(cfg_family, optarg, &cfg_bind_addr); | ||
10890 | + bind_addr = optarg; | ||
10891 | break; | ||
10892 | case 'C': | ||
10893 | cfg_connect_timeout_ms = strtoul(optarg, NULL, 0); | ||
10894 | @@ -341,6 +339,11 @@ static void parse_opts(int argc, char **argv) | ||
10895 | } | ||
10896 | } | ||
10897 | |||
10898 | + if (!bind_addr) | ||
10899 | + bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0"; | ||
10900 | + | ||
10901 | + setup_sockaddr(cfg_family, bind_addr, &cfg_bind_addr); | ||
10902 | + | ||
10903 | if (optind != argc) | ||
10904 | usage(argv[0]); | ||
10905 |