Contents of /trunk/kernel-alx/patches-5.4/0288-5.4.189-all-fixes.patch
Parent Directory | Revision Log
Revision 3635 -
(show annotations)
(download)
Mon Oct 24 12:34:12 2022 UTC (20 months ago) by niro
File size: 504642 byte(s)
Mon Oct 24 12:34:12 2022 UTC (20 months ago) by niro
File size: 504642 byte(s)
-sync kernel patches
1 | diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt |
2 | index 8f8d97f65d737..7193505a98cab 100644 |
3 | --- a/Documentation/DMA-attributes.txt |
4 | +++ b/Documentation/DMA-attributes.txt |
5 | @@ -156,3 +156,13 @@ accesses to DMA buffers in both privileged "supervisor" and unprivileged |
6 | subsystem that the buffer is fully accessible at the elevated privilege |
7 | level (and ideally inaccessible or at least read-only at the |
8 | lesser-privileged levels). |
9 | + |
10 | +DMA_ATTR_PRIVILEGED |
11 | +------------------- |
12 | + |
13 | +Some advanced peripherals such as remote processors and GPUs perform |
14 | +accesses to DMA buffers in both privileged "supervisor" and unprivileged |
15 | +"user" modes. This attribute is used to indicate to the DMA-mapping |
16 | +subsystem that the buffer is fully accessible at the elevated privilege |
17 | +level (and ideally inaccessible or at least read-only at the |
18 | +lesser-privileged levels). |
19 | diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml |
20 | index d261b7096c696..2767f182fd3c5 100644 |
21 | --- a/Documentation/devicetree/bindings/mtd/nand-controller.yaml |
22 | +++ b/Documentation/devicetree/bindings/mtd/nand-controller.yaml |
23 | @@ -44,7 +44,7 @@ patternProperties: |
24 | properties: |
25 | reg: |
26 | description: |
27 | - Contains the native Ready/Busy IDs. |
28 | + Contains the chip-select IDs. |
29 | |
30 | nand-ecc-mode: |
31 | allOf: |
32 | @@ -139,6 +139,6 @@ examples: |
33 | nand-ecc-mode = "soft"; |
34 | nand-ecc-algo = "bch"; |
35 | |
36 | - /* controller specific properties */ |
37 | + /* NAND chip specific properties */ |
38 | }; |
39 | }; |
40 | diff --git a/Documentation/devicetree/bindings/spi/spi-mxic.txt b/Documentation/devicetree/bindings/spi/spi-mxic.txt |
41 | index 529f2dab2648a..7bcbb229b78bb 100644 |
42 | --- a/Documentation/devicetree/bindings/spi/spi-mxic.txt |
43 | +++ b/Documentation/devicetree/bindings/spi/spi-mxic.txt |
44 | @@ -8,11 +8,13 @@ Required properties: |
45 | - reg: should contain 2 entries, one for the registers and one for the direct |
46 | mapping area |
47 | - reg-names: should contain "regs" and "dirmap" |
48 | -- interrupts: interrupt line connected to the SPI controller |
49 | - clock-names: should contain "ps_clk", "send_clk" and "send_dly_clk" |
50 | - clocks: should contain 3 entries for the "ps_clk", "send_clk" and |
51 | "send_dly_clk" clocks |
52 | |
53 | +Optional properties: |
54 | +- interrupts: interrupt line connected to the SPI controller |
55 | + |
56 | Example: |
57 | |
58 | spi@43c30000 { |
59 | diff --git a/Documentation/process/stable-kernel-rules.rst b/Documentation/process/stable-kernel-rules.rst |
60 | index 06f743b612c48..bb53707f72cc5 100644 |
61 | --- a/Documentation/process/stable-kernel-rules.rst |
62 | +++ b/Documentation/process/stable-kernel-rules.rst |
63 | @@ -174,7 +174,16 @@ Trees |
64 | - The finalized and tagged releases of all stable kernels can be found |
65 | in separate branches per version at: |
66 | |
67 | - https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git |
68 | + https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git |
69 | + |
70 | + - The release candidate of all stable kernel versions can be found at: |
71 | + |
72 | + https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/ |
73 | + |
74 | + .. warning:: |
75 | + The -stable-rc tree is a snapshot in time of the stable-queue tree and |
76 | + will change frequently, hence will be rebased often. It should only be |
77 | + used for testing purposes (e.g. to be consumed by CI systems). |
78 | |
79 | |
80 | Review committee |
81 | diff --git a/Documentation/sound/hd-audio/models.rst b/Documentation/sound/hd-audio/models.rst |
82 | index 0ea967d345838..4c91abad7b35c 100644 |
83 | --- a/Documentation/sound/hd-audio/models.rst |
84 | +++ b/Documentation/sound/hd-audio/models.rst |
85 | @@ -261,6 +261,10 @@ alc-sense-combo |
86 | huawei-mbx-stereo |
87 | Enable initialization verbs for Huawei MBX stereo speakers; |
88 | might be risky, try this at your own risk |
89 | +alc298-samsung-headphone |
90 | + Samsung laptops with ALC298 |
91 | +alc256-samsung-headphone |
92 | + Samsung laptops with ALC256 |
93 | |
94 | ALC66x/67x/892 |
95 | ============== |
96 | diff --git a/Makefile b/Makefile |
97 | index 8684857148066..cbb71900d3dcf 100644 |
98 | --- a/Makefile |
99 | +++ b/Makefile |
100 | @@ -1,7 +1,7 @@ |
101 | # SPDX-License-Identifier: GPL-2.0 |
102 | VERSION = 5 |
103 | PATCHLEVEL = 4 |
104 | -SUBLEVEL = 188 |
105 | +SUBLEVEL = 189 |
106 | EXTRAVERSION = |
107 | NAME = Kleptomaniac Octopus |
108 | |
109 | diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi |
110 | index beb6c502dadc7..bcad098a7fccb 100644 |
111 | --- a/arch/arm/boot/dts/bcm2837.dtsi |
112 | +++ b/arch/arm/boot/dts/bcm2837.dtsi |
113 | @@ -38,12 +38,26 @@ |
114 | #size-cells = <0>; |
115 | enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit |
116 | |
117 | + /* Source for d/i-cache-line-size and d/i-cache-sets |
118 | + * https://developer.arm.com/documentation/ddi0500/e/level-1-memory-system |
119 | + * /about-the-l1-memory-system?lang=en |
120 | + * |
121 | + * Source for d/i-cache-size |
122 | + * https://magpi.raspberrypi.com/articles/raspberry-pi-3-specs-benchmarks |
123 | + */ |
124 | cpu0: cpu@0 { |
125 | device_type = "cpu"; |
126 | compatible = "arm,cortex-a53"; |
127 | reg = <0>; |
128 | enable-method = "spin-table"; |
129 | cpu-release-addr = <0x0 0x000000d8>; |
130 | + d-cache-size = <0x8000>; |
131 | + d-cache-line-size = <64>; |
132 | + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
133 | + i-cache-size = <0x8000>; |
134 | + i-cache-line-size = <64>; |
135 | + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
136 | + next-level-cache = <&l2>; |
137 | }; |
138 | |
139 | cpu1: cpu@1 { |
140 | @@ -52,6 +66,13 @@ |
141 | reg = <1>; |
142 | enable-method = "spin-table"; |
143 | cpu-release-addr = <0x0 0x000000e0>; |
144 | + d-cache-size = <0x8000>; |
145 | + d-cache-line-size = <64>; |
146 | + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
147 | + i-cache-size = <0x8000>; |
148 | + i-cache-line-size = <64>; |
149 | + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
150 | + next-level-cache = <&l2>; |
151 | }; |
152 | |
153 | cpu2: cpu@2 { |
154 | @@ -60,6 +81,13 @@ |
155 | reg = <2>; |
156 | enable-method = "spin-table"; |
157 | cpu-release-addr = <0x0 0x000000e8>; |
158 | + d-cache-size = <0x8000>; |
159 | + d-cache-line-size = <64>; |
160 | + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
161 | + i-cache-size = <0x8000>; |
162 | + i-cache-line-size = <64>; |
163 | + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
164 | + next-level-cache = <&l2>; |
165 | }; |
166 | |
167 | cpu3: cpu@3 { |
168 | @@ -68,6 +96,27 @@ |
169 | reg = <3>; |
170 | enable-method = "spin-table"; |
171 | cpu-release-addr = <0x0 0x000000f0>; |
172 | + d-cache-size = <0x8000>; |
173 | + d-cache-line-size = <64>; |
174 | + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set |
175 | + i-cache-size = <0x8000>; |
176 | + i-cache-line-size = <64>; |
177 | + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set |
178 | + next-level-cache = <&l2>; |
179 | + }; |
180 | + |
181 | + /* Source for cache-line-size + cache-sets |
182 | + * https://developer.arm.com/documentation/ddi0500 |
183 | + * /e/level-2-memory-system/about-the-l2-memory-system?lang=en |
184 | + * Source for cache-size |
185 | + * https://datasheets.raspberrypi.com/cm/cm1-and-cm3-datasheet.pdf |
186 | + */ |
187 | + l2: l2-cache0 { |
188 | + compatible = "cache"; |
189 | + cache-size = <0x80000>; |
190 | + cache-line-size = <64>; |
191 | + cache-sets = <512>; // 512KiB(size)/64(line-size)=8192ways/16-way set |
192 | + cache-level = <2>; |
193 | }; |
194 | }; |
195 | }; |
196 | diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi |
197 | index d31a68672bfac..d7d756614edd1 100644 |
198 | --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi |
199 | +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi |
200 | @@ -260,7 +260,7 @@ |
201 | }; |
202 | |
203 | uart3_data: uart3-data { |
204 | - samsung,pins = "gpa1-4", "gpa1-4"; |
205 | + samsung,pins = "gpa1-4", "gpa1-5"; |
206 | samsung,pin-function = <EXYNOS_PIN_FUNC_2>; |
207 | samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; |
208 | samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>; |
209 | diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts |
210 | index 70a2b6e2ad3fa..fa5dd992e3273 100644 |
211 | --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts |
212 | +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts |
213 | @@ -117,6 +117,9 @@ |
214 | status = "okay"; |
215 | ddc = <&i2c_2>; |
216 | hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>; |
217 | + vdd-supply = <&ldo8_reg>; |
218 | + vdd_osc-supply = <&ldo10_reg>; |
219 | + vdd_pll-supply = <&ldo8_reg>; |
220 | }; |
221 | |
222 | &i2c_0 { |
223 | diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts |
224 | index 8240e51869729..fb92d87d8dedc 100644 |
225 | --- a/arch/arm/boot/dts/exynos5420-smdk5420.dts |
226 | +++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts |
227 | @@ -132,6 +132,9 @@ |
228 | hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>; |
229 | pinctrl-names = "default"; |
230 | pinctrl-0 = <&hdmi_hpd_irq>; |
231 | + vdd-supply = <&ldo6_reg>; |
232 | + vdd_osc-supply = <&ldo7_reg>; |
233 | + vdd_pll-supply = <&ldo6_reg>; |
234 | }; |
235 | |
236 | &hsi2c_4 { |
237 | diff --git a/arch/arm/boot/dts/imx53-m53menlo.dts b/arch/arm/boot/dts/imx53-m53menlo.dts |
238 | index 03c43c1912a7e..d002c8f738b53 100644 |
239 | --- a/arch/arm/boot/dts/imx53-m53menlo.dts |
240 | +++ b/arch/arm/boot/dts/imx53-m53menlo.dts |
241 | @@ -53,6 +53,31 @@ |
242 | }; |
243 | }; |
244 | |
245 | + lvds-decoder { |
246 | + compatible = "ti,ds90cf364a", "lvds-decoder"; |
247 | + |
248 | + ports { |
249 | + #address-cells = <1>; |
250 | + #size-cells = <0>; |
251 | + |
252 | + port@0 { |
253 | + reg = <0>; |
254 | + |
255 | + lvds_decoder_in: endpoint { |
256 | + remote-endpoint = <&lvds0_out>; |
257 | + }; |
258 | + }; |
259 | + |
260 | + port@1 { |
261 | + reg = <1>; |
262 | + |
263 | + lvds_decoder_out: endpoint { |
264 | + remote-endpoint = <&panel_in>; |
265 | + }; |
266 | + }; |
267 | + }; |
268 | + }; |
269 | + |
270 | panel { |
271 | compatible = "edt,etm0700g0dh6"; |
272 | pinctrl-0 = <&pinctrl_display_gpio>; |
273 | @@ -61,7 +86,7 @@ |
274 | |
275 | port { |
276 | panel_in: endpoint { |
277 | - remote-endpoint = <&lvds0_out>; |
278 | + remote-endpoint = <&lvds_decoder_out>; |
279 | }; |
280 | }; |
281 | }; |
282 | @@ -450,7 +475,7 @@ |
283 | reg = <2>; |
284 | |
285 | lvds0_out: endpoint { |
286 | - remote-endpoint = <&panel_in>; |
287 | + remote-endpoint = <&lvds_decoder_in>; |
288 | }; |
289 | }; |
290 | }; |
291 | diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi b/arch/arm/boot/dts/qcom-ipq4019.dtsi |
292 | index 56f51599852d0..338256c59ca5a 100644 |
293 | --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi |
294 | +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi |
295 | @@ -141,7 +141,8 @@ |
296 | clocks { |
297 | sleep_clk: sleep_clk { |
298 | compatible = "fixed-clock"; |
299 | - clock-frequency = <32768>; |
300 | + clock-frequency = <32000>; |
301 | + clock-output-names = "gcc_sleep_clk_src"; |
302 | #clock-cells = <0>; |
303 | }; |
304 | |
305 | diff --git a/arch/arm/boot/dts/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom-msm8960.dtsi |
306 | index f2aeaccdc1ad6..15ff0e8fd0d30 100644 |
307 | --- a/arch/arm/boot/dts/qcom-msm8960.dtsi |
308 | +++ b/arch/arm/boot/dts/qcom-msm8960.dtsi |
309 | @@ -145,7 +145,9 @@ |
310 | reg = <0x108000 0x1000>; |
311 | qcom,ipc = <&l2cc 0x8 2>; |
312 | |
313 | - interrupts = <0 19 0>, <0 21 0>, <0 22 0>; |
314 | + interrupts = <GIC_SPI 19 IRQ_TYPE_EDGE_RISING>, |
315 | + <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>, |
316 | + <GIC_SPI 22 IRQ_TYPE_EDGE_RISING>; |
317 | interrupt-names = "ack", "err", "wakeup"; |
318 | |
319 | regulators { |
320 | @@ -191,7 +193,7 @@ |
321 | compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; |
322 | reg = <0x16440000 0x1000>, |
323 | <0x16400000 0x1000>; |
324 | - interrupts = <0 154 0x0>; |
325 | + interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>; |
326 | clocks = <&gcc GSBI5_UART_CLK>, <&gcc GSBI5_H_CLK>; |
327 | clock-names = "core", "iface"; |
328 | status = "disabled"; |
329 | @@ -317,7 +319,7 @@ |
330 | #address-cells = <1>; |
331 | #size-cells = <0>; |
332 | reg = <0x16080000 0x1000>; |
333 | - interrupts = <0 147 0>; |
334 | + interrupts = <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>; |
335 | spi-max-frequency = <24000000>; |
336 | cs-gpios = <&msmgpio 8 0>; |
337 | |
338 | diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi |
339 | index b05bab57f90a3..09816a2ee3670 100644 |
340 | --- a/arch/arm/boot/dts/sama5d2.dtsi |
341 | +++ b/arch/arm/boot/dts/sama5d2.dtsi |
342 | @@ -526,7 +526,7 @@ |
343 | pmecc: ecc-engine@f8014070 { |
344 | compatible = "atmel,sama5d2-pmecc"; |
345 | reg = <0xf8014070 0x490>, |
346 | - <0xf8014500 0x100>; |
347 | + <0xf8014500 0x200>; |
348 | }; |
349 | }; |
350 | |
351 | diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi |
352 | index 1a8f5e8b10e3a..66cd473ecb617 100644 |
353 | --- a/arch/arm/boot/dts/spear1340.dtsi |
354 | +++ b/arch/arm/boot/dts/spear1340.dtsi |
355 | @@ -136,9 +136,9 @@ |
356 | reg = <0xb4100000 0x1000>; |
357 | interrupts = <0 105 0x4>; |
358 | status = "disabled"; |
359 | - dmas = <&dwdma0 12 0 1>, |
360 | - <&dwdma0 13 1 0>; |
361 | - dma-names = "tx", "rx"; |
362 | + dmas = <&dwdma0 13 0 1>, |
363 | + <&dwdma0 12 1 0>; |
364 | + dma-names = "rx", "tx"; |
365 | }; |
366 | |
367 | thermal@e07008c4 { |
368 | diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi |
369 | index f187da4485f46..78672db9068be 100644 |
370 | --- a/arch/arm/boot/dts/spear13xx.dtsi |
371 | +++ b/arch/arm/boot/dts/spear13xx.dtsi |
372 | @@ -284,9 +284,9 @@ |
373 | #size-cells = <0>; |
374 | interrupts = <0 31 0x4>; |
375 | status = "disabled"; |
376 | - dmas = <&dwdma0 4 0 0>, |
377 | - <&dwdma0 5 0 0>; |
378 | - dma-names = "tx", "rx"; |
379 | + dmas = <&dwdma0 5 0 0>, |
380 | + <&dwdma0 4 0 0>; |
381 | + dma-names = "rx", "tx"; |
382 | }; |
383 | |
384 | rtc@e0580000 { |
385 | diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi |
386 | index 394a6b4dc69d5..69cb65d86c467 100644 |
387 | --- a/arch/arm/boot/dts/tegra20-tamonten.dtsi |
388 | +++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi |
389 | @@ -183,8 +183,8 @@ |
390 | }; |
391 | conf_ata { |
392 | nvidia,pins = "ata", "atb", "atc", "atd", "ate", |
393 | - "cdev1", "cdev2", "dap1", "dtb", "gma", |
394 | - "gmb", "gmc", "gmd", "gme", "gpu7", |
395 | + "cdev1", "cdev2", "dap1", "dtb", "dtf", |
396 | + "gma", "gmb", "gmc", "gmd", "gme", "gpu7", |
397 | "gpv", "i2cp", "irrx", "irtx", "pta", |
398 | "rm", "slxa", "slxk", "spia", "spib", |
399 | "uac"; |
400 | @@ -203,7 +203,7 @@ |
401 | }; |
402 | conf_crtp { |
403 | nvidia,pins = "crtp", "dap2", "dap3", "dap4", |
404 | - "dtc", "dte", "dtf", "gpu", "sdio1", |
405 | + "dtc", "dte", "gpu", "sdio1", |
406 | "slxc", "slxd", "spdi", "spdo", "spig", |
407 | "uda"; |
408 | nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
409 | diff --git a/arch/arm/mach-iop32x/include/mach/entry-macro.S b/arch/arm/mach-iop32x/include/mach/entry-macro.S |
410 | index 8e6766d4621eb..341e5d9a6616d 100644 |
411 | --- a/arch/arm/mach-iop32x/include/mach/entry-macro.S |
412 | +++ b/arch/arm/mach-iop32x/include/mach/entry-macro.S |
413 | @@ -20,7 +20,7 @@ |
414 | mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC |
415 | cmp \irqstat, #0 |
416 | clzne \irqnr, \irqstat |
417 | - rsbne \irqnr, \irqnr, #31 |
418 | + rsbne \irqnr, \irqnr, #32 |
419 | .endm |
420 | |
421 | .macro arch_ret_to_user, tmp1, tmp2 |
422 | diff --git a/arch/arm/mach-iop32x/include/mach/irqs.h b/arch/arm/mach-iop32x/include/mach/irqs.h |
423 | index c4e78df428e86..e09ae5f48aec5 100644 |
424 | --- a/arch/arm/mach-iop32x/include/mach/irqs.h |
425 | +++ b/arch/arm/mach-iop32x/include/mach/irqs.h |
426 | @@ -9,6 +9,6 @@ |
427 | #ifndef __IRQS_H |
428 | #define __IRQS_H |
429 | |
430 | -#define NR_IRQS 32 |
431 | +#define NR_IRQS 33 |
432 | |
433 | #endif |
434 | diff --git a/arch/arm/mach-iop32x/irq.c b/arch/arm/mach-iop32x/irq.c |
435 | index 2d48bf1398c10..d1e8824cbd824 100644 |
436 | --- a/arch/arm/mach-iop32x/irq.c |
437 | +++ b/arch/arm/mach-iop32x/irq.c |
438 | @@ -32,14 +32,14 @@ static void intstr_write(u32 val) |
439 | static void |
440 | iop32x_irq_mask(struct irq_data *d) |
441 | { |
442 | - iop32x_mask &= ~(1 << d->irq); |
443 | + iop32x_mask &= ~(1 << (d->irq - 1)); |
444 | intctl_write(iop32x_mask); |
445 | } |
446 | |
447 | static void |
448 | iop32x_irq_unmask(struct irq_data *d) |
449 | { |
450 | - iop32x_mask |= 1 << d->irq; |
451 | + iop32x_mask |= 1 << (d->irq - 1); |
452 | intctl_write(iop32x_mask); |
453 | } |
454 | |
455 | @@ -65,7 +65,7 @@ void __init iop32x_init_irq(void) |
456 | machine_is_em7210()) |
457 | *IOP3XX_PCIIRSR = 0x0f; |
458 | |
459 | - for (i = 0; i < NR_IRQS; i++) { |
460 | + for (i = 1; i < NR_IRQS; i++) { |
461 | irq_set_chip_and_handler(i, &ext_chip, handle_level_irq); |
462 | irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE); |
463 | } |
464 | diff --git a/arch/arm/mach-iop32x/irqs.h b/arch/arm/mach-iop32x/irqs.h |
465 | index 69858e4e905d1..e1dfc8b4e7d7e 100644 |
466 | --- a/arch/arm/mach-iop32x/irqs.h |
467 | +++ b/arch/arm/mach-iop32x/irqs.h |
468 | @@ -7,36 +7,40 @@ |
469 | #ifndef __IOP32X_IRQS_H |
470 | #define __IOP32X_IRQS_H |
471 | |
472 | +/* Interrupts in Linux start at 1, hardware starts at 0 */ |
473 | + |
474 | +#define IOP_IRQ(x) ((x) + 1) |
475 | + |
476 | /* |
477 | * IOP80321 chipset interrupts |
478 | */ |
479 | -#define IRQ_IOP32X_DMA0_EOT 0 |
480 | -#define IRQ_IOP32X_DMA0_EOC 1 |
481 | -#define IRQ_IOP32X_DMA1_EOT 2 |
482 | -#define IRQ_IOP32X_DMA1_EOC 3 |
483 | -#define IRQ_IOP32X_AA_EOT 6 |
484 | -#define IRQ_IOP32X_AA_EOC 7 |
485 | -#define IRQ_IOP32X_CORE_PMON 8 |
486 | -#define IRQ_IOP32X_TIMER0 9 |
487 | -#define IRQ_IOP32X_TIMER1 10 |
488 | -#define IRQ_IOP32X_I2C_0 11 |
489 | -#define IRQ_IOP32X_I2C_1 12 |
490 | -#define IRQ_IOP32X_MESSAGING 13 |
491 | -#define IRQ_IOP32X_ATU_BIST 14 |
492 | -#define IRQ_IOP32X_PERFMON 15 |
493 | -#define IRQ_IOP32X_CORE_PMU 16 |
494 | -#define IRQ_IOP32X_BIU_ERR 17 |
495 | -#define IRQ_IOP32X_ATU_ERR 18 |
496 | -#define IRQ_IOP32X_MCU_ERR 19 |
497 | -#define IRQ_IOP32X_DMA0_ERR 20 |
498 | -#define IRQ_IOP32X_DMA1_ERR 21 |
499 | -#define IRQ_IOP32X_AA_ERR 23 |
500 | -#define IRQ_IOP32X_MSG_ERR 24 |
501 | -#define IRQ_IOP32X_SSP 25 |
502 | -#define IRQ_IOP32X_XINT0 27 |
503 | -#define IRQ_IOP32X_XINT1 28 |
504 | -#define IRQ_IOP32X_XINT2 29 |
505 | -#define IRQ_IOP32X_XINT3 30 |
506 | -#define IRQ_IOP32X_HPI 31 |
507 | +#define IRQ_IOP32X_DMA0_EOT IOP_IRQ(0) |
508 | +#define IRQ_IOP32X_DMA0_EOC IOP_IRQ(1) |
509 | +#define IRQ_IOP32X_DMA1_EOT IOP_IRQ(2) |
510 | +#define IRQ_IOP32X_DMA1_EOC IOP_IRQ(3) |
511 | +#define IRQ_IOP32X_AA_EOT IOP_IRQ(6) |
512 | +#define IRQ_IOP32X_AA_EOC IOP_IRQ(7) |
513 | +#define IRQ_IOP32X_CORE_PMON IOP_IRQ(8) |
514 | +#define IRQ_IOP32X_TIMER0 IOP_IRQ(9) |
515 | +#define IRQ_IOP32X_TIMER1 IOP_IRQ(10) |
516 | +#define IRQ_IOP32X_I2C_0 IOP_IRQ(11) |
517 | +#define IRQ_IOP32X_I2C_1 IOP_IRQ(12) |
518 | +#define IRQ_IOP32X_MESSAGING IOP_IRQ(13) |
519 | +#define IRQ_IOP32X_ATU_BIST IOP_IRQ(14) |
520 | +#define IRQ_IOP32X_PERFMON IOP_IRQ(15) |
521 | +#define IRQ_IOP32X_CORE_PMU IOP_IRQ(16) |
522 | +#define IRQ_IOP32X_BIU_ERR IOP_IRQ(17) |
523 | +#define IRQ_IOP32X_ATU_ERR IOP_IRQ(18) |
524 | +#define IRQ_IOP32X_MCU_ERR IOP_IRQ(19) |
525 | +#define IRQ_IOP32X_DMA0_ERR IOP_IRQ(20) |
526 | +#define IRQ_IOP32X_DMA1_ERR IOP_IRQ(21) |
527 | +#define IRQ_IOP32X_AA_ERR IOP_IRQ(23) |
528 | +#define IRQ_IOP32X_MSG_ERR IOP_IRQ(24) |
529 | +#define IRQ_IOP32X_SSP IOP_IRQ(25) |
530 | +#define IRQ_IOP32X_XINT0 IOP_IRQ(27) |
531 | +#define IRQ_IOP32X_XINT1 IOP_IRQ(28) |
532 | +#define IRQ_IOP32X_XINT2 IOP_IRQ(29) |
533 | +#define IRQ_IOP32X_XINT3 IOP_IRQ(30) |
534 | +#define IRQ_IOP32X_HPI IOP_IRQ(31) |
535 | |
536 | #endif |
537 | diff --git a/arch/arm/mach-mmp/sram.c b/arch/arm/mach-mmp/sram.c |
538 | index 6794e2db1ad5f..ecc46c31004f6 100644 |
539 | --- a/arch/arm/mach-mmp/sram.c |
540 | +++ b/arch/arm/mach-mmp/sram.c |
541 | @@ -72,6 +72,8 @@ static int sram_probe(struct platform_device *pdev) |
542 | if (!info) |
543 | return -ENOMEM; |
544 | |
545 | + platform_set_drvdata(pdev, info); |
546 | + |
547 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
548 | if (res == NULL) { |
549 | dev_err(&pdev->dev, "no memory resource defined\n"); |
550 | @@ -107,8 +109,6 @@ static int sram_probe(struct platform_device *pdev) |
551 | list_add(&info->node, &sram_bank_list); |
552 | mutex_unlock(&sram_lock); |
553 | |
554 | - platform_set_drvdata(pdev, info); |
555 | - |
556 | dev_info(&pdev->dev, "initialized\n"); |
557 | return 0; |
558 | |
559 | @@ -127,17 +127,19 @@ static int sram_remove(struct platform_device *pdev) |
560 | struct sram_bank_info *info; |
561 | |
562 | info = platform_get_drvdata(pdev); |
563 | - if (info == NULL) |
564 | - return -ENODEV; |
565 | |
566 | - mutex_lock(&sram_lock); |
567 | - list_del(&info->node); |
568 | - mutex_unlock(&sram_lock); |
569 | + if (info->sram_size) { |
570 | + mutex_lock(&sram_lock); |
571 | + list_del(&info->node); |
572 | + mutex_unlock(&sram_lock); |
573 | + |
574 | + gen_pool_destroy(info->gpool); |
575 | + iounmap(info->sram_virt); |
576 | + kfree(info->pool_name); |
577 | + } |
578 | |
579 | - gen_pool_destroy(info->gpool); |
580 | - iounmap(info->sram_virt); |
581 | - kfree(info->pool_name); |
582 | kfree(info); |
583 | + |
584 | return 0; |
585 | } |
586 | |
587 | diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c |
588 | index 885e8f12e4b91..eedc9f8ed2109 100644 |
589 | --- a/arch/arm/mach-s3c24xx/mach-jive.c |
590 | +++ b/arch/arm/mach-s3c24xx/mach-jive.c |
591 | @@ -237,11 +237,11 @@ static int __init jive_mtdset(char *options) |
592 | unsigned long set; |
593 | |
594 | if (options == NULL || options[0] == '\0') |
595 | - return 0; |
596 | + return 1; |
597 | |
598 | if (kstrtoul(options, 10, &set)) { |
599 | printk(KERN_ERR "failed to parse mtdset=%s\n", options); |
600 | - return 0; |
601 | + return 1; |
602 | } |
603 | |
604 | switch (set) { |
605 | @@ -256,7 +256,7 @@ static int __init jive_mtdset(char *options) |
606 | "using default.", set); |
607 | } |
608 | |
609 | - return 0; |
610 | + return 1; |
611 | } |
612 | |
613 | /* parse the mtdset= option given to the kernel command line */ |
614 | diff --git a/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts b/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts |
615 | index ec19fbf928a14..12a4b1c03390c 100644 |
616 | --- a/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts |
617 | +++ b/arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dts |
618 | @@ -111,8 +111,8 @@ |
619 | compatible = "silabs,si3226x"; |
620 | reg = <0>; |
621 | spi-max-frequency = <5000000>; |
622 | - spi-cpha = <1>; |
623 | - spi-cpol = <1>; |
624 | + spi-cpha; |
625 | + spi-cpol; |
626 | pl022,hierarchy = <0>; |
627 | pl022,interface = <0>; |
628 | pl022,slave-tx-disable = <0>; |
629 | @@ -135,8 +135,8 @@ |
630 | at25,byte-len = <0x8000>; |
631 | at25,addr-mode = <2>; |
632 | at25,page-size = <64>; |
633 | - spi-cpha = <1>; |
634 | - spi-cpol = <1>; |
635 | + spi-cpha; |
636 | + spi-cpol; |
637 | pl022,hierarchy = <0>; |
638 | pl022,interface = <0>; |
639 | pl022,slave-tx-disable = <0>; |
640 | diff --git a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
641 | index 39802066232e1..edc1a8a4c4bc0 100644 |
642 | --- a/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
643 | +++ b/arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |
644 | @@ -687,7 +687,7 @@ |
645 | }; |
646 | }; |
647 | |
648 | - sata: ahci@663f2000 { |
649 | + sata: sata@663f2000 { |
650 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
651 | reg = <0x663f2000 0x1000>; |
652 | dma-coherent; |
653 | diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi |
654 | index 9573da378826b..1954cef8c6f0b 100644 |
655 | --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi |
656 | +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi |
657 | @@ -459,9 +459,9 @@ |
658 | qcom,tcs-offset = <0xd00>; |
659 | qcom,drv-id = <2>; |
660 | qcom,tcs-config = <ACTIVE_TCS 2>, |
661 | - <SLEEP_TCS 1>, |
662 | - <WAKE_TCS 1>, |
663 | - <CONTROL_TCS 0>; |
664 | + <SLEEP_TCS 3>, |
665 | + <WAKE_TCS 3>, |
666 | + <CONTROL_TCS 1>; |
667 | |
668 | rpmhcc: clock-controller { |
669 | compatible = "qcom,sm8150-rpmh-clk"; |
670 | diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts |
671 | index 76f5db696009b..5b7e8fbf1ffec 100644 |
672 | --- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts |
673 | +++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts |
674 | @@ -666,8 +666,8 @@ |
675 | sd-uhs-sdr104; |
676 | |
677 | /* Power supply */ |
678 | - vqmmc-supply = &vcc1v8_s3; /* IO line */ |
679 | - vmmc-supply = &vcc_sdio; /* card's power */ |
680 | + vqmmc-supply = <&vcc1v8_s3>; /* IO line */ |
681 | + vmmc-supply = <&vcc_sdio>; /* card's power */ |
682 | |
683 | #address-cells = <1>; |
684 | #size-cells = <0>; |
685 | diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h |
686 | index 78d110667c0c7..ffe0aad96b17b 100644 |
687 | --- a/arch/arm64/include/asm/kvm_mmu.h |
688 | +++ b/arch/arm64/include/asm/kvm_mmu.h |
689 | @@ -479,7 +479,8 @@ static inline void *kvm_get_hyp_vector(void) |
690 | int slot = -1; |
691 | |
692 | if ((cpus_have_const_cap(ARM64_HARDEN_BRANCH_PREDICTOR) || |
693 | - cpus_have_const_cap(ARM64_SPECTRE_BHB)) && data->template_start) { |
694 | + cpus_have_const_cap(ARM64_SPECTRE_BHB)) && |
695 | + data && data->template_start) { |
696 | vect = kern_hyp_va(kvm_ksym_ref(__bp_harden_hyp_vecs_start)); |
697 | slot = data->hyp_vectors_slot; |
698 | } |
699 | diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c |
700 | index e4d6af2fdec71..5397f0d9e5bbb 100644 |
701 | --- a/arch/arm64/kernel/cpuidle.c |
702 | +++ b/arch/arm64/kernel/cpuidle.c |
703 | @@ -53,6 +53,9 @@ static int psci_acpi_cpu_init_idle(unsigned int cpu) |
704 | struct acpi_lpi_state *lpi; |
705 | struct acpi_processor *pr = per_cpu(processors, cpu); |
706 | |
707 | + if (unlikely(!pr || !pr->flags.has_lpi)) |
708 | + return -EINVAL; |
709 | + |
710 | /* |
711 | * If the PSCI cpu_suspend function hook has not been initialized |
712 | * idle states must not be enabled, so bail out |
713 | @@ -60,9 +63,6 @@ static int psci_acpi_cpu_init_idle(unsigned int cpu) |
714 | if (!psci_ops.cpu_suspend) |
715 | return -EOPNOTSUPP; |
716 | |
717 | - if (unlikely(!pr || !pr->flags.has_lpi)) |
718 | - return -EINVAL; |
719 | - |
720 | count = pr->power.count - 1; |
721 | if (count <= 0) |
722 | return -ENODEV; |
723 | diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c |
724 | index 53bcf5386907f..a02c294a47530 100644 |
725 | --- a/arch/arm64/kernel/insn.c |
726 | +++ b/arch/arm64/kernel/insn.c |
727 | @@ -207,8 +207,8 @@ static int __kprobes aarch64_insn_patch_text_cb(void *arg) |
728 | int i, ret = 0; |
729 | struct aarch64_insn_patch *pp = arg; |
730 | |
731 | - /* The first CPU becomes master */ |
732 | - if (atomic_inc_return(&pp->cpu_count) == 1) { |
733 | + /* The last CPU becomes master */ |
734 | + if (atomic_inc_return(&pp->cpu_count) == num_online_cpus()) { |
735 | for (i = 0; ret == 0 && i < pp->insn_cnt; i++) |
736 | ret = aarch64_insn_patch_text_nosync(pp->text_addrs[i], |
737 | pp->new_insns[i]); |
738 | diff --git a/arch/arm64/kernel/module.lds b/arch/arm64/kernel/module.lds |
739 | index 09a0eef71d12b..9371abe2f4c2d 100644 |
740 | --- a/arch/arm64/kernel/module.lds |
741 | +++ b/arch/arm64/kernel/module.lds |
742 | @@ -1,5 +1,5 @@ |
743 | SECTIONS { |
744 | - .plt 0 (NOLOAD) : { BYTE(0) } |
745 | - .init.plt 0 (NOLOAD) : { BYTE(0) } |
746 | - .text.ftrace_trampoline 0 (NOLOAD) : { BYTE(0) } |
747 | + .plt 0 : { BYTE(0) } |
748 | + .init.plt 0 : { BYTE(0) } |
749 | + .text.ftrace_trampoline 0 : { BYTE(0) } |
750 | } |
751 | diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c |
752 | index a343677837c77..17a8d1484f9b9 100644 |
753 | --- a/arch/arm64/net/bpf_jit_comp.c |
754 | +++ b/arch/arm64/net/bpf_jit_comp.c |
755 | @@ -909,15 +909,18 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) |
756 | goto out_off; |
757 | } |
758 | |
759 | - /* 1. Initial fake pass to compute ctx->idx. */ |
760 | - |
761 | - /* Fake pass to fill in ctx->offset. */ |
762 | - if (build_body(&ctx, extra_pass)) { |
763 | + /* |
764 | + * 1. Initial fake pass to compute ctx->idx and ctx->offset. |
765 | + * |
766 | + * BPF line info needs ctx->offset[i] to be the offset of |
767 | + * instruction[i] in jited image, so build prologue first. |
768 | + */ |
769 | + if (build_prologue(&ctx, was_classic)) { |
770 | prog = orig_prog; |
771 | goto out_off; |
772 | } |
773 | |
774 | - if (build_prologue(&ctx, was_classic)) { |
775 | + if (build_body(&ctx, extra_pass)) { |
776 | prog = orig_prog; |
777 | goto out_off; |
778 | } |
779 | @@ -983,6 +986,11 @@ skip_init_ctx: |
780 | prog->jited_len = image_size; |
781 | |
782 | if (!prog->is_func || extra_pass) { |
783 | + int i; |
784 | + |
785 | + /* offset[prog->len] is the size of program */ |
786 | + for (i = 0; i <= prog->len; i++) |
787 | + ctx.offset[i] *= AARCH64_INSN_SIZE; |
788 | bpf_prog_fill_jited_linfo(prog, ctx.offset + 1); |
789 | out_off: |
790 | kfree(ctx.offset); |
791 | diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h |
792 | index a1f206b90753a..c8cd66c8d2577 100644 |
793 | --- a/arch/microblaze/include/asm/uaccess.h |
794 | +++ b/arch/microblaze/include/asm/uaccess.h |
795 | @@ -171,27 +171,27 @@ extern long __user_bad(void); |
796 | |
797 | #define __get_user(x, ptr) \ |
798 | ({ \ |
799 | - unsigned long __gu_val = 0; \ |
800 | long __gu_err; \ |
801 | switch (sizeof(*(ptr))) { \ |
802 | case 1: \ |
803 | - __get_user_asm("lbu", (ptr), __gu_val, __gu_err); \ |
804 | + __get_user_asm("lbu", (ptr), x, __gu_err); \ |
805 | break; \ |
806 | case 2: \ |
807 | - __get_user_asm("lhu", (ptr), __gu_val, __gu_err); \ |
808 | + __get_user_asm("lhu", (ptr), x, __gu_err); \ |
809 | break; \ |
810 | case 4: \ |
811 | - __get_user_asm("lw", (ptr), __gu_val, __gu_err); \ |
812 | + __get_user_asm("lw", (ptr), x, __gu_err); \ |
813 | break; \ |
814 | - case 8: \ |
815 | - __gu_err = __copy_from_user(&__gu_val, ptr, 8); \ |
816 | - if (__gu_err) \ |
817 | - __gu_err = -EFAULT; \ |
818 | + case 8: { \ |
819 | + __u64 __x = 0; \ |
820 | + __gu_err = raw_copy_from_user(&__x, ptr, 8) ? \ |
821 | + -EFAULT : 0; \ |
822 | + (x) = (typeof(x))(typeof((x) - (x)))__x; \ |
823 | break; \ |
824 | + } \ |
825 | default: \ |
826 | /* __gu_val = 0; __gu_err = -EINVAL;*/ __gu_err = __user_bad();\ |
827 | } \ |
828 | - x = (__force __typeof__(*(ptr))) __gu_val; \ |
829 | __gu_err; \ |
830 | }) |
831 | |
832 | diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S |
833 | index a25ef822e7250..5ed38e6180190 100644 |
834 | --- a/arch/mips/dec/int-handler.S |
835 | +++ b/arch/mips/dec/int-handler.S |
836 | @@ -131,7 +131,7 @@ |
837 | */ |
838 | mfc0 t0,CP0_CAUSE # get pending interrupts |
839 | mfc0 t1,CP0_STATUS |
840 | -#ifdef CONFIG_32BIT |
841 | +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) |
842 | lw t2,cpu_fpu_mask |
843 | #endif |
844 | andi t0,ST0_IM # CAUSE.CE may be non-zero! |
845 | @@ -139,7 +139,7 @@ |
846 | |
847 | beqz t0,spurious |
848 | |
849 | -#ifdef CONFIG_32BIT |
850 | +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) |
851 | and t2,t0 |
852 | bnez t2,fpu # handle FPU immediately |
853 | #endif |
854 | @@ -280,7 +280,7 @@ handle_it: |
855 | j dec_irq_dispatch |
856 | nop |
857 | |
858 | -#ifdef CONFIG_32BIT |
859 | +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) |
860 | fpu: |
861 | lw t0,fpu_kstat_irq |
862 | nop |
863 | diff --git a/arch/mips/dec/prom/Makefile b/arch/mips/dec/prom/Makefile |
864 | index d95016016b42b..2bad87551203b 100644 |
865 | --- a/arch/mips/dec/prom/Makefile |
866 | +++ b/arch/mips/dec/prom/Makefile |
867 | @@ -6,4 +6,4 @@ |
868 | |
869 | lib-y += init.o memory.o cmdline.o identify.o console.o |
870 | |
871 | -lib-$(CONFIG_32BIT) += locore.o |
872 | +lib-$(CONFIG_CPU_R3000) += locore.o |
873 | diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c |
874 | index 1fc8dffa8d1d0..649b50ae5b1e3 100644 |
875 | --- a/arch/mips/dec/setup.c |
876 | +++ b/arch/mips/dec/setup.c |
877 | @@ -766,7 +766,8 @@ void __init arch_init_irq(void) |
878 | dec_interrupt[DEC_IRQ_HALT] = -1; |
879 | |
880 | /* Register board interrupts: FPU and cascade. */ |
881 | - if (dec_interrupt[DEC_IRQ_FPU] >= 0 && cpu_has_fpu) { |
882 | + if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT) && |
883 | + dec_interrupt[DEC_IRQ_FPU] >= 0 && cpu_has_fpu) { |
884 | struct irq_desc *desc_fpu; |
885 | int irq_fpu; |
886 | |
887 | diff --git a/arch/mips/include/asm/dec/prom.h b/arch/mips/include/asm/dec/prom.h |
888 | index 62c7dfb90e06c..1e1247add1cf8 100644 |
889 | --- a/arch/mips/include/asm/dec/prom.h |
890 | +++ b/arch/mips/include/asm/dec/prom.h |
891 | @@ -43,16 +43,11 @@ |
892 | */ |
893 | #define REX_PROM_MAGIC 0x30464354 |
894 | |
895 | -#ifdef CONFIG_64BIT |
896 | - |
897 | -#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ |
898 | - |
899 | -#else /* !CONFIG_64BIT */ |
900 | - |
901 | -#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC) |
902 | - |
903 | -#endif /* !CONFIG_64BIT */ |
904 | - |
905 | +/* KN04 and KN05 are REX PROMs, so only do the check for R3k systems. */ |
906 | +static inline bool prom_is_rex(u32 magic) |
907 | +{ |
908 | + return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC; |
909 | +} |
910 | |
911 | /* |
912 | * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and |
913 | diff --git a/arch/mips/include/asm/setup.h b/arch/mips/include/asm/setup.h |
914 | index bb36a400203df..8c56b862fd9c2 100644 |
915 | --- a/arch/mips/include/asm/setup.h |
916 | +++ b/arch/mips/include/asm/setup.h |
917 | @@ -16,7 +16,7 @@ static inline void setup_8250_early_printk_port(unsigned long base, |
918 | unsigned int reg_shift, unsigned int timeout) {} |
919 | #endif |
920 | |
921 | -extern void set_handler(unsigned long offset, void *addr, unsigned long len); |
922 | +void set_handler(unsigned long offset, const void *addr, unsigned long len); |
923 | extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len); |
924 | |
925 | typedef void (*vi_handler_t)(void); |
926 | diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c |
927 | index 8282d0feb0b21..749089c25d5e6 100644 |
928 | --- a/arch/mips/kernel/traps.c |
929 | +++ b/arch/mips/kernel/traps.c |
930 | @@ -2020,19 +2020,19 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) |
931 | * If no shadow set is selected then use the default handler |
932 | * that does normal register saving and standard interrupt exit |
933 | */ |
934 | - extern char except_vec_vi, except_vec_vi_lui; |
935 | - extern char except_vec_vi_ori, except_vec_vi_end; |
936 | - extern char rollback_except_vec_vi; |
937 | - char *vec_start = using_rollback_handler() ? |
938 | - &rollback_except_vec_vi : &except_vec_vi; |
939 | + extern const u8 except_vec_vi[], except_vec_vi_lui[]; |
940 | + extern const u8 except_vec_vi_ori[], except_vec_vi_end[]; |
941 | + extern const u8 rollback_except_vec_vi[]; |
942 | + const u8 *vec_start = using_rollback_handler() ? |
943 | + rollback_except_vec_vi : except_vec_vi; |
944 | #if defined(CONFIG_CPU_MICROMIPS) || defined(CONFIG_CPU_BIG_ENDIAN) |
945 | - const int lui_offset = &except_vec_vi_lui - vec_start + 2; |
946 | - const int ori_offset = &except_vec_vi_ori - vec_start + 2; |
947 | + const int lui_offset = except_vec_vi_lui - vec_start + 2; |
948 | + const int ori_offset = except_vec_vi_ori - vec_start + 2; |
949 | #else |
950 | - const int lui_offset = &except_vec_vi_lui - vec_start; |
951 | - const int ori_offset = &except_vec_vi_ori - vec_start; |
952 | + const int lui_offset = except_vec_vi_lui - vec_start; |
953 | + const int ori_offset = except_vec_vi_ori - vec_start; |
954 | #endif |
955 | - const int handler_len = &except_vec_vi_end - vec_start; |
956 | + const int handler_len = except_vec_vi_end - vec_start; |
957 | |
958 | if (handler_len > VECTORSPACING) { |
959 | /* |
960 | @@ -2240,7 +2240,7 @@ void per_cpu_trap_init(bool is_boot_cpu) |
961 | } |
962 | |
963 | /* Install CPU exception handler */ |
964 | -void set_handler(unsigned long offset, void *addr, unsigned long size) |
965 | +void set_handler(unsigned long offset, const void *addr, unsigned long size) |
966 | { |
967 | #ifdef CONFIG_CPU_MICROMIPS |
968 | memcpy((void *)(ebase + offset), ((unsigned char *)addr - 1), size); |
969 | diff --git a/arch/mips/ralink/ill_acc.c b/arch/mips/ralink/ill_acc.c |
970 | index 0ddeb31afa93a..45ca2b84f0962 100644 |
971 | --- a/arch/mips/ralink/ill_acc.c |
972 | +++ b/arch/mips/ralink/ill_acc.c |
973 | @@ -61,6 +61,7 @@ static int __init ill_acc_of_setup(void) |
974 | pdev = of_find_device_by_node(np); |
975 | if (!pdev) { |
976 | pr_err("%pOFn: failed to lookup pdev\n", np); |
977 | + of_node_put(np); |
978 | return -EINVAL; |
979 | } |
980 | |
981 | diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c |
982 | index c9ecf17f86605..74808619fefeb 100644 |
983 | --- a/arch/mips/rb532/devices.c |
984 | +++ b/arch/mips/rb532/devices.c |
985 | @@ -310,11 +310,9 @@ static int __init plat_setup_devices(void) |
986 | static int __init setup_kmac(char *s) |
987 | { |
988 | printk(KERN_INFO "korina mac = %s\n", s); |
989 | - if (!mac_pton(s, korina_dev0_data.mac)) { |
990 | + if (!mac_pton(s, korina_dev0_data.mac)) |
991 | printk(KERN_ERR "Invalid mac\n"); |
992 | - return -EINVAL; |
993 | - } |
994 | - return 0; |
995 | + return 1; |
996 | } |
997 | |
998 | __setup("kmac=", setup_kmac); |
999 | diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h |
1000 | index e83f831a76f93..6be5e913c42e4 100644 |
1001 | --- a/arch/nios2/include/asm/uaccess.h |
1002 | +++ b/arch/nios2/include/asm/uaccess.h |
1003 | @@ -89,6 +89,7 @@ extern __must_check long strnlen_user(const char __user *s, long n); |
1004 | /* Optimized macros */ |
1005 | #define __get_user_asm(val, insn, addr, err) \ |
1006 | { \ |
1007 | + unsigned long __gu_val; \ |
1008 | __asm__ __volatile__( \ |
1009 | " movi %0, %3\n" \ |
1010 | "1: " insn " %1, 0(%2)\n" \ |
1011 | @@ -97,14 +98,20 @@ extern __must_check long strnlen_user(const char __user *s, long n); |
1012 | " .section __ex_table,\"a\"\n" \ |
1013 | " .word 1b, 2b\n" \ |
1014 | " .previous" \ |
1015 | - : "=&r" (err), "=r" (val) \ |
1016 | + : "=&r" (err), "=r" (__gu_val) \ |
1017 | : "r" (addr), "i" (-EFAULT)); \ |
1018 | + val = (__force __typeof__(*(addr)))__gu_val; \ |
1019 | } |
1020 | |
1021 | -#define __get_user_unknown(val, size, ptr, err) do { \ |
1022 | +extern void __get_user_unknown(void); |
1023 | + |
1024 | +#define __get_user_8(val, ptr, err) do { \ |
1025 | + u64 __val = 0; \ |
1026 | err = 0; \ |
1027 | - if (__copy_from_user(&(val), ptr, size)) { \ |
1028 | + if (raw_copy_from_user(&(__val), ptr, sizeof(val))) { \ |
1029 | err = -EFAULT; \ |
1030 | + } else { \ |
1031 | + val = (typeof(val))(typeof((val) - (val)))__val; \ |
1032 | } \ |
1033 | } while (0) |
1034 | |
1035 | @@ -120,8 +127,11 @@ do { \ |
1036 | case 4: \ |
1037 | __get_user_asm(val, "ldw", ptr, err); \ |
1038 | break; \ |
1039 | + case 8: \ |
1040 | + __get_user_8(val, ptr, err); \ |
1041 | + break; \ |
1042 | default: \ |
1043 | - __get_user_unknown(val, size, ptr, err); \ |
1044 | + __get_user_unknown(); \ |
1045 | break; \ |
1046 | } \ |
1047 | } while (0) |
1048 | @@ -130,9 +140,7 @@ do { \ |
1049 | ({ \ |
1050 | long __gu_err = -EFAULT; \ |
1051 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
1052 | - unsigned long __gu_val = 0; \ |
1053 | - __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ |
1054 | - (x) = (__force __typeof__(x))__gu_val; \ |
1055 | + __get_user_common(x, sizeof(*(ptr)), __gu_ptr, __gu_err); \ |
1056 | __gu_err; \ |
1057 | }) |
1058 | |
1059 | @@ -140,11 +148,9 @@ do { \ |
1060 | ({ \ |
1061 | long __gu_err = -EFAULT; \ |
1062 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
1063 | - unsigned long __gu_val = 0; \ |
1064 | if (access_ok( __gu_ptr, sizeof(*__gu_ptr))) \ |
1065 | - __get_user_common(__gu_val, sizeof(*__gu_ptr), \ |
1066 | + __get_user_common(x, sizeof(*__gu_ptr), \ |
1067 | __gu_ptr, __gu_err); \ |
1068 | - (x) = (__force __typeof__(x))__gu_val; \ |
1069 | __gu_err; \ |
1070 | }) |
1071 | |
1072 | diff --git a/arch/parisc/kernel/patch.c b/arch/parisc/kernel/patch.c |
1073 | index 80a0ab372802d..e59574f65e641 100644 |
1074 | --- a/arch/parisc/kernel/patch.c |
1075 | +++ b/arch/parisc/kernel/patch.c |
1076 | @@ -40,10 +40,7 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags, |
1077 | |
1078 | *need_unmap = 1; |
1079 | set_fixmap(fixmap, page_to_phys(page)); |
1080 | - if (flags) |
1081 | - raw_spin_lock_irqsave(&patch_lock, *flags); |
1082 | - else |
1083 | - __acquire(&patch_lock); |
1084 | + raw_spin_lock_irqsave(&patch_lock, *flags); |
1085 | |
1086 | return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK)); |
1087 | } |
1088 | @@ -52,10 +49,7 @@ static void __kprobes patch_unmap(int fixmap, unsigned long *flags) |
1089 | { |
1090 | clear_fixmap(fixmap); |
1091 | |
1092 | - if (flags) |
1093 | - raw_spin_unlock_irqrestore(&patch_lock, *flags); |
1094 | - else |
1095 | - __release(&patch_lock); |
1096 | + raw_spin_unlock_irqrestore(&patch_lock, *flags); |
1097 | } |
1098 | |
1099 | void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len) |
1100 | @@ -67,8 +61,9 @@ void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len) |
1101 | int mapped; |
1102 | |
1103 | /* Make sure we don't have any aliases in cache */ |
1104 | - flush_kernel_vmap_range(addr, len); |
1105 | - flush_icache_range(start, end); |
1106 | + flush_kernel_dcache_range_asm(start, end); |
1107 | + flush_kernel_icache_range_asm(start, end); |
1108 | + flush_tlb_kernel_range(start, end); |
1109 | |
1110 | p = fixmap = patch_map(addr, FIX_TEXT_POKE0, &flags, &mapped); |
1111 | |
1112 | @@ -81,8 +76,10 @@ void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len) |
1113 | * We're crossing a page boundary, so |
1114 | * need to remap |
1115 | */ |
1116 | - flush_kernel_vmap_range((void *)fixmap, |
1117 | - (p-fixmap) * sizeof(*p)); |
1118 | + flush_kernel_dcache_range_asm((unsigned long)fixmap, |
1119 | + (unsigned long)p); |
1120 | + flush_tlb_kernel_range((unsigned long)fixmap, |
1121 | + (unsigned long)p); |
1122 | if (mapped) |
1123 | patch_unmap(FIX_TEXT_POKE0, &flags); |
1124 | p = fixmap = patch_map(addr, FIX_TEXT_POKE0, &flags, |
1125 | @@ -90,10 +87,10 @@ void __kprobes __patch_text_multiple(void *addr, u32 *insn, unsigned int len) |
1126 | } |
1127 | } |
1128 | |
1129 | - flush_kernel_vmap_range((void *)fixmap, (p-fixmap) * sizeof(*p)); |
1130 | + flush_kernel_dcache_range_asm((unsigned long)fixmap, (unsigned long)p); |
1131 | + flush_tlb_kernel_range((unsigned long)fixmap, (unsigned long)p); |
1132 | if (mapped) |
1133 | patch_unmap(FIX_TEXT_POKE0, &flags); |
1134 | - flush_icache_range(start, end); |
1135 | } |
1136 | |
1137 | void __kprobes __patch_text(void *addr, u32 insn) |
1138 | diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile |
1139 | index 9f73fb6b1cc91..b9d2fcf030d0d 100644 |
1140 | --- a/arch/powerpc/Makefile |
1141 | +++ b/arch/powerpc/Makefile |
1142 | @@ -174,7 +174,7 @@ else |
1143 | CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) |
1144 | CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) |
1145 | endif |
1146 | -else |
1147 | +else ifdef CONFIG_PPC_BOOK3E_64 |
1148 | CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 |
1149 | endif |
1150 | |
1151 | diff --git a/arch/powerpc/boot/dts/fsl/t104xrdb.dtsi b/arch/powerpc/boot/dts/fsl/t104xrdb.dtsi |
1152 | index 099a598c74c00..bfe1ed5be3374 100644 |
1153 | --- a/arch/powerpc/boot/dts/fsl/t104xrdb.dtsi |
1154 | +++ b/arch/powerpc/boot/dts/fsl/t104xrdb.dtsi |
1155 | @@ -139,12 +139,12 @@ |
1156 | fman@400000 { |
1157 | ethernet@e6000 { |
1158 | phy-handle = <&phy_rgmii_0>; |
1159 | - phy-connection-type = "rgmii"; |
1160 | + phy-connection-type = "rgmii-id"; |
1161 | }; |
1162 | |
1163 | ethernet@e8000 { |
1164 | phy-handle = <&phy_rgmii_1>; |
1165 | - phy-connection-type = "rgmii"; |
1166 | + phy-connection-type = "rgmii-id"; |
1167 | }; |
1168 | |
1169 | mdio0: mdio@fc000 { |
1170 | diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h |
1171 | index a63ec938636de..daba2d2a02a0b 100644 |
1172 | --- a/arch/powerpc/include/asm/io.h |
1173 | +++ b/arch/powerpc/include/asm/io.h |
1174 | @@ -345,25 +345,37 @@ static inline void __raw_writeq_be(unsigned long v, volatile void __iomem *addr) |
1175 | */ |
1176 | static inline void __raw_rm_writeb(u8 val, volatile void __iomem *paddr) |
1177 | { |
1178 | - __asm__ __volatile__("stbcix %0,0,%1" |
1179 | + __asm__ __volatile__(".machine push; \ |
1180 | + .machine power6; \ |
1181 | + stbcix %0,0,%1; \ |
1182 | + .machine pop;" |
1183 | : : "r" (val), "r" (paddr) : "memory"); |
1184 | } |
1185 | |
1186 | static inline void __raw_rm_writew(u16 val, volatile void __iomem *paddr) |
1187 | { |
1188 | - __asm__ __volatile__("sthcix %0,0,%1" |
1189 | + __asm__ __volatile__(".machine push; \ |
1190 | + .machine power6; \ |
1191 | + sthcix %0,0,%1; \ |
1192 | + .machine pop;" |
1193 | : : "r" (val), "r" (paddr) : "memory"); |
1194 | } |
1195 | |
1196 | static inline void __raw_rm_writel(u32 val, volatile void __iomem *paddr) |
1197 | { |
1198 | - __asm__ __volatile__("stwcix %0,0,%1" |
1199 | + __asm__ __volatile__(".machine push; \ |
1200 | + .machine power6; \ |
1201 | + stwcix %0,0,%1; \ |
1202 | + .machine pop;" |
1203 | : : "r" (val), "r" (paddr) : "memory"); |
1204 | } |
1205 | |
1206 | static inline void __raw_rm_writeq(u64 val, volatile void __iomem *paddr) |
1207 | { |
1208 | - __asm__ __volatile__("stdcix %0,0,%1" |
1209 | + __asm__ __volatile__(".machine push; \ |
1210 | + .machine power6; \ |
1211 | + stdcix %0,0,%1; \ |
1212 | + .machine pop;" |
1213 | : : "r" (val), "r" (paddr) : "memory"); |
1214 | } |
1215 | |
1216 | @@ -375,7 +387,10 @@ static inline void __raw_rm_writeq_be(u64 val, volatile void __iomem *paddr) |
1217 | static inline u8 __raw_rm_readb(volatile void __iomem *paddr) |
1218 | { |
1219 | u8 ret; |
1220 | - __asm__ __volatile__("lbzcix %0,0, %1" |
1221 | + __asm__ __volatile__(".machine push; \ |
1222 | + .machine power6; \ |
1223 | + lbzcix %0,0, %1; \ |
1224 | + .machine pop;" |
1225 | : "=r" (ret) : "r" (paddr) : "memory"); |
1226 | return ret; |
1227 | } |
1228 | @@ -383,7 +398,10 @@ static inline u8 __raw_rm_readb(volatile void __iomem *paddr) |
1229 | static inline u16 __raw_rm_readw(volatile void __iomem *paddr) |
1230 | { |
1231 | u16 ret; |
1232 | - __asm__ __volatile__("lhzcix %0,0, %1" |
1233 | + __asm__ __volatile__(".machine push; \ |
1234 | + .machine power6; \ |
1235 | + lhzcix %0,0, %1; \ |
1236 | + .machine pop;" |
1237 | : "=r" (ret) : "r" (paddr) : "memory"); |
1238 | return ret; |
1239 | } |
1240 | @@ -391,7 +409,10 @@ static inline u16 __raw_rm_readw(volatile void __iomem *paddr) |
1241 | static inline u32 __raw_rm_readl(volatile void __iomem *paddr) |
1242 | { |
1243 | u32 ret; |
1244 | - __asm__ __volatile__("lwzcix %0,0, %1" |
1245 | + __asm__ __volatile__(".machine push; \ |
1246 | + .machine power6; \ |
1247 | + lwzcix %0,0, %1; \ |
1248 | + .machine pop;" |
1249 | : "=r" (ret) : "r" (paddr) : "memory"); |
1250 | return ret; |
1251 | } |
1252 | @@ -399,7 +420,10 @@ static inline u32 __raw_rm_readl(volatile void __iomem *paddr) |
1253 | static inline u64 __raw_rm_readq(volatile void __iomem *paddr) |
1254 | { |
1255 | u64 ret; |
1256 | - __asm__ __volatile__("ldcix %0,0, %1" |
1257 | + __asm__ __volatile__(".machine push; \ |
1258 | + .machine power6; \ |
1259 | + ldcix %0,0, %1; \ |
1260 | + .machine pop;" |
1261 | : "=r" (ret) : "r" (paddr) : "memory"); |
1262 | return ret; |
1263 | } |
1264 | diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h |
1265 | index cafad1960e766..a14a32f6c3ccd 100644 |
1266 | --- a/arch/powerpc/include/asm/uaccess.h |
1267 | +++ b/arch/powerpc/include/asm/uaccess.h |
1268 | @@ -191,8 +191,11 @@ extern long __get_user_bad(void); |
1269 | */ |
1270 | #define __get_user_atomic_128_aligned(kaddr, uaddr, err) \ |
1271 | __asm__ __volatile__( \ |
1272 | + ".machine push\n" \ |
1273 | + ".machine altivec\n" \ |
1274 | "1: lvx 0,0,%1 # get user\n" \ |
1275 | " stvx 0,0,%2 # put kernel\n" \ |
1276 | + ".machine pop\n" \ |
1277 | "2:\n" \ |
1278 | ".section .fixup,\"ax\"\n" \ |
1279 | "3: li %0,%3\n" \ |
1280 | diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c |
1281 | index 617eba82531cb..d89cf802d9aa7 100644 |
1282 | --- a/arch/powerpc/kernel/kvm.c |
1283 | +++ b/arch/powerpc/kernel/kvm.c |
1284 | @@ -669,7 +669,7 @@ static void __init kvm_use_magic_page(void) |
1285 | on_each_cpu(kvm_map_magic_page, &features, 1); |
1286 | |
1287 | /* Quick self-test to see if the mapping works */ |
1288 | - if (!fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) { |
1289 | + if (fault_in_pages_readable((const char *)KVM_MAGIC_PAGE, sizeof(u32))) { |
1290 | kvm_patching_worked = false; |
1291 | return; |
1292 | } |
1293 | diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c |
1294 | index 7a1c11a7cba5a..716f8bb17461c 100644 |
1295 | --- a/arch/powerpc/kernel/machine_kexec.c |
1296 | +++ b/arch/powerpc/kernel/machine_kexec.c |
1297 | @@ -146,11 +146,18 @@ void __init reserve_crashkernel(void) |
1298 | if (!crashk_res.start) { |
1299 | #ifdef CONFIG_PPC64 |
1300 | /* |
1301 | - * On 64bit we split the RMO in half but cap it at half of |
1302 | - * a small SLB (128MB) since the crash kernel needs to place |
1303 | - * itself and some stacks to be in the first segment. |
1304 | + * On the LPAR platform place the crash kernel to mid of |
1305 | + * RMA size (512MB or more) to ensure the crash kernel |
1306 | + * gets enough space to place itself and some stack to be |
1307 | + * in the first segment. At the same time normal kernel |
1308 | + * also get enough space to allocate memory for essential |
1309 | + * system resource in the first segment. Keep the crash |
1310 | + * kernel starts at 128MB offset on other platforms. |
1311 | */ |
1312 | - crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2)); |
1313 | + if (firmware_has_feature(FW_FEATURE_LPAR)) |
1314 | + crashk_res.start = ppc64_rma_size / 2; |
1315 | + else |
1316 | + crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2)); |
1317 | #else |
1318 | crashk_res.start = KDUMP_KERNELBASE; |
1319 | #endif |
1320 | diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
1321 | index c1e2e351ebff8..9392661ac8a87 100644 |
1322 | --- a/arch/powerpc/kernel/rtas.c |
1323 | +++ b/arch/powerpc/kernel/rtas.c |
1324 | @@ -1244,6 +1244,12 @@ int __init early_init_dt_scan_rtas(unsigned long node, |
1325 | entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL); |
1326 | sizep = of_get_flat_dt_prop(node, "rtas-size", NULL); |
1327 | |
1328 | +#ifdef CONFIG_PPC64 |
1329 | + /* need this feature to decide the crashkernel offset */ |
1330 | + if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL)) |
1331 | + powerpc_firmware_features |= FW_FEATURE_LPAR; |
1332 | +#endif |
1333 | + |
1334 | if (basep && entryp && sizep) { |
1335 | rtas.base = *basep; |
1336 | rtas.entry = *entryp; |
1337 | diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c |
1338 | index 8dd4d2b83677b..eb8c72846b7fc 100644 |
1339 | --- a/arch/powerpc/kvm/powerpc.c |
1340 | +++ b/arch/powerpc/kvm/powerpc.c |
1341 | @@ -1495,7 +1495,7 @@ int kvmppc_handle_vmx_load(struct kvm_run *run, struct kvm_vcpu *vcpu, |
1342 | { |
1343 | enum emulation_result emulated = EMULATE_DONE; |
1344 | |
1345 | - if (vcpu->arch.mmio_vsx_copy_nums > 2) |
1346 | + if (vcpu->arch.mmio_vmx_copy_nums > 2) |
1347 | return EMULATE_FAIL; |
1348 | |
1349 | while (vcpu->arch.mmio_vmx_copy_nums) { |
1350 | @@ -1592,7 +1592,7 @@ int kvmppc_handle_vmx_store(struct kvm_run *run, struct kvm_vcpu *vcpu, |
1351 | unsigned int index = rs & KVM_MMIO_REG_MASK; |
1352 | enum emulation_result emulated = EMULATE_DONE; |
1353 | |
1354 | - if (vcpu->arch.mmio_vsx_copy_nums > 2) |
1355 | + if (vcpu->arch.mmio_vmx_copy_nums > 2) |
1356 | return EMULATE_FAIL; |
1357 | |
1358 | vcpu->arch.io_gpr = rs; |
1359 | diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c |
1360 | index dc6728dacbc6b..27650cd5857f9 100644 |
1361 | --- a/arch/powerpc/lib/sstep.c |
1362 | +++ b/arch/powerpc/lib/sstep.c |
1363 | @@ -906,7 +906,10 @@ NOKPROBE_SYMBOL(emulate_dcbz); |
1364 | |
1365 | #define __put_user_asmx(x, addr, err, op, cr) \ |
1366 | __asm__ __volatile__( \ |
1367 | + ".machine push\n" \ |
1368 | + ".machine power8\n" \ |
1369 | "1: " op " %2,0,%3\n" \ |
1370 | + ".machine pop\n" \ |
1371 | " mfcr %1\n" \ |
1372 | "2:\n" \ |
1373 | ".section .fixup,\"ax\"\n" \ |
1374 | @@ -919,7 +922,10 @@ NOKPROBE_SYMBOL(emulate_dcbz); |
1375 | |
1376 | #define __get_user_asmx(x, addr, err, op) \ |
1377 | __asm__ __volatile__( \ |
1378 | + ".machine push\n" \ |
1379 | + ".machine power8\n" \ |
1380 | "1: "op" %1,0,%2\n" \ |
1381 | + ".machine pop\n" \ |
1382 | "2:\n" \ |
1383 | ".section .fixup,\"ax\"\n" \ |
1384 | "3: li %0,%3\n" \ |
1385 | @@ -2912,7 +2918,7 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op) |
1386 | __put_user_asmx(op->val, ea, err, "stbcx.", cr); |
1387 | break; |
1388 | case 2: |
1389 | - __put_user_asmx(op->val, ea, err, "stbcx.", cr); |
1390 | + __put_user_asmx(op->val, ea, err, "sthcx.", cr); |
1391 | break; |
1392 | #endif |
1393 | case 4: |
1394 | diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c |
1395 | index 1cfe57b51d7e3..3f78007a72822 100644 |
1396 | --- a/arch/powerpc/mm/kasan/kasan_init_32.c |
1397 | +++ b/arch/powerpc/mm/kasan/kasan_init_32.c |
1398 | @@ -121,7 +121,7 @@ static void __init kasan_remap_early_shadow_ro(void) |
1399 | pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(k_cur), k_cur), k_cur); |
1400 | pte_t *ptep = pte_offset_kernel(pmd, k_cur); |
1401 | |
1402 | - if ((pte_val(*ptep) & PTE_RPN_MASK) != pa) |
1403 | + if (pte_page(*ptep) != virt_to_page(lm_alias(kasan_early_shadow_page))) |
1404 | continue; |
1405 | |
1406 | __set_pte_at(&init_mm, k_cur, ptep, pfn_pte(PHYS_PFN(pa), prot), 0); |
1407 | diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c |
1408 | index eb82dda884e51..d76e800a1f337 100644 |
1409 | --- a/arch/powerpc/perf/imc-pmu.c |
1410 | +++ b/arch/powerpc/perf/imc-pmu.c |
1411 | @@ -1441,7 +1441,11 @@ static int trace_imc_event_init(struct perf_event *event) |
1412 | event->hw.idx = -1; |
1413 | target = event->hw.target; |
1414 | |
1415 | - event->pmu->task_ctx_nr = perf_hw_context; |
1416 | + /* |
1417 | + * There can only be a single PMU for perf_hw_context events which is assigned to |
1418 | + * core PMU. Hence use "perf_sw_context" for trace_imc. |
1419 | + */ |
1420 | + event->pmu->task_ctx_nr = perf_sw_context; |
1421 | event->destroy = reset_global_refc; |
1422 | return 0; |
1423 | } |
1424 | diff --git a/arch/powerpc/platforms/8xx/pic.c b/arch/powerpc/platforms/8xx/pic.c |
1425 | index e9617d35fd1f6..209b12323aa4c 100644 |
1426 | --- a/arch/powerpc/platforms/8xx/pic.c |
1427 | +++ b/arch/powerpc/platforms/8xx/pic.c |
1428 | @@ -153,6 +153,7 @@ int mpc8xx_pic_init(void) |
1429 | if (mpc8xx_pic_host == NULL) { |
1430 | printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n"); |
1431 | ret = -ENOMEM; |
1432 | + goto out; |
1433 | } |
1434 | |
1435 | ret = 0; |
1436 | diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c |
1437 | index 8035caf6e297d..1c31863a9be6c 100644 |
1438 | --- a/arch/powerpc/platforms/powernv/rng.c |
1439 | +++ b/arch/powerpc/platforms/powernv/rng.c |
1440 | @@ -43,7 +43,11 @@ static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) |
1441 | unsigned long parity; |
1442 | |
1443 | /* Calculate the parity of the value */ |
1444 | - asm ("popcntd %0,%1" : "=r" (parity) : "r" (val)); |
1445 | + asm (".machine push; \ |
1446 | + .machine power7; \ |
1447 | + popcntd %0,%1; \ |
1448 | + .machine pop;" |
1449 | + : "=r" (parity) : "r" (val)); |
1450 | |
1451 | /* xor our value with the previous mask */ |
1452 | val ^= rng->mask; |
1453 | diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c |
1454 | index 8963eaffb1b7b..39186ad6b3c3a 100644 |
1455 | --- a/arch/powerpc/sysdev/fsl_gtm.c |
1456 | +++ b/arch/powerpc/sysdev/fsl_gtm.c |
1457 | @@ -86,7 +86,7 @@ static LIST_HEAD(gtms); |
1458 | */ |
1459 | struct gtm_timer *gtm_get_timer16(void) |
1460 | { |
1461 | - struct gtm *gtm = NULL; |
1462 | + struct gtm *gtm; |
1463 | int i; |
1464 | |
1465 | list_for_each_entry(gtm, >ms, list_node) { |
1466 | @@ -103,7 +103,7 @@ struct gtm_timer *gtm_get_timer16(void) |
1467 | spin_unlock_irq(>m->lock); |
1468 | } |
1469 | |
1470 | - if (gtm) |
1471 | + if (!list_empty(>ms)) |
1472 | return ERR_PTR(-EBUSY); |
1473 | return ERR_PTR(-ENODEV); |
1474 | } |
1475 | diff --git a/arch/riscv/kernel/module.lds b/arch/riscv/kernel/module.lds |
1476 | index 295ecfb341a29..18ec719899e28 100644 |
1477 | --- a/arch/riscv/kernel/module.lds |
1478 | +++ b/arch/riscv/kernel/module.lds |
1479 | @@ -2,7 +2,7 @@ |
1480 | /* Copyright (C) 2017 Andes Technology Corporation */ |
1481 | |
1482 | SECTIONS { |
1483 | - .plt (NOLOAD) : { BYTE(0) } |
1484 | - .got (NOLOAD) : { BYTE(0) } |
1485 | - .got.plt (NOLOAD) : { BYTE(0) } |
1486 | + .plt : { BYTE(0) } |
1487 | + .got : { BYTE(0) } |
1488 | + .got.plt : { BYTE(0) } |
1489 | } |
1490 | diff --git a/arch/riscv/kernel/perf_callchain.c b/arch/riscv/kernel/perf_callchain.c |
1491 | index 22a93009362d7..1de5991916eb9 100644 |
1492 | --- a/arch/riscv/kernel/perf_callchain.c |
1493 | +++ b/arch/riscv/kernel/perf_callchain.c |
1494 | @@ -77,7 +77,7 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry, |
1495 | |
1496 | bool fill_callchain(unsigned long pc, void *entry) |
1497 | { |
1498 | - return perf_callchain_store(entry, pc); |
1499 | + return perf_callchain_store(entry, pc) == 0; |
1500 | } |
1501 | |
1502 | void notrace walk_stackframe(struct task_struct *task, |
1503 | diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c |
1504 | index 0117489e9b30a..750acc1344328 100644 |
1505 | --- a/arch/um/drivers/mconsole_kern.c |
1506 | +++ b/arch/um/drivers/mconsole_kern.c |
1507 | @@ -217,7 +217,7 @@ void mconsole_go(struct mc_request *req) |
1508 | |
1509 | void mconsole_stop(struct mc_request *req) |
1510 | { |
1511 | - deactivate_fd(req->originating_fd, MCONSOLE_IRQ); |
1512 | + block_signals(); |
1513 | os_set_fd_block(req->originating_fd, 1); |
1514 | mconsole_reply(req, "stopped", 0, 0); |
1515 | for (;;) { |
1516 | @@ -240,6 +240,7 @@ void mconsole_stop(struct mc_request *req) |
1517 | } |
1518 | os_set_fd_block(req->originating_fd, 0); |
1519 | mconsole_reply(req, "", 0, 0); |
1520 | + unblock_signals(); |
1521 | } |
1522 | |
1523 | static DEFINE_SPINLOCK(mc_devices_lock); |
1524 | diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c |
1525 | index da289a44d5116..f4d2322f4c629 100644 |
1526 | --- a/arch/x86/events/intel/pt.c |
1527 | +++ b/arch/x86/events/intel/pt.c |
1528 | @@ -460,7 +460,7 @@ static u64 pt_config_filters(struct perf_event *event) |
1529 | pt->filters.filter[range].msr_b = filter->msr_b; |
1530 | } |
1531 | |
1532 | - rtit_ctl |= filter->config << pt_address_ranges[range].reg_off; |
1533 | + rtit_ctl |= (u64)filter->config << pt_address_ranges[range].reg_off; |
1534 | } |
1535 | |
1536 | return rtit_ctl; |
1537 | diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c |
1538 | index 6ff2c7cac4c46..408b51aba2930 100644 |
1539 | --- a/arch/x86/kernel/kvm.c |
1540 | +++ b/arch/x86/kernel/kvm.c |
1541 | @@ -487,7 +487,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) |
1542 | } else if (apic_id < min && max - apic_id < KVM_IPI_CLUSTER_SIZE) { |
1543 | ipi_bitmap <<= min - apic_id; |
1544 | min = apic_id; |
1545 | - } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
1546 | + } else if (apic_id > min && apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
1547 | max = apic_id < max ? max : apic_id; |
1548 | } else { |
1549 | ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
1550 | diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
1551 | index 60c8dcb907a50..ea48a2fb1677d 100644 |
1552 | --- a/arch/x86/kvm/emulate.c |
1553 | +++ b/arch/x86/kvm/emulate.c |
1554 | @@ -1714,11 +1714,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, |
1555 | goto exception; |
1556 | } |
1557 | |
1558 | - if (!seg_desc.p) { |
1559 | - err_vec = (seg == VCPU_SREG_SS) ? SS_VECTOR : NP_VECTOR; |
1560 | - goto exception; |
1561 | - } |
1562 | - |
1563 | dpl = seg_desc.dpl; |
1564 | |
1565 | switch (seg) { |
1566 | @@ -1758,6 +1753,10 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, |
1567 | case VCPU_SREG_TR: |
1568 | if (seg_desc.s || (seg_desc.type != 1 && seg_desc.type != 9)) |
1569 | goto exception; |
1570 | + if (!seg_desc.p) { |
1571 | + err_vec = NP_VECTOR; |
1572 | + goto exception; |
1573 | + } |
1574 | old_desc = seg_desc; |
1575 | seg_desc.type |= 2; /* busy */ |
1576 | ret = ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_desc, |
1577 | @@ -1782,6 +1781,11 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, |
1578 | break; |
1579 | } |
1580 | |
1581 | + if (!seg_desc.p) { |
1582 | + err_vec = (seg == VCPU_SREG_SS) ? SS_VECTOR : NP_VECTOR; |
1583 | + goto exception; |
1584 | + } |
1585 | + |
1586 | if (seg_desc.s) { |
1587 | /* mark segment as accessed */ |
1588 | if (!(seg_desc.type & 1)) { |
1589 | diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c |
1590 | index be92e8dccda3d..ca66459a2e895 100644 |
1591 | --- a/arch/x86/kvm/hyperv.c |
1592 | +++ b/arch/x86/kvm/hyperv.c |
1593 | @@ -205,7 +205,7 @@ static int synic_set_msr(struct kvm_vcpu_hv_synic *synic, |
1594 | struct kvm_vcpu *vcpu = synic_to_vcpu(synic); |
1595 | int ret; |
1596 | |
1597 | - if (!synic->active && !host) |
1598 | + if (!synic->active && (!host || data)) |
1599 | return 1; |
1600 | |
1601 | trace_kvm_hv_synic_set_msr(vcpu->vcpu_id, msr, data, host); |
1602 | @@ -251,6 +251,9 @@ static int synic_set_msr(struct kvm_vcpu_hv_synic *synic, |
1603 | case HV_X64_MSR_EOM: { |
1604 | int i; |
1605 | |
1606 | + if (!synic->active) |
1607 | + break; |
1608 | + |
1609 | for (i = 0; i < ARRAY_SIZE(synic->sint); i++) |
1610 | kvm_hv_notify_acked_sint(vcpu, i); |
1611 | break; |
1612 | @@ -514,6 +517,11 @@ static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config, |
1613 | { |
1614 | union hv_stimer_config new_config = {.as_uint64 = config}, |
1615 | old_config = {.as_uint64 = stimer->config.as_uint64}; |
1616 | + struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer); |
1617 | + struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu); |
1618 | + |
1619 | + if (!synic->active && (!host || config)) |
1620 | + return 1; |
1621 | |
1622 | trace_kvm_hv_stimer_set_config(stimer_to_vcpu(stimer)->vcpu_id, |
1623 | stimer->index, config, host); |
1624 | @@ -533,6 +541,12 @@ static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config, |
1625 | static int stimer_set_count(struct kvm_vcpu_hv_stimer *stimer, u64 count, |
1626 | bool host) |
1627 | { |
1628 | + struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer); |
1629 | + struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu); |
1630 | + |
1631 | + if (!synic->active && (!host || count)) |
1632 | + return 1; |
1633 | + |
1634 | trace_kvm_hv_stimer_set_count(stimer_to_vcpu(stimer)->vcpu_id, |
1635 | stimer->index, count, host); |
1636 | |
1637 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
1638 | index eea2d6f10f59a..afe3b8e615146 100644 |
1639 | --- a/arch/x86/kvm/lapic.c |
1640 | +++ b/arch/x86/kvm/lapic.c |
1641 | @@ -2099,10 +2099,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) |
1642 | |
1643 | void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8) |
1644 | { |
1645 | - struct kvm_lapic *apic = vcpu->arch.apic; |
1646 | - |
1647 | - apic_set_tpr(apic, ((cr8 & 0x0f) << 4) |
1648 | - | (kvm_lapic_get_reg(apic, APIC_TASKPRI) & 4)); |
1649 | + apic_set_tpr(vcpu->arch.apic, (cr8 & 0x0f) << 4); |
1650 | } |
1651 | |
1652 | u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu) |
1653 | diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h |
1654 | index d4a8ad6c6a4bb..1a1d2b5e7b357 100644 |
1655 | --- a/arch/x86/kvm/paging_tmpl.h |
1656 | +++ b/arch/x86/kvm/paging_tmpl.h |
1657 | @@ -34,9 +34,8 @@ |
1658 | #define PT_HAVE_ACCESSED_DIRTY(mmu) true |
1659 | #ifdef CONFIG_X86_64 |
1660 | #define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL |
1661 | - #define CMPXCHG cmpxchg |
1662 | + #define CMPXCHG "cmpxchgq" |
1663 | #else |
1664 | - #define CMPXCHG cmpxchg64 |
1665 | #define PT_MAX_FULL_LEVELS 2 |
1666 | #endif |
1667 | #elif PTTYPE == 32 |
1668 | @@ -52,7 +51,7 @@ |
1669 | #define PT_GUEST_DIRTY_SHIFT PT_DIRTY_SHIFT |
1670 | #define PT_GUEST_ACCESSED_SHIFT PT_ACCESSED_SHIFT |
1671 | #define PT_HAVE_ACCESSED_DIRTY(mmu) true |
1672 | - #define CMPXCHG cmpxchg |
1673 | + #define CMPXCHG "cmpxchgl" |
1674 | #elif PTTYPE == PTTYPE_EPT |
1675 | #define pt_element_t u64 |
1676 | #define guest_walker guest_walkerEPT |
1677 | @@ -65,8 +64,10 @@ |
1678 | #define PT_GUEST_DIRTY_SHIFT 9 |
1679 | #define PT_GUEST_ACCESSED_SHIFT 8 |
1680 | #define PT_HAVE_ACCESSED_DIRTY(mmu) ((mmu)->ept_ad) |
1681 | - #define CMPXCHG cmpxchg64 |
1682 | #define PT_MAX_FULL_LEVELS 4 |
1683 | + #ifdef CONFIG_X86_64 |
1684 | + #define CMPXCHG "cmpxchgq" |
1685 | + #endif |
1686 | #else |
1687 | #error Invalid PTTYPE value |
1688 | #endif |
1689 | @@ -132,43 +133,39 @@ static int FNAME(cmpxchg_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, |
1690 | pt_element_t __user *ptep_user, unsigned index, |
1691 | pt_element_t orig_pte, pt_element_t new_pte) |
1692 | { |
1693 | - int npages; |
1694 | - pt_element_t ret; |
1695 | - pt_element_t *table; |
1696 | - struct page *page; |
1697 | - |
1698 | - npages = get_user_pages_fast((unsigned long)ptep_user, 1, FOLL_WRITE, &page); |
1699 | - if (likely(npages == 1)) { |
1700 | - table = kmap_atomic(page); |
1701 | - ret = CMPXCHG(&table[index], orig_pte, new_pte); |
1702 | - kunmap_atomic(table); |
1703 | - |
1704 | - kvm_release_page_dirty(page); |
1705 | - } else { |
1706 | - struct vm_area_struct *vma; |
1707 | - unsigned long vaddr = (unsigned long)ptep_user & PAGE_MASK; |
1708 | - unsigned long pfn; |
1709 | - unsigned long paddr; |
1710 | - |
1711 | - down_read(¤t->mm->mmap_sem); |
1712 | - vma = find_vma_intersection(current->mm, vaddr, vaddr + PAGE_SIZE); |
1713 | - if (!vma || !(vma->vm_flags & VM_PFNMAP)) { |
1714 | - up_read(¤t->mm->mmap_sem); |
1715 | - return -EFAULT; |
1716 | - } |
1717 | - pfn = ((vaddr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
1718 | - paddr = pfn << PAGE_SHIFT; |
1719 | - table = memremap(paddr, PAGE_SIZE, MEMREMAP_WB); |
1720 | - if (!table) { |
1721 | - up_read(¤t->mm->mmap_sem); |
1722 | - return -EFAULT; |
1723 | - } |
1724 | - ret = CMPXCHG(&table[index], orig_pte, new_pte); |
1725 | - memunmap(table); |
1726 | - up_read(¤t->mm->mmap_sem); |
1727 | - } |
1728 | + int r = -EFAULT; |
1729 | + |
1730 | + if (!user_access_begin(ptep_user, sizeof(pt_element_t))) |
1731 | + return -EFAULT; |
1732 | + |
1733 | +#ifdef CMPXCHG |
1734 | + asm volatile("1:" LOCK_PREFIX CMPXCHG " %[new], %[ptr]\n" |
1735 | + "mov $0, %[r]\n" |
1736 | + "setnz %b[r]\n" |
1737 | + "2:" |
1738 | + _ASM_EXTABLE_UA(1b, 2b) |
1739 | + : [ptr] "+m" (*ptep_user), |
1740 | + [old] "+a" (orig_pte), |
1741 | + [r] "+q" (r) |
1742 | + : [new] "r" (new_pte) |
1743 | + : "memory"); |
1744 | +#else |
1745 | + asm volatile("1:" LOCK_PREFIX "cmpxchg8b %[ptr]\n" |
1746 | + "movl $0, %[r]\n" |
1747 | + "jz 2f\n" |
1748 | + "incl %[r]\n" |
1749 | + "2:" |
1750 | + _ASM_EXTABLE_UA(1b, 2b) |
1751 | + : [ptr] "+m" (*ptep_user), |
1752 | + [old] "+A" (orig_pte), |
1753 | + [r] "+rm" (r) |
1754 | + : [new_lo] "b" ((u32)new_pte), |
1755 | + [new_hi] "c" ((u32)(new_pte >> 32)) |
1756 | + : "memory"); |
1757 | +#endif |
1758 | |
1759 | - return (ret != orig_pte); |
1760 | + user_access_end(); |
1761 | + return r; |
1762 | } |
1763 | |
1764 | static bool FNAME(prefetch_invalid_gpte)(struct kvm_vcpu *vcpu, |
1765 | diff --git a/arch/x86/kvm/pmu_amd.c b/arch/x86/kvm/pmu_amd.c |
1766 | index d9990951fd0ac..6bc656abbe66d 100644 |
1767 | --- a/arch/x86/kvm/pmu_amd.c |
1768 | +++ b/arch/x86/kvm/pmu_amd.c |
1769 | @@ -245,12 +245,10 @@ static int amd_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
1770 | /* MSR_EVNTSELn */ |
1771 | pmc = get_gp_pmc_amd(pmu, msr, PMU_TYPE_EVNTSEL); |
1772 | if (pmc) { |
1773 | - if (data == pmc->eventsel) |
1774 | - return 0; |
1775 | - if (!(data & pmu->reserved_bits)) { |
1776 | + data &= ~pmu->reserved_bits; |
1777 | + if (data != pmc->eventsel) |
1778 | reprogram_gp_counter(pmc, data); |
1779 | - return 0; |
1780 | - } |
1781 | + return 0; |
1782 | } |
1783 | |
1784 | return 1; |
1785 | diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c |
1786 | index 915bb16397632..1bff0f68f0273 100644 |
1787 | --- a/arch/x86/power/cpu.c |
1788 | +++ b/arch/x86/power/cpu.c |
1789 | @@ -40,7 +40,8 @@ static void msr_save_context(struct saved_context *ctxt) |
1790 | struct saved_msr *end = msr + ctxt->saved_msrs.num; |
1791 | |
1792 | while (msr < end) { |
1793 | - msr->valid = !rdmsrl_safe(msr->info.msr_no, &msr->info.reg.q); |
1794 | + if (msr->valid) |
1795 | + rdmsrl(msr->info.msr_no, msr->info.reg.q); |
1796 | msr++; |
1797 | } |
1798 | } |
1799 | @@ -421,8 +422,10 @@ static int msr_build_context(const u32 *msr_id, const int num) |
1800 | } |
1801 | |
1802 | for (i = saved_msrs->num, j = 0; i < total_num; i++, j++) { |
1803 | + u64 dummy; |
1804 | + |
1805 | msr_array[i].info.msr_no = msr_id[j]; |
1806 | - msr_array[i].valid = false; |
1807 | + msr_array[i].valid = !rdmsrl_safe(msr_id[j], &dummy); |
1808 | msr_array[i].info.reg.q = 0; |
1809 | } |
1810 | saved_msrs->num = total_num; |
1811 | @@ -509,10 +512,24 @@ static int pm_cpu_check(const struct x86_cpu_id *c) |
1812 | return ret; |
1813 | } |
1814 | |
1815 | +static void pm_save_spec_msr(void) |
1816 | +{ |
1817 | + u32 spec_msr_id[] = { |
1818 | + MSR_IA32_SPEC_CTRL, |
1819 | + MSR_IA32_TSX_CTRL, |
1820 | + MSR_TSX_FORCE_ABORT, |
1821 | + MSR_IA32_MCU_OPT_CTRL, |
1822 | + MSR_AMD64_LS_CFG, |
1823 | + }; |
1824 | + |
1825 | + msr_build_context(spec_msr_id, ARRAY_SIZE(spec_msr_id)); |
1826 | +} |
1827 | + |
1828 | static int pm_check_save_msr(void) |
1829 | { |
1830 | dmi_check_system(msr_save_dmi_table); |
1831 | pm_cpu_check(msr_save_cpu_table); |
1832 | + pm_save_spec_msr(); |
1833 | |
1834 | return 0; |
1835 | } |
1836 | diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c |
1837 | index e13b0b49fcdfc..d7249f4c90f1b 100644 |
1838 | --- a/arch/x86/xen/pmu.c |
1839 | +++ b/arch/x86/xen/pmu.c |
1840 | @@ -512,10 +512,7 @@ irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id) |
1841 | return ret; |
1842 | } |
1843 | |
1844 | -bool is_xen_pmu(int cpu) |
1845 | -{ |
1846 | - return (get_xenpmu_data() != NULL); |
1847 | -} |
1848 | +bool is_xen_pmu; |
1849 | |
1850 | void xen_pmu_init(int cpu) |
1851 | { |
1852 | @@ -526,7 +523,7 @@ void xen_pmu_init(int cpu) |
1853 | |
1854 | BUILD_BUG_ON(sizeof(struct xen_pmu_data) > PAGE_SIZE); |
1855 | |
1856 | - if (xen_hvm_domain()) |
1857 | + if (xen_hvm_domain() || (cpu != 0 && !is_xen_pmu)) |
1858 | return; |
1859 | |
1860 | xenpmu_data = (struct xen_pmu_data *)get_zeroed_page(GFP_KERNEL); |
1861 | @@ -547,7 +544,8 @@ void xen_pmu_init(int cpu) |
1862 | per_cpu(xenpmu_shared, cpu).xenpmu_data = xenpmu_data; |
1863 | per_cpu(xenpmu_shared, cpu).flags = 0; |
1864 | |
1865 | - if (cpu == 0) { |
1866 | + if (!is_xen_pmu) { |
1867 | + is_xen_pmu = true; |
1868 | perf_register_guest_info_callbacks(&xen_guest_cbs); |
1869 | xen_pmu_arch_init(); |
1870 | } |
1871 | diff --git a/arch/x86/xen/pmu.h b/arch/x86/xen/pmu.h |
1872 | index 0e83a160589bc..65c58894fc79f 100644 |
1873 | --- a/arch/x86/xen/pmu.h |
1874 | +++ b/arch/x86/xen/pmu.h |
1875 | @@ -4,6 +4,8 @@ |
1876 | |
1877 | #include <xen/interface/xenpmu.h> |
1878 | |
1879 | +extern bool is_xen_pmu; |
1880 | + |
1881 | irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id); |
1882 | #ifdef CONFIG_XEN_HAVE_VPMU |
1883 | void xen_pmu_init(int cpu); |
1884 | @@ -12,7 +14,6 @@ void xen_pmu_finish(int cpu); |
1885 | static inline void xen_pmu_init(int cpu) {} |
1886 | static inline void xen_pmu_finish(int cpu) {} |
1887 | #endif |
1888 | -bool is_xen_pmu(int cpu); |
1889 | bool pmu_msr_read(unsigned int msr, uint64_t *val, int *err); |
1890 | bool pmu_msr_write(unsigned int msr, uint32_t low, uint32_t high, int *err); |
1891 | int pmu_apic_update(uint32_t reg); |
1892 | diff --git a/arch/x86/xen/smp_hvm.c b/arch/x86/xen/smp_hvm.c |
1893 | index f8d39440b2923..e5bd9eb421915 100644 |
1894 | --- a/arch/x86/xen/smp_hvm.c |
1895 | +++ b/arch/x86/xen/smp_hvm.c |
1896 | @@ -18,6 +18,12 @@ static void __init xen_hvm_smp_prepare_boot_cpu(void) |
1897 | */ |
1898 | xen_vcpu_setup(0); |
1899 | |
1900 | + /* |
1901 | + * Called again in case the kernel boots on vcpu >= MAX_VIRT_CPUS. |
1902 | + * Refer to comments in xen_hvm_init_time_ops(). |
1903 | + */ |
1904 | + xen_hvm_init_time_ops(); |
1905 | + |
1906 | /* |
1907 | * The alternative logic (which patches the unlock/lock) runs before |
1908 | * the smp bootup up code is activated. Hence we need to set this up |
1909 | diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c |
1910 | index 0cebe5db691d9..64e6ec2c32a76 100644 |
1911 | --- a/arch/x86/xen/smp_pv.c |
1912 | +++ b/arch/x86/xen/smp_pv.c |
1913 | @@ -129,7 +129,7 @@ int xen_smp_intr_init_pv(unsigned int cpu) |
1914 | per_cpu(xen_irq_work, cpu).irq = rc; |
1915 | per_cpu(xen_irq_work, cpu).name = callfunc_name; |
1916 | |
1917 | - if (is_xen_pmu(cpu)) { |
1918 | + if (is_xen_pmu) { |
1919 | pmu_name = kasprintf(GFP_KERNEL, "pmu%d", cpu); |
1920 | rc = bind_virq_to_irqhandler(VIRQ_XENPMU, cpu, |
1921 | xen_pmu_irq_handler, |
1922 | diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c |
1923 | index befbdd8b17f01..4ec6c80f76872 100644 |
1924 | --- a/arch/x86/xen/time.c |
1925 | +++ b/arch/x86/xen/time.c |
1926 | @@ -547,6 +547,11 @@ static void xen_hvm_setup_cpu_clockevents(void) |
1927 | |
1928 | void __init xen_hvm_init_time_ops(void) |
1929 | { |
1930 | + static bool hvm_time_initialized; |
1931 | + |
1932 | + if (hvm_time_initialized) |
1933 | + return; |
1934 | + |
1935 | /* |
1936 | * vector callback is needed otherwise we cannot receive interrupts |
1937 | * on cpu > 0 and at this point we don't know how many cpus are |
1938 | @@ -556,7 +561,22 @@ void __init xen_hvm_init_time_ops(void) |
1939 | return; |
1940 | |
1941 | if (!xen_feature(XENFEAT_hvm_safe_pvclock)) { |
1942 | - pr_info("Xen doesn't support pvclock on HVM, disable pv timer"); |
1943 | + pr_info_once("Xen doesn't support pvclock on HVM, disable pv timer"); |
1944 | + return; |
1945 | + } |
1946 | + |
1947 | + /* |
1948 | + * Only MAX_VIRT_CPUS 'vcpu_info' are embedded inside 'shared_info'. |
1949 | + * The __this_cpu_read(xen_vcpu) is still NULL when Xen HVM guest |
1950 | + * boots on vcpu >= MAX_VIRT_CPUS (e.g., kexec), To access |
1951 | + * __this_cpu_read(xen_vcpu) via xen_clocksource_read() will panic. |
1952 | + * |
1953 | + * The xen_hvm_init_time_ops() should be called again later after |
1954 | + * __this_cpu_read(xen_vcpu) is available. |
1955 | + */ |
1956 | + if (!__this_cpu_read(xen_vcpu)) { |
1957 | + pr_info("Delay xen_init_time_common() as kernel is running on vcpu=%d\n", |
1958 | + xen_vcpu_nr(0)); |
1959 | return; |
1960 | } |
1961 | |
1962 | @@ -568,6 +588,8 @@ void __init xen_hvm_init_time_ops(void) |
1963 | x86_platform.calibrate_tsc = xen_tsc_khz; |
1964 | x86_platform.get_wallclock = xen_get_wallclock; |
1965 | x86_platform.set_wallclock = xen_set_wallclock; |
1966 | + |
1967 | + hvm_time_initialized = true; |
1968 | } |
1969 | #endif |
1970 | |
1971 | diff --git a/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi b/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi |
1972 | index 9bf8bad1dd18a..c33932568aa73 100644 |
1973 | --- a/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi |
1974 | +++ b/arch/xtensa/boot/dts/xtfpga-flash-128m.dtsi |
1975 | @@ -8,19 +8,19 @@ |
1976 | reg = <0x00000000 0x08000000>; |
1977 | bank-width = <2>; |
1978 | device-width = <2>; |
1979 | - partition@0x0 { |
1980 | + partition@0 { |
1981 | label = "data"; |
1982 | reg = <0x00000000 0x06000000>; |
1983 | }; |
1984 | - partition@0x6000000 { |
1985 | + partition@6000000 { |
1986 | label = "boot loader area"; |
1987 | reg = <0x06000000 0x00800000>; |
1988 | }; |
1989 | - partition@0x6800000 { |
1990 | + partition@6800000 { |
1991 | label = "kernel image"; |
1992 | reg = <0x06800000 0x017e0000>; |
1993 | }; |
1994 | - partition@0x7fe0000 { |
1995 | + partition@7fe0000 { |
1996 | label = "boot environment"; |
1997 | reg = <0x07fe0000 0x00020000>; |
1998 | }; |
1999 | diff --git a/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi b/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi |
2000 | index 40c2f81f7cb66..7bde2ab2d6fb5 100644 |
2001 | --- a/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi |
2002 | +++ b/arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi |
2003 | @@ -8,19 +8,19 @@ |
2004 | reg = <0x08000000 0x01000000>; |
2005 | bank-width = <2>; |
2006 | device-width = <2>; |
2007 | - partition@0x0 { |
2008 | + partition@0 { |
2009 | label = "boot loader area"; |
2010 | reg = <0x00000000 0x00400000>; |
2011 | }; |
2012 | - partition@0x400000 { |
2013 | + partition@400000 { |
2014 | label = "kernel image"; |
2015 | reg = <0x00400000 0x00600000>; |
2016 | }; |
2017 | - partition@0xa00000 { |
2018 | + partition@a00000 { |
2019 | label = "data"; |
2020 | reg = <0x00a00000 0x005e0000>; |
2021 | }; |
2022 | - partition@0xfe0000 { |
2023 | + partition@fe0000 { |
2024 | label = "boot environment"; |
2025 | reg = <0x00fe0000 0x00020000>; |
2026 | }; |
2027 | diff --git a/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi b/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi |
2028 | index fb8d3a9f33c23..0655b868749a4 100644 |
2029 | --- a/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi |
2030 | +++ b/arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi |
2031 | @@ -8,11 +8,11 @@ |
2032 | reg = <0x08000000 0x00400000>; |
2033 | bank-width = <2>; |
2034 | device-width = <2>; |
2035 | - partition@0x0 { |
2036 | + partition@0 { |
2037 | label = "boot loader area"; |
2038 | reg = <0x00000000 0x003f0000>; |
2039 | }; |
2040 | - partition@0x3f0000 { |
2041 | + partition@3f0000 { |
2042 | label = "boot environment"; |
2043 | reg = <0x003f0000 0x00010000>; |
2044 | }; |
2045 | diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h |
2046 | index 7495520d7a3e9..fd1161de45356 100644 |
2047 | --- a/arch/xtensa/include/asm/processor.h |
2048 | +++ b/arch/xtensa/include/asm/processor.h |
2049 | @@ -225,8 +225,8 @@ extern unsigned long get_wchan(struct task_struct *p); |
2050 | |
2051 | #define xtensa_set_sr(x, sr) \ |
2052 | ({ \ |
2053 | - unsigned int v = (unsigned int)(x); \ |
2054 | - __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: "a"(v)); \ |
2055 | + __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: \ |
2056 | + "a"((unsigned int)(x))); \ |
2057 | }) |
2058 | |
2059 | #define xtensa_get_sr(sr) \ |
2060 | diff --git a/arch/xtensa/kernel/jump_label.c b/arch/xtensa/kernel/jump_label.c |
2061 | index 61cf6497a646b..0dde21e0d3de4 100644 |
2062 | --- a/arch/xtensa/kernel/jump_label.c |
2063 | +++ b/arch/xtensa/kernel/jump_label.c |
2064 | @@ -61,7 +61,7 @@ static void patch_text(unsigned long addr, const void *data, size_t sz) |
2065 | .data = data, |
2066 | }; |
2067 | stop_machine_cpuslocked(patch_text_stop_machine, |
2068 | - &patch, NULL); |
2069 | + &patch, cpu_online_mask); |
2070 | } else { |
2071 | unsigned long flags; |
2072 | |
2073 | diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c |
2074 | index 342a1cfa48c57..c17eb794f0aef 100644 |
2075 | --- a/block/bfq-cgroup.c |
2076 | +++ b/block/bfq-cgroup.c |
2077 | @@ -625,6 +625,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
2078 | { |
2079 | struct bfq_entity *entity = &bfqq->entity; |
2080 | |
2081 | + /* |
2082 | + * oom_bfqq is not allowed to move, oom_bfqq will hold ref to root_group |
2083 | + * until elevator exit. |
2084 | + */ |
2085 | + if (bfqq == &bfqd->oom_bfqq) |
2086 | + return; |
2087 | /* |
2088 | * Get extra reference to prevent bfqq from being freed in |
2089 | * next possible expire or deactivate. |
2090 | diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
2091 | index 1a0c581512f28..1d443d17cf7c5 100644 |
2092 | --- a/block/bfq-iosched.c |
2093 | +++ b/block/bfq-iosched.c |
2094 | @@ -2523,6 +2523,15 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) |
2095 | * are likely to increase the throughput. |
2096 | */ |
2097 | bfqq->new_bfqq = new_bfqq; |
2098 | + /* |
2099 | + * The above assignment schedules the following redirections: |
2100 | + * each time some I/O for bfqq arrives, the process that |
2101 | + * generated that I/O is disassociated from bfqq and |
2102 | + * associated with new_bfqq. Here we increases new_bfqq->ref |
2103 | + * in advance, adding the number of processes that are |
2104 | + * expected to be associated with new_bfqq as they happen to |
2105 | + * issue I/O. |
2106 | + */ |
2107 | new_bfqq->ref += process_refs; |
2108 | return new_bfqq; |
2109 | } |
2110 | @@ -2582,6 +2591,10 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
2111 | { |
2112 | struct bfq_queue *in_service_bfqq, *new_bfqq; |
2113 | |
2114 | + /* if a merge has already been setup, then proceed with that first */ |
2115 | + if (bfqq->new_bfqq) |
2116 | + return bfqq->new_bfqq; |
2117 | + |
2118 | /* |
2119 | * Do not perform queue merging if the device is non |
2120 | * rotational and performs internal queueing. In fact, such a |
2121 | @@ -2636,9 +2649,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
2122 | if (bfq_too_late_for_merging(bfqq)) |
2123 | return NULL; |
2124 | |
2125 | - if (bfqq->new_bfqq) |
2126 | - return bfqq->new_bfqq; |
2127 | - |
2128 | if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) |
2129 | return NULL; |
2130 | |
2131 | @@ -4793,7 +4803,7 @@ static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx) |
2132 | struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; |
2133 | struct request *rq; |
2134 | struct bfq_queue *in_serv_queue; |
2135 | - bool waiting_rq, idle_timer_disabled; |
2136 | + bool waiting_rq, idle_timer_disabled = false; |
2137 | |
2138 | spin_lock_irq(&bfqd->lock); |
2139 | |
2140 | @@ -4801,14 +4811,15 @@ static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx) |
2141 | waiting_rq = in_serv_queue && bfq_bfqq_wait_request(in_serv_queue); |
2142 | |
2143 | rq = __bfq_dispatch_request(hctx); |
2144 | - |
2145 | - idle_timer_disabled = |
2146 | - waiting_rq && !bfq_bfqq_wait_request(in_serv_queue); |
2147 | + if (in_serv_queue == bfqd->in_service_queue) { |
2148 | + idle_timer_disabled = |
2149 | + waiting_rq && !bfq_bfqq_wait_request(in_serv_queue); |
2150 | + } |
2151 | |
2152 | spin_unlock_irq(&bfqd->lock); |
2153 | - |
2154 | - bfq_update_dispatch_stats(hctx->queue, rq, in_serv_queue, |
2155 | - idle_timer_disabled); |
2156 | + bfq_update_dispatch_stats(hctx->queue, rq, |
2157 | + idle_timer_disabled ? in_serv_queue : NULL, |
2158 | + idle_timer_disabled); |
2159 | |
2160 | return rq; |
2161 | } |
2162 | diff --git a/block/blk-merge.c b/block/blk-merge.c |
2163 | index 4b022f0c49d20..a62692d135660 100644 |
2164 | --- a/block/blk-merge.c |
2165 | +++ b/block/blk-merge.c |
2166 | @@ -7,6 +7,7 @@ |
2167 | #include <linux/bio.h> |
2168 | #include <linux/blkdev.h> |
2169 | #include <linux/scatterlist.h> |
2170 | +#include <linux/blk-cgroup.h> |
2171 | |
2172 | #include <trace/events/block.h> |
2173 | |
2174 | @@ -571,6 +572,9 @@ static inline unsigned int blk_rq_get_max_segments(struct request *rq) |
2175 | static inline int ll_new_hw_segment(struct request *req, struct bio *bio, |
2176 | unsigned int nr_phys_segs) |
2177 | { |
2178 | + if (!blk_cgroup_mergeable(req, bio)) |
2179 | + goto no_merge; |
2180 | + |
2181 | if (blk_integrity_merge_bio(req->q, req, bio) == false) |
2182 | goto no_merge; |
2183 | |
2184 | @@ -662,6 +666,9 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, |
2185 | if (total_phys_segments > blk_rq_get_max_segments(req)) |
2186 | return 0; |
2187 | |
2188 | + if (!blk_cgroup_mergeable(req, next->bio)) |
2189 | + return 0; |
2190 | + |
2191 | if (blk_integrity_merge_rq(q, req, next) == false) |
2192 | return 0; |
2193 | |
2194 | @@ -885,6 +892,10 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) |
2195 | if (rq->rq_disk != bio->bi_disk) |
2196 | return false; |
2197 | |
2198 | + /* don't merge across cgroup boundaries */ |
2199 | + if (!blk_cgroup_mergeable(rq, bio)) |
2200 | + return false; |
2201 | + |
2202 | /* only merge integrity protected bio into ditto rq */ |
2203 | if (blk_integrity_merge_bio(rq->q, rq, bio) == false) |
2204 | return false; |
2205 | diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c |
2206 | index bf33570da5ac7..3fb37135264b2 100644 |
2207 | --- a/block/blk-sysfs.c |
2208 | +++ b/block/blk-sysfs.c |
2209 | @@ -1060,15 +1060,17 @@ void blk_unregister_queue(struct gendisk *disk) |
2210 | */ |
2211 | if (queue_is_mq(q)) |
2212 | blk_mq_unregister_dev(disk_to_dev(disk), q); |
2213 | - |
2214 | - kobject_uevent(&q->kobj, KOBJ_REMOVE); |
2215 | - kobject_del(&q->kobj); |
2216 | blk_trace_remove_sysfs(disk_to_dev(disk)); |
2217 | |
2218 | mutex_lock(&q->sysfs_lock); |
2219 | if (q->elevator) |
2220 | elv_unregister_queue(q); |
2221 | mutex_unlock(&q->sysfs_lock); |
2222 | + |
2223 | + /* Now that we've deleted all child objects, we can delete the queue. */ |
2224 | + kobject_uevent(&q->kobj, KOBJ_REMOVE); |
2225 | + kobject_del(&q->kobj); |
2226 | + |
2227 | mutex_unlock(&q->sysfs_dir_lock); |
2228 | |
2229 | kobject_put(&disk_to_dev(disk)->kobj); |
2230 | diff --git a/crypto/authenc.c b/crypto/authenc.c |
2231 | index 3f0ed94025820..321da90389957 100644 |
2232 | --- a/crypto/authenc.c |
2233 | +++ b/crypto/authenc.c |
2234 | @@ -263,7 +263,7 @@ static int crypto_authenc_decrypt_tail(struct aead_request *req, |
2235 | dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen); |
2236 | |
2237 | skcipher_request_set_tfm(skreq, ctx->enc); |
2238 | - skcipher_request_set_callback(skreq, aead_request_flags(req), |
2239 | + skcipher_request_set_callback(skreq, flags, |
2240 | req->base.complete, req->base.data); |
2241 | skcipher_request_set_crypt(skreq, src, dst, |
2242 | req->cryptlen - authsize, req->iv); |
2243 | diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c |
2244 | index 0aa489711ec49..9cbafaf6dd851 100644 |
2245 | --- a/crypto/rsa-pkcs1pad.c |
2246 | +++ b/crypto/rsa-pkcs1pad.c |
2247 | @@ -475,6 +475,8 @@ static int pkcs1pad_verify_complete(struct akcipher_request *req, int err) |
2248 | pos++; |
2249 | |
2250 | if (digest_info) { |
2251 | + if (digest_info->size > dst_len - pos) |
2252 | + goto done; |
2253 | if (crypto_memneq(out_buf + pos, digest_info->data, |
2254 | digest_info->size)) |
2255 | goto done; |
2256 | @@ -494,7 +496,7 @@ static int pkcs1pad_verify_complete(struct akcipher_request *req, int err) |
2257 | sg_nents_for_len(req->src, |
2258 | req->src_len + req->dst_len), |
2259 | req_ctx->out_buf + ctx->key_size, |
2260 | - req->dst_len, ctx->key_size); |
2261 | + req->dst_len, req->src_len); |
2262 | /* Do the actual verification step. */ |
2263 | if (memcmp(req_ctx->out_buf + ctx->key_size, out_buf + pos, |
2264 | req->dst_len) != 0) |
2265 | @@ -537,7 +539,7 @@ static int pkcs1pad_verify(struct akcipher_request *req) |
2266 | |
2267 | if (WARN_ON(req->dst) || |
2268 | WARN_ON(!req->dst_len) || |
2269 | - !ctx->key_size || req->src_len < ctx->key_size) |
2270 | + !ctx->key_size || req->src_len != ctx->key_size) |
2271 | return -EINVAL; |
2272 | |
2273 | req_ctx->out_buf = kmalloc(ctx->key_size + req->dst_len, GFP_KERNEL); |
2274 | diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c |
2275 | index ceea6af79d121..bf4eb642f4232 100644 |
2276 | --- a/drivers/acpi/acpica/nswalk.c |
2277 | +++ b/drivers/acpi/acpica/nswalk.c |
2278 | @@ -169,6 +169,9 @@ acpi_ns_walk_namespace(acpi_object_type type, |
2279 | |
2280 | if (start_node == ACPI_ROOT_OBJECT) { |
2281 | start_node = acpi_gbl_root_node; |
2282 | + if (!start_node) { |
2283 | + return_ACPI_STATUS(AE_NO_NAMESPACE); |
2284 | + } |
2285 | } |
2286 | |
2287 | /* Null child means "get first node" */ |
2288 | diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c |
2289 | index 1155fb9dcc3ad..76b7539a37a93 100644 |
2290 | --- a/drivers/acpi/apei/bert.c |
2291 | +++ b/drivers/acpi/apei/bert.c |
2292 | @@ -29,6 +29,7 @@ |
2293 | |
2294 | #undef pr_fmt |
2295 | #define pr_fmt(fmt) "BERT: " fmt |
2296 | +#define ACPI_BERT_PRINT_MAX_LEN 1024 |
2297 | |
2298 | static int bert_disable; |
2299 | |
2300 | @@ -58,8 +59,11 @@ static void __init bert_print_all(struct acpi_bert_region *region, |
2301 | } |
2302 | |
2303 | pr_info_once("Error records from previous boot:\n"); |
2304 | - |
2305 | - cper_estatus_print(KERN_INFO HW_ERR, estatus); |
2306 | + if (region_len < ACPI_BERT_PRINT_MAX_LEN) |
2307 | + cper_estatus_print(KERN_INFO HW_ERR, estatus); |
2308 | + else |
2309 | + pr_info_once("Max print length exceeded, table data is available at:\n" |
2310 | + "/sys/firmware/acpi/tables/data/BERT"); |
2311 | |
2312 | /* |
2313 | * Because the boot error source is "one-time polled" type, |
2314 | @@ -77,7 +81,7 @@ static int __init setup_bert_disable(char *str) |
2315 | { |
2316 | bert_disable = 1; |
2317 | |
2318 | - return 0; |
2319 | + return 1; |
2320 | } |
2321 | __setup("bert_disable", setup_bert_disable); |
2322 | |
2323 | diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c |
2324 | index 2015a0967cbbf..5ee3cb7fcd906 100644 |
2325 | --- a/drivers/acpi/apei/erst.c |
2326 | +++ b/drivers/acpi/apei/erst.c |
2327 | @@ -891,7 +891,7 @@ EXPORT_SYMBOL_GPL(erst_clear); |
2328 | static int __init setup_erst_disable(char *str) |
2329 | { |
2330 | erst_disable = 1; |
2331 | - return 0; |
2332 | + return 1; |
2333 | } |
2334 | |
2335 | __setup("erst_disable", setup_erst_disable); |
2336 | diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c |
2337 | index 267bdbf6a7bf0..add6416e78f23 100644 |
2338 | --- a/drivers/acpi/apei/hest.c |
2339 | +++ b/drivers/acpi/apei/hest.c |
2340 | @@ -219,7 +219,7 @@ err: |
2341 | static int __init setup_hest_disable(char *str) |
2342 | { |
2343 | hest_disable = HEST_DISABLED; |
2344 | - return 0; |
2345 | + return 1; |
2346 | } |
2347 | |
2348 | __setup("hest_disable", setup_hest_disable); |
2349 | diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c |
2350 | index 2826bd45c61a1..0521b1d4c2fd0 100644 |
2351 | --- a/drivers/acpi/cppc_acpi.c |
2352 | +++ b/drivers/acpi/cppc_acpi.c |
2353 | @@ -738,6 +738,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) |
2354 | cpc_obj = &out_obj->package.elements[0]; |
2355 | if (cpc_obj->type == ACPI_TYPE_INTEGER) { |
2356 | num_ent = cpc_obj->integer.value; |
2357 | + if (num_ent <= 1) { |
2358 | + pr_debug("Unexpected _CPC NumEntries value (%d) for CPU:%d\n", |
2359 | + num_ent, pr->id); |
2360 | + goto out_free; |
2361 | + } |
2362 | } else { |
2363 | pr_debug("Unexpected entry type(%d) for NumEntries\n", |
2364 | cpc_obj->type); |
2365 | diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c |
2366 | index 53ae679c00f01..0ea5e677f00ee 100644 |
2367 | --- a/drivers/acpi/processor_idle.c |
2368 | +++ b/drivers/acpi/processor_idle.c |
2369 | @@ -1201,6 +1201,11 @@ static int flatten_lpi_states(struct acpi_processor *pr, |
2370 | return 0; |
2371 | } |
2372 | |
2373 | +int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu) |
2374 | +{ |
2375 | + return -EOPNOTSUPP; |
2376 | +} |
2377 | + |
2378 | static int acpi_processor_get_lpi_info(struct acpi_processor *pr) |
2379 | { |
2380 | int ret, i; |
2381 | @@ -1209,6 +1214,11 @@ static int acpi_processor_get_lpi_info(struct acpi_processor *pr) |
2382 | struct acpi_device *d = NULL; |
2383 | struct acpi_lpi_states_array info[2], *tmp, *prev, *curr; |
2384 | |
2385 | + /* make sure our architecture has support */ |
2386 | + ret = acpi_processor_ffh_lpi_probe(pr->id); |
2387 | + if (ret == -EOPNOTSUPP) |
2388 | + return ret; |
2389 | + |
2390 | if (!osc_pc_lpi_support_confirmed) |
2391 | return -EOPNOTSUPP; |
2392 | |
2393 | @@ -1260,11 +1270,6 @@ static int acpi_processor_get_lpi_info(struct acpi_processor *pr) |
2394 | return 0; |
2395 | } |
2396 | |
2397 | -int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu) |
2398 | -{ |
2399 | - return -ENODEV; |
2400 | -} |
2401 | - |
2402 | int __weak acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi) |
2403 | { |
2404 | return -ENODEV; |
2405 | diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c |
2406 | index a08e3eb2a6f9f..a4b7cdd0c8446 100644 |
2407 | --- a/drivers/acpi/property.c |
2408 | +++ b/drivers/acpi/property.c |
2409 | @@ -692,7 +692,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
2410 | */ |
2411 | if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) { |
2412 | if (index) |
2413 | - return -EINVAL; |
2414 | + return -ENOENT; |
2415 | |
2416 | ret = acpi_bus_get_device(obj->reference.handle, &device); |
2417 | if (ret) |
2418 | diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c |
2419 | index 982fe91125322..464260f668708 100644 |
2420 | --- a/drivers/ata/sata_dwc_460ex.c |
2421 | +++ b/drivers/ata/sata_dwc_460ex.c |
2422 | @@ -145,7 +145,11 @@ struct sata_dwc_device { |
2423 | #endif |
2424 | }; |
2425 | |
2426 | -#define SATA_DWC_QCMD_MAX 32 |
2427 | +/* |
2428 | + * Allow one extra special slot for commands and DMA management |
2429 | + * to account for libata internal commands. |
2430 | + */ |
2431 | +#define SATA_DWC_QCMD_MAX (ATA_MAX_QUEUE + 1) |
2432 | |
2433 | struct sata_dwc_device_port { |
2434 | struct sata_dwc_device *hsdev; |
2435 | diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
2436 | index cf7e5b4afc1be..26cd4ce3ac75f 100644 |
2437 | --- a/drivers/base/dd.c |
2438 | +++ b/drivers/base/dd.c |
2439 | @@ -747,7 +747,7 @@ static int __init save_async_options(char *buf) |
2440 | "Too long list of driver names for 'driver_async_probe'!\n"); |
2441 | |
2442 | strlcpy(async_probe_drv_names, buf, ASYNC_DRV_NAMES_MAX_LEN); |
2443 | - return 0; |
2444 | + return 1; |
2445 | } |
2446 | __setup("driver_async_probe=", save_async_options); |
2447 | |
2448 | diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
2449 | index 23af545120534..ae382c4018fd8 100644 |
2450 | --- a/drivers/base/power/main.c |
2451 | +++ b/drivers/base/power/main.c |
2452 | @@ -2121,7 +2121,9 @@ static bool pm_ops_is_empty(const struct dev_pm_ops *ops) |
2453 | |
2454 | void device_pm_check_callbacks(struct device *dev) |
2455 | { |
2456 | - spin_lock_irq(&dev->power.lock); |
2457 | + unsigned long flags; |
2458 | + |
2459 | + spin_lock_irqsave(&dev->power.lock, flags); |
2460 | dev->power.no_pm_callbacks = |
2461 | (!dev->bus || (pm_ops_is_empty(dev->bus->pm) && |
2462 | !dev->bus->suspend && !dev->bus->resume)) && |
2463 | @@ -2130,7 +2132,7 @@ void device_pm_check_callbacks(struct device *dev) |
2464 | (!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) && |
2465 | (!dev->driver || (pm_ops_is_empty(dev->driver->pm) && |
2466 | !dev->driver->suspend && !dev->driver->resume)); |
2467 | - spin_unlock_irq(&dev->power.lock); |
2468 | + spin_unlock_irqrestore(&dev->power.lock, flags); |
2469 | } |
2470 | |
2471 | bool dev_pm_smart_suspend_and_suspended(struct device *dev) |
2472 | diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h |
2473 | index ddbf56014c51a..6da7f5749a7c4 100644 |
2474 | --- a/drivers/block/drbd/drbd_int.h |
2475 | +++ b/drivers/block/drbd/drbd_int.h |
2476 | @@ -1673,22 +1673,22 @@ struct sib_info { |
2477 | }; |
2478 | void drbd_bcast_event(struct drbd_device *device, const struct sib_info *sib); |
2479 | |
2480 | -extern void notify_resource_state(struct sk_buff *, |
2481 | +extern int notify_resource_state(struct sk_buff *, |
2482 | unsigned int, |
2483 | struct drbd_resource *, |
2484 | struct resource_info *, |
2485 | enum drbd_notification_type); |
2486 | -extern void notify_device_state(struct sk_buff *, |
2487 | +extern int notify_device_state(struct sk_buff *, |
2488 | unsigned int, |
2489 | struct drbd_device *, |
2490 | struct device_info *, |
2491 | enum drbd_notification_type); |
2492 | -extern void notify_connection_state(struct sk_buff *, |
2493 | +extern int notify_connection_state(struct sk_buff *, |
2494 | unsigned int, |
2495 | struct drbd_connection *, |
2496 | struct connection_info *, |
2497 | enum drbd_notification_type); |
2498 | -extern void notify_peer_device_state(struct sk_buff *, |
2499 | +extern int notify_peer_device_state(struct sk_buff *, |
2500 | unsigned int, |
2501 | struct drbd_peer_device *, |
2502 | struct peer_device_info *, |
2503 | diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c |
2504 | index 5d52a2d321559..bfb00d3b091f1 100644 |
2505 | --- a/drivers/block/drbd/drbd_nl.c |
2506 | +++ b/drivers/block/drbd/drbd_nl.c |
2507 | @@ -4630,7 +4630,7 @@ static int nla_put_notification_header(struct sk_buff *msg, |
2508 | return drbd_notification_header_to_skb(msg, &nh, true); |
2509 | } |
2510 | |
2511 | -void notify_resource_state(struct sk_buff *skb, |
2512 | +int notify_resource_state(struct sk_buff *skb, |
2513 | unsigned int seq, |
2514 | struct drbd_resource *resource, |
2515 | struct resource_info *resource_info, |
2516 | @@ -4672,16 +4672,17 @@ void notify_resource_state(struct sk_buff *skb, |
2517 | if (err && err != -ESRCH) |
2518 | goto failed; |
2519 | } |
2520 | - return; |
2521 | + return 0; |
2522 | |
2523 | nla_put_failure: |
2524 | nlmsg_free(skb); |
2525 | failed: |
2526 | drbd_err(resource, "Error %d while broadcasting event. Event seq:%u\n", |
2527 | err, seq); |
2528 | + return err; |
2529 | } |
2530 | |
2531 | -void notify_device_state(struct sk_buff *skb, |
2532 | +int notify_device_state(struct sk_buff *skb, |
2533 | unsigned int seq, |
2534 | struct drbd_device *device, |
2535 | struct device_info *device_info, |
2536 | @@ -4721,16 +4722,17 @@ void notify_device_state(struct sk_buff *skb, |
2537 | if (err && err != -ESRCH) |
2538 | goto failed; |
2539 | } |
2540 | - return; |
2541 | + return 0; |
2542 | |
2543 | nla_put_failure: |
2544 | nlmsg_free(skb); |
2545 | failed: |
2546 | drbd_err(device, "Error %d while broadcasting event. Event seq:%u\n", |
2547 | err, seq); |
2548 | + return err; |
2549 | } |
2550 | |
2551 | -void notify_connection_state(struct sk_buff *skb, |
2552 | +int notify_connection_state(struct sk_buff *skb, |
2553 | unsigned int seq, |
2554 | struct drbd_connection *connection, |
2555 | struct connection_info *connection_info, |
2556 | @@ -4770,16 +4772,17 @@ void notify_connection_state(struct sk_buff *skb, |
2557 | if (err && err != -ESRCH) |
2558 | goto failed; |
2559 | } |
2560 | - return; |
2561 | + return 0; |
2562 | |
2563 | nla_put_failure: |
2564 | nlmsg_free(skb); |
2565 | failed: |
2566 | drbd_err(connection, "Error %d while broadcasting event. Event seq:%u\n", |
2567 | err, seq); |
2568 | + return err; |
2569 | } |
2570 | |
2571 | -void notify_peer_device_state(struct sk_buff *skb, |
2572 | +int notify_peer_device_state(struct sk_buff *skb, |
2573 | unsigned int seq, |
2574 | struct drbd_peer_device *peer_device, |
2575 | struct peer_device_info *peer_device_info, |
2576 | @@ -4820,13 +4823,14 @@ void notify_peer_device_state(struct sk_buff *skb, |
2577 | if (err && err != -ESRCH) |
2578 | goto failed; |
2579 | } |
2580 | - return; |
2581 | + return 0; |
2582 | |
2583 | nla_put_failure: |
2584 | nlmsg_free(skb); |
2585 | failed: |
2586 | drbd_err(peer_device, "Error %d while broadcasting event. Event seq:%u\n", |
2587 | err, seq); |
2588 | + return err; |
2589 | } |
2590 | |
2591 | void notify_helper(enum drbd_notification_type type, |
2592 | @@ -4877,7 +4881,7 @@ fail: |
2593 | err, seq); |
2594 | } |
2595 | |
2596 | -static void notify_initial_state_done(struct sk_buff *skb, unsigned int seq) |
2597 | +static int notify_initial_state_done(struct sk_buff *skb, unsigned int seq) |
2598 | { |
2599 | struct drbd_genlmsghdr *dh; |
2600 | int err; |
2601 | @@ -4891,11 +4895,12 @@ static void notify_initial_state_done(struct sk_buff *skb, unsigned int seq) |
2602 | if (nla_put_notification_header(skb, NOTIFY_EXISTS)) |
2603 | goto nla_put_failure; |
2604 | genlmsg_end(skb, dh); |
2605 | - return; |
2606 | + return 0; |
2607 | |
2608 | nla_put_failure: |
2609 | nlmsg_free(skb); |
2610 | pr_err("Error %d sending event. Event seq:%u\n", err, seq); |
2611 | + return err; |
2612 | } |
2613 | |
2614 | static void free_state_changes(struct list_head *list) |
2615 | @@ -4922,6 +4927,7 @@ static int get_initial_state(struct sk_buff *skb, struct netlink_callback *cb) |
2616 | unsigned int seq = cb->args[2]; |
2617 | unsigned int n; |
2618 | enum drbd_notification_type flags = 0; |
2619 | + int err = 0; |
2620 | |
2621 | /* There is no need for taking notification_mutex here: it doesn't |
2622 | matter if the initial state events mix with later state chage |
2623 | @@ -4930,32 +4936,32 @@ static int get_initial_state(struct sk_buff *skb, struct netlink_callback *cb) |
2624 | |
2625 | cb->args[5]--; |
2626 | if (cb->args[5] == 1) { |
2627 | - notify_initial_state_done(skb, seq); |
2628 | + err = notify_initial_state_done(skb, seq); |
2629 | goto out; |
2630 | } |
2631 | n = cb->args[4]++; |
2632 | if (cb->args[4] < cb->args[3]) |
2633 | flags |= NOTIFY_CONTINUES; |
2634 | if (n < 1) { |
2635 | - notify_resource_state_change(skb, seq, state_change->resource, |
2636 | + err = notify_resource_state_change(skb, seq, state_change->resource, |
2637 | NOTIFY_EXISTS | flags); |
2638 | goto next; |
2639 | } |
2640 | n--; |
2641 | if (n < state_change->n_connections) { |
2642 | - notify_connection_state_change(skb, seq, &state_change->connections[n], |
2643 | + err = notify_connection_state_change(skb, seq, &state_change->connections[n], |
2644 | NOTIFY_EXISTS | flags); |
2645 | goto next; |
2646 | } |
2647 | n -= state_change->n_connections; |
2648 | if (n < state_change->n_devices) { |
2649 | - notify_device_state_change(skb, seq, &state_change->devices[n], |
2650 | + err = notify_device_state_change(skb, seq, &state_change->devices[n], |
2651 | NOTIFY_EXISTS | flags); |
2652 | goto next; |
2653 | } |
2654 | n -= state_change->n_devices; |
2655 | if (n < state_change->n_devices * state_change->n_connections) { |
2656 | - notify_peer_device_state_change(skb, seq, &state_change->peer_devices[n], |
2657 | + err = notify_peer_device_state_change(skb, seq, &state_change->peer_devices[n], |
2658 | NOTIFY_EXISTS | flags); |
2659 | goto next; |
2660 | } |
2661 | @@ -4970,7 +4976,10 @@ next: |
2662 | cb->args[4] = 0; |
2663 | } |
2664 | out: |
2665 | - return skb->len; |
2666 | + if (err) |
2667 | + return err; |
2668 | + else |
2669 | + return skb->len; |
2670 | } |
2671 | |
2672 | int drbd_adm_get_initial_state(struct sk_buff *skb, struct netlink_callback *cb) |
2673 | diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c |
2674 | index f86cea4c0f8df..5e92632881d81 100644 |
2675 | --- a/drivers/block/drbd/drbd_req.c |
2676 | +++ b/drivers/block/drbd/drbd_req.c |
2677 | @@ -195,7 +195,8 @@ void start_new_tl_epoch(struct drbd_connection *connection) |
2678 | void complete_master_bio(struct drbd_device *device, |
2679 | struct bio_and_error *m) |
2680 | { |
2681 | - m->bio->bi_status = errno_to_blk_status(m->error); |
2682 | + if (unlikely(m->error)) |
2683 | + m->bio->bi_status = errno_to_blk_status(m->error); |
2684 | bio_endio(m->bio); |
2685 | dec_ap_bio(device); |
2686 | } |
2687 | diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c |
2688 | index eeaa3b49b2649..4dad4dd0ceb66 100644 |
2689 | --- a/drivers/block/drbd/drbd_state.c |
2690 | +++ b/drivers/block/drbd/drbd_state.c |
2691 | @@ -1537,7 +1537,7 @@ int drbd_bitmap_io_from_worker(struct drbd_device *device, |
2692 | return rv; |
2693 | } |
2694 | |
2695 | -void notify_resource_state_change(struct sk_buff *skb, |
2696 | +int notify_resource_state_change(struct sk_buff *skb, |
2697 | unsigned int seq, |
2698 | struct drbd_resource_state_change *resource_state_change, |
2699 | enum drbd_notification_type type) |
2700 | @@ -1550,10 +1550,10 @@ void notify_resource_state_change(struct sk_buff *skb, |
2701 | .res_susp_fen = resource_state_change->susp_fen[NEW], |
2702 | }; |
2703 | |
2704 | - notify_resource_state(skb, seq, resource, &resource_info, type); |
2705 | + return notify_resource_state(skb, seq, resource, &resource_info, type); |
2706 | } |
2707 | |
2708 | -void notify_connection_state_change(struct sk_buff *skb, |
2709 | +int notify_connection_state_change(struct sk_buff *skb, |
2710 | unsigned int seq, |
2711 | struct drbd_connection_state_change *connection_state_change, |
2712 | enum drbd_notification_type type) |
2713 | @@ -1564,10 +1564,10 @@ void notify_connection_state_change(struct sk_buff *skb, |
2714 | .conn_role = connection_state_change->peer_role[NEW], |
2715 | }; |
2716 | |
2717 | - notify_connection_state(skb, seq, connection, &connection_info, type); |
2718 | + return notify_connection_state(skb, seq, connection, &connection_info, type); |
2719 | } |
2720 | |
2721 | -void notify_device_state_change(struct sk_buff *skb, |
2722 | +int notify_device_state_change(struct sk_buff *skb, |
2723 | unsigned int seq, |
2724 | struct drbd_device_state_change *device_state_change, |
2725 | enum drbd_notification_type type) |
2726 | @@ -1577,10 +1577,10 @@ void notify_device_state_change(struct sk_buff *skb, |
2727 | .dev_disk_state = device_state_change->disk_state[NEW], |
2728 | }; |
2729 | |
2730 | - notify_device_state(skb, seq, device, &device_info, type); |
2731 | + return notify_device_state(skb, seq, device, &device_info, type); |
2732 | } |
2733 | |
2734 | -void notify_peer_device_state_change(struct sk_buff *skb, |
2735 | +int notify_peer_device_state_change(struct sk_buff *skb, |
2736 | unsigned int seq, |
2737 | struct drbd_peer_device_state_change *p, |
2738 | enum drbd_notification_type type) |
2739 | @@ -1594,7 +1594,7 @@ void notify_peer_device_state_change(struct sk_buff *skb, |
2740 | .peer_resync_susp_dependency = p->resync_susp_dependency[NEW], |
2741 | }; |
2742 | |
2743 | - notify_peer_device_state(skb, seq, peer_device, &peer_device_info, type); |
2744 | + return notify_peer_device_state(skb, seq, peer_device, &peer_device_info, type); |
2745 | } |
2746 | |
2747 | static void broadcast_state_change(struct drbd_state_change *state_change) |
2748 | @@ -1602,7 +1602,7 @@ static void broadcast_state_change(struct drbd_state_change *state_change) |
2749 | struct drbd_resource_state_change *resource_state_change = &state_change->resource[0]; |
2750 | bool resource_state_has_changed; |
2751 | unsigned int n_device, n_connection, n_peer_device, n_peer_devices; |
2752 | - void (*last_func)(struct sk_buff *, unsigned int, void *, |
2753 | + int (*last_func)(struct sk_buff *, unsigned int, void *, |
2754 | enum drbd_notification_type) = NULL; |
2755 | void *uninitialized_var(last_arg); |
2756 | |
2757 | diff --git a/drivers/block/drbd/drbd_state_change.h b/drivers/block/drbd/drbd_state_change.h |
2758 | index ba80f612d6abb..d5b0479bc9a66 100644 |
2759 | --- a/drivers/block/drbd/drbd_state_change.h |
2760 | +++ b/drivers/block/drbd/drbd_state_change.h |
2761 | @@ -44,19 +44,19 @@ extern struct drbd_state_change *remember_old_state(struct drbd_resource *, gfp_ |
2762 | extern void copy_old_to_new_state_change(struct drbd_state_change *); |
2763 | extern void forget_state_change(struct drbd_state_change *); |
2764 | |
2765 | -extern void notify_resource_state_change(struct sk_buff *, |
2766 | +extern int notify_resource_state_change(struct sk_buff *, |
2767 | unsigned int, |
2768 | struct drbd_resource_state_change *, |
2769 | enum drbd_notification_type type); |
2770 | -extern void notify_connection_state_change(struct sk_buff *, |
2771 | +extern int notify_connection_state_change(struct sk_buff *, |
2772 | unsigned int, |
2773 | struct drbd_connection_state_change *, |
2774 | enum drbd_notification_type type); |
2775 | -extern void notify_device_state_change(struct sk_buff *, |
2776 | +extern int notify_device_state_change(struct sk_buff *, |
2777 | unsigned int, |
2778 | struct drbd_device_state_change *, |
2779 | enum drbd_notification_type type); |
2780 | -extern void notify_peer_device_state_change(struct sk_buff *, |
2781 | +extern int notify_peer_device_state_change(struct sk_buff *, |
2782 | unsigned int, |
2783 | struct drbd_peer_device_state_change *, |
2784 | enum drbd_notification_type type); |
2785 | diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
2786 | index ffbe792410d1c..6b3e27b8cd245 100644 |
2787 | --- a/drivers/block/loop.c |
2788 | +++ b/drivers/block/loop.c |
2789 | @@ -794,33 +794,33 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf) |
2790 | |
2791 | static ssize_t loop_attr_offset_show(struct loop_device *lo, char *buf) |
2792 | { |
2793 | - return sprintf(buf, "%llu\n", (unsigned long long)lo->lo_offset); |
2794 | + return sysfs_emit(buf, "%llu\n", (unsigned long long)lo->lo_offset); |
2795 | } |
2796 | |
2797 | static ssize_t loop_attr_sizelimit_show(struct loop_device *lo, char *buf) |
2798 | { |
2799 | - return sprintf(buf, "%llu\n", (unsigned long long)lo->lo_sizelimit); |
2800 | + return sysfs_emit(buf, "%llu\n", (unsigned long long)lo->lo_sizelimit); |
2801 | } |
2802 | |
2803 | static ssize_t loop_attr_autoclear_show(struct loop_device *lo, char *buf) |
2804 | { |
2805 | int autoclear = (lo->lo_flags & LO_FLAGS_AUTOCLEAR); |
2806 | |
2807 | - return sprintf(buf, "%s\n", autoclear ? "1" : "0"); |
2808 | + return sysfs_emit(buf, "%s\n", autoclear ? "1" : "0"); |
2809 | } |
2810 | |
2811 | static ssize_t loop_attr_partscan_show(struct loop_device *lo, char *buf) |
2812 | { |
2813 | int partscan = (lo->lo_flags & LO_FLAGS_PARTSCAN); |
2814 | |
2815 | - return sprintf(buf, "%s\n", partscan ? "1" : "0"); |
2816 | + return sysfs_emit(buf, "%s\n", partscan ? "1" : "0"); |
2817 | } |
2818 | |
2819 | static ssize_t loop_attr_dio_show(struct loop_device *lo, char *buf) |
2820 | { |
2821 | int dio = (lo->lo_flags & LO_FLAGS_DIRECT_IO); |
2822 | |
2823 | - return sprintf(buf, "%s\n", dio ? "1" : "0"); |
2824 | + return sysfs_emit(buf, "%s\n", dio ? "1" : "0"); |
2825 | } |
2826 | |
2827 | LOOP_ATTR_RO(backing_file); |
2828 | diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
2829 | index 4b3645e648ee9..2a5cd502feae7 100644 |
2830 | --- a/drivers/block/virtio_blk.c |
2831 | +++ b/drivers/block/virtio_blk.c |
2832 | @@ -936,9 +936,17 @@ static int virtblk_probe(struct virtio_device *vdev) |
2833 | err = virtio_cread_feature(vdev, VIRTIO_BLK_F_BLK_SIZE, |
2834 | struct virtio_blk_config, blk_size, |
2835 | &blk_size); |
2836 | - if (!err) |
2837 | + if (!err) { |
2838 | + err = blk_validate_block_size(blk_size); |
2839 | + if (err) { |
2840 | + dev_err(&vdev->dev, |
2841 | + "virtio_blk: invalid block size: 0x%x\n", |
2842 | + blk_size); |
2843 | + goto out_free_tags; |
2844 | + } |
2845 | + |
2846 | blk_queue_logical_block_size(q, blk_size); |
2847 | - else |
2848 | + } else |
2849 | blk_size = queue_logical_block_size(q); |
2850 | |
2851 | /* Use topology information if available */ |
2852 | diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c |
2853 | index c2eb64bcd5d5d..0e7f44461946e 100644 |
2854 | --- a/drivers/bluetooth/btmtksdio.c |
2855 | +++ b/drivers/bluetooth/btmtksdio.c |
2856 | @@ -980,6 +980,8 @@ static int btmtksdio_probe(struct sdio_func *func, |
2857 | hdev->manufacturer = 70; |
2858 | set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks); |
2859 | |
2860 | + sdio_set_drvdata(func, bdev); |
2861 | + |
2862 | err = hci_register_dev(hdev); |
2863 | if (err < 0) { |
2864 | dev_err(&func->dev, "Can't register HCI device\n"); |
2865 | @@ -987,8 +989,6 @@ static int btmtksdio_probe(struct sdio_func *func, |
2866 | return err; |
2867 | } |
2868 | |
2869 | - sdio_set_drvdata(func, bdev); |
2870 | - |
2871 | /* pm_runtime_enable would be done after the firmware is being |
2872 | * downloaded because the core layer probably already enables |
2873 | * runtime PM for this func such as the case host->caps & |
2874 | diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c |
2875 | index 1b4ad231e6ed3..fd081bdd2dd8a 100644 |
2876 | --- a/drivers/bluetooth/hci_serdev.c |
2877 | +++ b/drivers/bluetooth/hci_serdev.c |
2878 | @@ -279,6 +279,8 @@ int hci_uart_register_device(struct hci_uart *hu, |
2879 | if (err) |
2880 | return err; |
2881 | |
2882 | + percpu_init_rwsem(&hu->proto_lock); |
2883 | + |
2884 | err = p->open(hu); |
2885 | if (err) |
2886 | goto err_open; |
2887 | @@ -301,7 +303,6 @@ int hci_uart_register_device(struct hci_uart *hu, |
2888 | |
2889 | INIT_WORK(&hu->init_ready, hci_uart_init_work); |
2890 | INIT_WORK(&hu->write_work, hci_uart_write_work); |
2891 | - percpu_init_rwsem(&hu->proto_lock); |
2892 | |
2893 | /* Only when vendor specific setup callback is provided, consider |
2894 | * the manufacturer information valid. This avoids filling in the |
2895 | diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c |
2896 | index e55705745d5e4..f4c94f8acfe0d 100644 |
2897 | --- a/drivers/char/hw_random/atmel-rng.c |
2898 | +++ b/drivers/char/hw_random/atmel-rng.c |
2899 | @@ -96,6 +96,7 @@ static int atmel_trng_probe(struct platform_device *pdev) |
2900 | |
2901 | err_register: |
2902 | clk_disable_unprepare(trng->clk); |
2903 | + atmel_trng_disable(trng); |
2904 | return ret; |
2905 | } |
2906 | |
2907 | diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c |
2908 | index 1838039b03333..17fbd7f7a2954 100644 |
2909 | --- a/drivers/char/tpm/tpm-chip.c |
2910 | +++ b/drivers/char/tpm/tpm-chip.c |
2911 | @@ -274,14 +274,6 @@ static void tpm_dev_release(struct device *dev) |
2912 | kfree(chip); |
2913 | } |
2914 | |
2915 | -static void tpm_devs_release(struct device *dev) |
2916 | -{ |
2917 | - struct tpm_chip *chip = container_of(dev, struct tpm_chip, devs); |
2918 | - |
2919 | - /* release the master device reference */ |
2920 | - put_device(&chip->dev); |
2921 | -} |
2922 | - |
2923 | /** |
2924 | * tpm_class_shutdown() - prepare the TPM device for loss of power. |
2925 | * @dev: device to which the chip is associated. |
2926 | @@ -344,7 +336,6 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
2927 | chip->dev_num = rc; |
2928 | |
2929 | device_initialize(&chip->dev); |
2930 | - device_initialize(&chip->devs); |
2931 | |
2932 | chip->dev.class = tpm_class; |
2933 | chip->dev.class->shutdown_pre = tpm_class_shutdown; |
2934 | @@ -352,29 +343,12 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
2935 | chip->dev.parent = pdev; |
2936 | chip->dev.groups = chip->groups; |
2937 | |
2938 | - chip->devs.parent = pdev; |
2939 | - chip->devs.class = tpmrm_class; |
2940 | - chip->devs.release = tpm_devs_release; |
2941 | - /* get extra reference on main device to hold on |
2942 | - * behalf of devs. This holds the chip structure |
2943 | - * while cdevs is in use. The corresponding put |
2944 | - * is in the tpm_devs_release (TPM2 only) |
2945 | - */ |
2946 | - if (chip->flags & TPM_CHIP_FLAG_TPM2) |
2947 | - get_device(&chip->dev); |
2948 | - |
2949 | if (chip->dev_num == 0) |
2950 | chip->dev.devt = MKDEV(MISC_MAJOR, TPM_MINOR); |
2951 | else |
2952 | chip->dev.devt = MKDEV(MAJOR(tpm_devt), chip->dev_num); |
2953 | |
2954 | - chip->devs.devt = |
2955 | - MKDEV(MAJOR(tpm_devt), chip->dev_num + TPM_NUM_DEVICES); |
2956 | - |
2957 | rc = dev_set_name(&chip->dev, "tpm%d", chip->dev_num); |
2958 | - if (rc) |
2959 | - goto out; |
2960 | - rc = dev_set_name(&chip->devs, "tpmrm%d", chip->dev_num); |
2961 | if (rc) |
2962 | goto out; |
2963 | |
2964 | @@ -382,9 +356,7 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
2965 | chip->flags |= TPM_CHIP_FLAG_VIRTUAL; |
2966 | |
2967 | cdev_init(&chip->cdev, &tpm_fops); |
2968 | - cdev_init(&chip->cdevs, &tpmrm_fops); |
2969 | chip->cdev.owner = THIS_MODULE; |
2970 | - chip->cdevs.owner = THIS_MODULE; |
2971 | |
2972 | rc = tpm2_init_space(&chip->work_space, TPM2_SPACE_BUFFER_SIZE); |
2973 | if (rc) { |
2974 | @@ -396,7 +368,6 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, |
2975 | return chip; |
2976 | |
2977 | out: |
2978 | - put_device(&chip->devs); |
2979 | put_device(&chip->dev); |
2980 | return ERR_PTR(rc); |
2981 | } |
2982 | @@ -445,14 +416,9 @@ static int tpm_add_char_device(struct tpm_chip *chip) |
2983 | } |
2984 | |
2985 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { |
2986 | - rc = cdev_device_add(&chip->cdevs, &chip->devs); |
2987 | - if (rc) { |
2988 | - dev_err(&chip->devs, |
2989 | - "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n", |
2990 | - dev_name(&chip->devs), MAJOR(chip->devs.devt), |
2991 | - MINOR(chip->devs.devt), rc); |
2992 | - return rc; |
2993 | - } |
2994 | + rc = tpm_devs_add(chip); |
2995 | + if (rc) |
2996 | + goto err_del_cdev; |
2997 | } |
2998 | |
2999 | /* Make the chip available. */ |
3000 | @@ -460,6 +426,10 @@ static int tpm_add_char_device(struct tpm_chip *chip) |
3001 | idr_replace(&dev_nums_idr, chip, chip->dev_num); |
3002 | mutex_unlock(&idr_lock); |
3003 | |
3004 | + return 0; |
3005 | + |
3006 | +err_del_cdev: |
3007 | + cdev_device_del(&chip->cdev, &chip->dev); |
3008 | return rc; |
3009 | } |
3010 | |
3011 | @@ -641,7 +611,7 @@ void tpm_chip_unregister(struct tpm_chip *chip) |
3012 | hwrng_unregister(&chip->hwrng); |
3013 | tpm_bios_log_teardown(chip); |
3014 | if (chip->flags & TPM_CHIP_FLAG_TPM2) |
3015 | - cdev_device_del(&chip->cdevs, &chip->devs); |
3016 | + tpm_devs_remove(chip); |
3017 | tpm_del_char_device(chip); |
3018 | } |
3019 | EXPORT_SYMBOL_GPL(tpm_chip_unregister); |
3020 | diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h |
3021 | index 37f010421a369..58312062d435c 100644 |
3022 | --- a/drivers/char/tpm/tpm.h |
3023 | +++ b/drivers/char/tpm/tpm.h |
3024 | @@ -466,6 +466,8 @@ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u8 *cmd, |
3025 | size_t cmdsiz); |
3026 | int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, void *buf, |
3027 | size_t *bufsiz); |
3028 | +int tpm_devs_add(struct tpm_chip *chip); |
3029 | +void tpm_devs_remove(struct tpm_chip *chip); |
3030 | |
3031 | void tpm_bios_log_setup(struct tpm_chip *chip); |
3032 | void tpm_bios_log_teardown(struct tpm_chip *chip); |
3033 | diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c |
3034 | index d2225020e4d2c..ffb35f0154c16 100644 |
3035 | --- a/drivers/char/tpm/tpm2-space.c |
3036 | +++ b/drivers/char/tpm/tpm2-space.c |
3037 | @@ -574,3 +574,68 @@ out: |
3038 | dev_err(&chip->dev, "%s: error %d\n", __func__, rc); |
3039 | return rc; |
3040 | } |
3041 | + |
3042 | +/* |
3043 | + * Put the reference to the main device. |
3044 | + */ |
3045 | +static void tpm_devs_release(struct device *dev) |
3046 | +{ |
3047 | + struct tpm_chip *chip = container_of(dev, struct tpm_chip, devs); |
3048 | + |
3049 | + /* release the master device reference */ |
3050 | + put_device(&chip->dev); |
3051 | +} |
3052 | + |
3053 | +/* |
3054 | + * Remove the device file for exposed TPM spaces and release the device |
3055 | + * reference. This may also release the reference to the master device. |
3056 | + */ |
3057 | +void tpm_devs_remove(struct tpm_chip *chip) |
3058 | +{ |
3059 | + cdev_device_del(&chip->cdevs, &chip->devs); |
3060 | + put_device(&chip->devs); |
3061 | +} |
3062 | + |
3063 | +/* |
3064 | + * Add a device file to expose TPM spaces. Also take a reference to the |
3065 | + * main device. |
3066 | + */ |
3067 | +int tpm_devs_add(struct tpm_chip *chip) |
3068 | +{ |
3069 | + int rc; |
3070 | + |
3071 | + device_initialize(&chip->devs); |
3072 | + chip->devs.parent = chip->dev.parent; |
3073 | + chip->devs.class = tpmrm_class; |
3074 | + |
3075 | + /* |
3076 | + * Get extra reference on main device to hold on behalf of devs. |
3077 | + * This holds the chip structure while cdevs is in use. The |
3078 | + * corresponding put is in the tpm_devs_release. |
3079 | + */ |
3080 | + get_device(&chip->dev); |
3081 | + chip->devs.release = tpm_devs_release; |
3082 | + chip->devs.devt = MKDEV(MAJOR(tpm_devt), chip->dev_num + TPM_NUM_DEVICES); |
3083 | + cdev_init(&chip->cdevs, &tpmrm_fops); |
3084 | + chip->cdevs.owner = THIS_MODULE; |
3085 | + |
3086 | + rc = dev_set_name(&chip->devs, "tpmrm%d", chip->dev_num); |
3087 | + if (rc) |
3088 | + goto err_put_devs; |
3089 | + |
3090 | + rc = cdev_device_add(&chip->cdevs, &chip->devs); |
3091 | + if (rc) { |
3092 | + dev_err(&chip->devs, |
3093 | + "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n", |
3094 | + dev_name(&chip->devs), MAJOR(chip->devs.devt), |
3095 | + MINOR(chip->devs.devt), rc); |
3096 | + goto err_put_devs; |
3097 | + } |
3098 | + |
3099 | + return 0; |
3100 | + |
3101 | +err_put_devs: |
3102 | + put_device(&chip->devs); |
3103 | + |
3104 | + return rc; |
3105 | +} |
3106 | diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c |
3107 | index b453029487a12..c736adef9d3c8 100644 |
3108 | --- a/drivers/char/virtio_console.c |
3109 | +++ b/drivers/char/virtio_console.c |
3110 | @@ -1961,6 +1961,13 @@ static void virtcons_remove(struct virtio_device *vdev) |
3111 | list_del(&portdev->list); |
3112 | spin_unlock_irq(&pdrvdata_lock); |
3113 | |
3114 | + /* Device is going away, exit any polling for buffers */ |
3115 | + virtio_break_device(vdev); |
3116 | + if (use_multiport(portdev)) |
3117 | + flush_work(&portdev->control_work); |
3118 | + else |
3119 | + flush_work(&portdev->config_work); |
3120 | + |
3121 | /* Disable interrupts for vqs */ |
3122 | vdev->config->reset(vdev); |
3123 | /* Finish up work that's lined up */ |
3124 | @@ -2234,7 +2241,7 @@ static struct virtio_driver virtio_rproc_serial = { |
3125 | .remove = virtcons_remove, |
3126 | }; |
3127 | |
3128 | -static int __init init(void) |
3129 | +static int __init virtio_console_init(void) |
3130 | { |
3131 | int err; |
3132 | |
3133 | @@ -2271,7 +2278,7 @@ free: |
3134 | return err; |
3135 | } |
3136 | |
3137 | -static void __exit fini(void) |
3138 | +static void __exit virtio_console_fini(void) |
3139 | { |
3140 | reclaim_dma_bufs(); |
3141 | |
3142 | @@ -2281,8 +2288,8 @@ static void __exit fini(void) |
3143 | class_destroy(pdrvdata.class); |
3144 | debugfs_remove_recursive(pdrvdata.debugfs_dir); |
3145 | } |
3146 | -module_init(init); |
3147 | -module_exit(fini); |
3148 | +module_init(virtio_console_init); |
3149 | +module_exit(virtio_console_fini); |
3150 | |
3151 | MODULE_DESCRIPTION("Virtio console driver"); |
3152 | MODULE_LICENSE("GPL"); |
3153 | diff --git a/drivers/clk/actions/owl-s700.c b/drivers/clk/actions/owl-s700.c |
3154 | index a2f34d13fb543..6ea7da1d6d755 100644 |
3155 | --- a/drivers/clk/actions/owl-s700.c |
3156 | +++ b/drivers/clk/actions/owl-s700.c |
3157 | @@ -162,6 +162,7 @@ static struct clk_div_table hdmia_div_table[] = { |
3158 | |
3159 | static struct clk_div_table rmii_div_table[] = { |
3160 | {0, 4}, {1, 10}, |
3161 | + {0, 0} |
3162 | }; |
3163 | |
3164 | /* divider clocks */ |
3165 | diff --git a/drivers/clk/actions/owl-s900.c b/drivers/clk/actions/owl-s900.c |
3166 | index 790890978424a..5144ada2c7e1a 100644 |
3167 | --- a/drivers/clk/actions/owl-s900.c |
3168 | +++ b/drivers/clk/actions/owl-s900.c |
3169 | @@ -140,7 +140,7 @@ static struct clk_div_table rmii_ref_div_table[] = { |
3170 | |
3171 | static struct clk_div_table usb3_mac_div_table[] = { |
3172 | { 1, 2 }, { 2, 3 }, { 3, 4 }, |
3173 | - { 0, 8 }, |
3174 | + { 0, 0 } |
3175 | }; |
3176 | |
3177 | static struct clk_div_table i2s_div_table[] = { |
3178 | diff --git a/drivers/clk/clk-clps711x.c b/drivers/clk/clk-clps711x.c |
3179 | index a2c6486ef1708..f8417ee2961aa 100644 |
3180 | --- a/drivers/clk/clk-clps711x.c |
3181 | +++ b/drivers/clk/clk-clps711x.c |
3182 | @@ -28,11 +28,13 @@ static const struct clk_div_table spi_div_table[] = { |
3183 | { .val = 1, .div = 8, }, |
3184 | { .val = 2, .div = 2, }, |
3185 | { .val = 3, .div = 1, }, |
3186 | + { /* sentinel */ } |
3187 | }; |
3188 | |
3189 | static const struct clk_div_table timer_div_table[] = { |
3190 | { .val = 0, .div = 256, }, |
3191 | { .val = 1, .div = 1, }, |
3192 | + { /* sentinel */ } |
3193 | }; |
3194 | |
3195 | struct clps711x_clk { |
3196 | diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c |
3197 | index 20ed0955416a3..07ef9995b3cb1 100644 |
3198 | --- a/drivers/clk/clk-si5341.c |
3199 | +++ b/drivers/clk/clk-si5341.c |
3200 | @@ -638,6 +638,15 @@ static unsigned long si5341_output_clk_recalc_rate(struct clk_hw *hw, |
3201 | u32 r_divider; |
3202 | u8 r[3]; |
3203 | |
3204 | + err = regmap_read(output->data->regmap, |
3205 | + SI5341_OUT_CONFIG(output), &val); |
3206 | + if (err < 0) |
3207 | + return err; |
3208 | + |
3209 | + /* If SI5341_OUT_CFG_RDIV_FORCE2 is set, r_divider is 2 */ |
3210 | + if (val & SI5341_OUT_CFG_RDIV_FORCE2) |
3211 | + return parent_rate / 2; |
3212 | + |
3213 | err = regmap_bulk_read(output->data->regmap, |
3214 | SI5341_OUT_R_REG(output), r, 3); |
3215 | if (err < 0) |
3216 | @@ -654,13 +663,6 @@ static unsigned long si5341_output_clk_recalc_rate(struct clk_hw *hw, |
3217 | r_divider += 1; |
3218 | r_divider <<= 1; |
3219 | |
3220 | - err = regmap_read(output->data->regmap, |
3221 | - SI5341_OUT_CONFIG(output), &val); |
3222 | - if (err < 0) |
3223 | - return err; |
3224 | - |
3225 | - if (val & SI5341_OUT_CFG_RDIV_FORCE2) |
3226 | - r_divider = 2; |
3227 | |
3228 | return parent_rate / r_divider; |
3229 | } |
3230 | diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c |
3231 | index e4e1b4e94a67b..13332f89e034b 100644 |
3232 | --- a/drivers/clk/clk.c |
3233 | +++ b/drivers/clk/clk.c |
3234 | @@ -637,6 +637,24 @@ static void clk_core_get_boundaries(struct clk_core *core, |
3235 | *max_rate = min(*max_rate, clk_user->max_rate); |
3236 | } |
3237 | |
3238 | +static bool clk_core_check_boundaries(struct clk_core *core, |
3239 | + unsigned long min_rate, |
3240 | + unsigned long max_rate) |
3241 | +{ |
3242 | + struct clk *user; |
3243 | + |
3244 | + lockdep_assert_held(&prepare_lock); |
3245 | + |
3246 | + if (min_rate > core->max_rate || max_rate < core->min_rate) |
3247 | + return false; |
3248 | + |
3249 | + hlist_for_each_entry(user, &core->clks, clks_node) |
3250 | + if (min_rate > user->max_rate || max_rate < user->min_rate) |
3251 | + return false; |
3252 | + |
3253 | + return true; |
3254 | +} |
3255 | + |
3256 | void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate, |
3257 | unsigned long max_rate) |
3258 | { |
3259 | @@ -2306,6 +2324,11 @@ int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max) |
3260 | clk->min_rate = min; |
3261 | clk->max_rate = max; |
3262 | |
3263 | + if (!clk_core_check_boundaries(clk->core, min, max)) { |
3264 | + ret = -EINVAL; |
3265 | + goto out; |
3266 | + } |
3267 | + |
3268 | rate = clk_core_get_rate_nolock(clk->core); |
3269 | if (rate < min || rate > max) { |
3270 | /* |
3271 | @@ -2334,6 +2357,7 @@ int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max) |
3272 | } |
3273 | } |
3274 | |
3275 | +out: |
3276 | if (clk->exclusive_count) |
3277 | clk_core_rate_protect(clk->core); |
3278 | |
3279 | @@ -3278,6 +3302,19 @@ static void clk_core_reparent_orphans_nolock(void) |
3280 | __clk_set_parent_after(orphan, parent, NULL); |
3281 | __clk_recalc_accuracies(orphan); |
3282 | __clk_recalc_rates(orphan, 0); |
3283 | + |
3284 | + /* |
3285 | + * __clk_init_parent() will set the initial req_rate to |
3286 | + * 0 if the clock doesn't have clk_ops::recalc_rate and |
3287 | + * is an orphan when it's registered. |
3288 | + * |
3289 | + * 'req_rate' is used by clk_set_rate_range() and |
3290 | + * clk_put() to trigger a clk_set_rate() call whenever |
3291 | + * the boundaries are modified. Let's make sure |
3292 | + * 'req_rate' is set to something non-zero so that |
3293 | + * clk_set_rate_range() doesn't drop the frequency. |
3294 | + */ |
3295 | + orphan->req_rate = orphan->rate; |
3296 | } |
3297 | } |
3298 | } |
3299 | diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c |
3300 | index fbea774ef6877..58577548fe212 100644 |
3301 | --- a/drivers/clk/imx/clk-imx7d.c |
3302 | +++ b/drivers/clk/imx/clk-imx7d.c |
3303 | @@ -859,7 +859,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) |
3304 | hws[IMX7D_WDOG4_ROOT_CLK] = imx_clk_hw_gate4("wdog4_root_clk", "wdog_post_div", base + 0x49f0, 0); |
3305 | hws[IMX7D_KPP_ROOT_CLK] = imx_clk_hw_gate4("kpp_root_clk", "ipg_root_clk", base + 0x4aa0, 0); |
3306 | hws[IMX7D_CSI_MCLK_ROOT_CLK] = imx_clk_hw_gate4("csi_mclk_root_clk", "csi_mclk_post_div", base + 0x4490, 0); |
3307 | - hws[IMX7D_AUDIO_MCLK_ROOT_CLK] = imx_clk_hw_gate4("audio_mclk_root_clk", "audio_mclk_post_div", base + 0x4790, 0); |
3308 | hws[IMX7D_WRCLK_ROOT_CLK] = imx_clk_hw_gate4("wrclk_root_clk", "wrclk_post_div", base + 0x47a0, 0); |
3309 | hws[IMX7D_USB_CTRL_CLK] = imx_clk_hw_gate4("usb_ctrl_clk", "ahb_root_clk", base + 0x4680, 0); |
3310 | hws[IMX7D_USB_PHY1_CLK] = imx_clk_hw_gate4("usb_phy1_clk", "pll_usb1_main_clk", base + 0x46a0, 0); |
3311 | diff --git a/drivers/clk/loongson1/clk-loongson1c.c b/drivers/clk/loongson1/clk-loongson1c.c |
3312 | index 703f87622cf5f..1ebf740380efb 100644 |
3313 | --- a/drivers/clk/loongson1/clk-loongson1c.c |
3314 | +++ b/drivers/clk/loongson1/clk-loongson1c.c |
3315 | @@ -37,6 +37,7 @@ static const struct clk_div_table ahb_div_table[] = { |
3316 | [1] = { .val = 1, .div = 4 }, |
3317 | [2] = { .val = 2, .div = 3 }, |
3318 | [3] = { .val = 3, .div = 3 }, |
3319 | + [4] = { /* sentinel */ } |
3320 | }; |
3321 | |
3322 | void __init ls1x_clk_init(void) |
3323 | diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c |
3324 | index a88101480e337..89c1adeb84d44 100644 |
3325 | --- a/drivers/clk/qcom/clk-rcg2.c |
3326 | +++ b/drivers/clk/qcom/clk-rcg2.c |
3327 | @@ -263,7 +263,7 @@ static int clk_rcg2_determine_floor_rate(struct clk_hw *hw, |
3328 | |
3329 | static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) |
3330 | { |
3331 | - u32 cfg, mask; |
3332 | + u32 cfg, mask, d_val, not2d_val, n_minus_m; |
3333 | struct clk_hw *hw = &rcg->clkr.hw; |
3334 | int ret, index = qcom_find_src_index(hw, rcg->parent_map, f->src); |
3335 | |
3336 | @@ -282,8 +282,17 @@ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) |
3337 | if (ret) |
3338 | return ret; |
3339 | |
3340 | + /* Calculate 2d value */ |
3341 | + d_val = f->n; |
3342 | + |
3343 | + n_minus_m = f->n - f->m; |
3344 | + n_minus_m *= 2; |
3345 | + |
3346 | + d_val = clamp_t(u32, d_val, f->m, n_minus_m); |
3347 | + not2d_val = ~d_val & mask; |
3348 | + |
3349 | ret = regmap_update_bits(rcg->clkr.regmap, |
3350 | - RCG_D_OFFSET(rcg), mask, ~f->n); |
3351 | + RCG_D_OFFSET(rcg), mask, not2d_val); |
3352 | if (ret) |
3353 | return ret; |
3354 | } |
3355 | @@ -638,6 +647,7 @@ static const struct frac_entry frac_table_pixel[] = { |
3356 | { 2, 9 }, |
3357 | { 4, 9 }, |
3358 | { 1, 1 }, |
3359 | + { 2, 3 }, |
3360 | { } |
3361 | }; |
3362 | |
3363 | diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c |
3364 | index e01f5f591d1e2..de48ba7eba3a1 100644 |
3365 | --- a/drivers/clk/qcom/gcc-ipq8074.c |
3366 | +++ b/drivers/clk/qcom/gcc-ipq8074.c |
3367 | @@ -1074,7 +1074,7 @@ static struct clk_rcg2 sdcc1_apps_clk_src = { |
3368 | .name = "sdcc1_apps_clk_src", |
3369 | .parent_names = gcc_xo_gpll0_gpll2_gpll0_out_main_div2, |
3370 | .num_parents = 4, |
3371 | - .ops = &clk_rcg2_ops, |
3372 | + .ops = &clk_rcg2_floor_ops, |
3373 | }, |
3374 | }; |
3375 | |
3376 | diff --git a/drivers/clk/qcom/gcc-msm8994.c b/drivers/clk/qcom/gcc-msm8994.c |
3377 | index b7fc8c7ba1957..14f0d5d840802 100644 |
3378 | --- a/drivers/clk/qcom/gcc-msm8994.c |
3379 | +++ b/drivers/clk/qcom/gcc-msm8994.c |
3380 | @@ -107,6 +107,7 @@ static struct clk_alpha_pll gpll4_early = { |
3381 | |
3382 | static struct clk_alpha_pll_postdiv gpll4 = { |
3383 | .offset = 0x1dc0, |
3384 | + .width = 4, |
3385 | .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], |
3386 | .clkr.hw.init = &(struct clk_init_data) |
3387 | { |
3388 | diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c |
3389 | index ea39caf3d7622..0c1b83bedb73d 100644 |
3390 | --- a/drivers/clk/tegra/clk-emc.c |
3391 | +++ b/drivers/clk/tegra/clk-emc.c |
3392 | @@ -191,6 +191,7 @@ static struct tegra_emc *emc_ensure_emc_driver(struct tegra_clk_emc *tegra) |
3393 | |
3394 | tegra->emc = platform_get_drvdata(pdev); |
3395 | if (!tegra->emc) { |
3396 | + put_device(&pdev->dev); |
3397 | pr_err("%s: cannot find EMC driver\n", __func__); |
3398 | return NULL; |
3399 | } |
3400 | diff --git a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c |
3401 | index 5319cd3804801..3bc55ab75314b 100644 |
3402 | --- a/drivers/clk/uniphier/clk-uniphier-fixed-rate.c |
3403 | +++ b/drivers/clk/uniphier/clk-uniphier-fixed-rate.c |
3404 | @@ -24,6 +24,7 @@ struct clk_hw *uniphier_clk_register_fixed_rate(struct device *dev, |
3405 | |
3406 | init.name = name; |
3407 | init.ops = &clk_fixed_rate_ops; |
3408 | + init.flags = 0; |
3409 | init.parent_names = NULL; |
3410 | init.num_parents = 0; |
3411 | |
3412 | diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c |
3413 | index eb596ff9e7bb3..279ddff81ab49 100644 |
3414 | --- a/drivers/clocksource/acpi_pm.c |
3415 | +++ b/drivers/clocksource/acpi_pm.c |
3416 | @@ -229,8 +229,10 @@ static int __init parse_pmtmr(char *arg) |
3417 | int ret; |
3418 | |
3419 | ret = kstrtouint(arg, 16, &base); |
3420 | - if (ret) |
3421 | - return ret; |
3422 | + if (ret) { |
3423 | + pr_warn("PMTMR: invalid 'pmtmr=' value: '%s'\n", arg); |
3424 | + return 1; |
3425 | + } |
3426 | |
3427 | pr_info("PMTMR IOPort override: 0x%04x -> 0x%04x\n", pmtmr_ioport, |
3428 | base); |
3429 | diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c |
3430 | index a3c73e972fce1..bf2a6f64ba0c5 100644 |
3431 | --- a/drivers/clocksource/timer-of.c |
3432 | +++ b/drivers/clocksource/timer-of.c |
3433 | @@ -157,9 +157,9 @@ static __init int timer_of_base_init(struct device_node *np, |
3434 | of_base->base = of_base->name ? |
3435 | of_io_request_and_map(np, of_base->index, of_base->name) : |
3436 | of_iomap(np, of_base->index); |
3437 | - if (IS_ERR(of_base->base)) { |
3438 | - pr_err("Failed to iomap (%s)\n", of_base->name); |
3439 | - return PTR_ERR(of_base->base); |
3440 | + if (IS_ERR_OR_NULL(of_base->base)) { |
3441 | + pr_err("Failed to iomap (%s:%s)\n", np->name, of_base->name); |
3442 | + return of_base->base ? PTR_ERR(of_base->base) : -ENOMEM; |
3443 | } |
3444 | |
3445 | return 0; |
3446 | diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c |
3447 | index 0770a83bf1a57..b3eea329f840f 100644 |
3448 | --- a/drivers/crypto/ccp/ccp-dmaengine.c |
3449 | +++ b/drivers/crypto/ccp/ccp-dmaengine.c |
3450 | @@ -633,6 +633,20 @@ static int ccp_terminate_all(struct dma_chan *dma_chan) |
3451 | return 0; |
3452 | } |
3453 | |
3454 | +static void ccp_dma_release(struct ccp_device *ccp) |
3455 | +{ |
3456 | + struct ccp_dma_chan *chan; |
3457 | + struct dma_chan *dma_chan; |
3458 | + unsigned int i; |
3459 | + |
3460 | + for (i = 0; i < ccp->cmd_q_count; i++) { |
3461 | + chan = ccp->ccp_dma_chan + i; |
3462 | + dma_chan = &chan->dma_chan; |
3463 | + tasklet_kill(&chan->cleanup_tasklet); |
3464 | + list_del_rcu(&dma_chan->device_node); |
3465 | + } |
3466 | +} |
3467 | + |
3468 | int ccp_dmaengine_register(struct ccp_device *ccp) |
3469 | { |
3470 | struct ccp_dma_chan *chan; |
3471 | @@ -737,6 +751,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp) |
3472 | return 0; |
3473 | |
3474 | err_reg: |
3475 | + ccp_dma_release(ccp); |
3476 | kmem_cache_destroy(ccp->dma_desc_cache); |
3477 | |
3478 | err_cache: |
3479 | @@ -753,6 +768,7 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp) |
3480 | return; |
3481 | |
3482 | dma_async_device_unregister(dma_dev); |
3483 | + ccp_dma_release(ccp); |
3484 | |
3485 | kmem_cache_destroy(ccp->dma_desc_cache); |
3486 | kmem_cache_destroy(ccp->dma_cmd_cache); |
3487 | diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c b/drivers/crypto/ccree/cc_buffer_mgr.c |
3488 | index 954f14bddf1d7..dce30ae2b7040 100644 |
3489 | --- a/drivers/crypto/ccree/cc_buffer_mgr.c |
3490 | +++ b/drivers/crypto/ccree/cc_buffer_mgr.c |
3491 | @@ -295,6 +295,13 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg, |
3492 | { |
3493 | int ret = 0; |
3494 | |
3495 | + if (!nbytes) { |
3496 | + *mapped_nents = 0; |
3497 | + *lbytes = 0; |
3498 | + *nents = 0; |
3499 | + return 0; |
3500 | + } |
3501 | + |
3502 | *nents = cc_get_sgl_nents(dev, sg, nbytes, lbytes); |
3503 | if (*nents > max_sg_nents) { |
3504 | *nents = 0; |
3505 | diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c |
3506 | index 5471110792071..9443f31acd27b 100644 |
3507 | --- a/drivers/crypto/mxs-dcp.c |
3508 | +++ b/drivers/crypto/mxs-dcp.c |
3509 | @@ -329,7 +329,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
3510 | memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128); |
3511 | } |
3512 | |
3513 | - for_each_sg(req->src, src, sg_nents(src), i) { |
3514 | + for_each_sg(req->src, src, sg_nents(req->src), i) { |
3515 | src_buf = sg_virt(src); |
3516 | len = sg_dma_len(src); |
3517 | tlen += len; |
3518 | diff --git a/drivers/crypto/vmx/Kconfig b/drivers/crypto/vmx/Kconfig |
3519 | index c85fab7ef0bdd..b2c28b87f14b3 100644 |
3520 | --- a/drivers/crypto/vmx/Kconfig |
3521 | +++ b/drivers/crypto/vmx/Kconfig |
3522 | @@ -2,7 +2,11 @@ |
3523 | config CRYPTO_DEV_VMX_ENCRYPT |
3524 | tristate "Encryption acceleration support on P8 CPU" |
3525 | depends on CRYPTO_DEV_VMX |
3526 | + select CRYPTO_AES |
3527 | + select CRYPTO_CBC |
3528 | + select CRYPTO_CTR |
3529 | select CRYPTO_GHASH |
3530 | + select CRYPTO_XTS |
3531 | default m |
3532 | help |
3533 | Support for VMX cryptographic acceleration instructions on Power8 CPU. |
3534 | diff --git a/drivers/dax/super.c b/drivers/dax/super.c |
3535 | index 8074e5de815b9..5005b92b197d7 100644 |
3536 | --- a/drivers/dax/super.c |
3537 | +++ b/drivers/dax/super.c |
3538 | @@ -691,6 +691,7 @@ static int dax_fs_init(void) |
3539 | static void dax_fs_exit(void) |
3540 | { |
3541 | kern_unmount(dax_mnt); |
3542 | + rcu_barrier(); |
3543 | kmem_cache_destroy(dax_cache); |
3544 | } |
3545 | |
3546 | diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c |
3547 | index 9635897458a09..e553c6a937f69 100644 |
3548 | --- a/drivers/dma-buf/udmabuf.c |
3549 | +++ b/drivers/dma-buf/udmabuf.c |
3550 | @@ -145,6 +145,10 @@ static long udmabuf_create(const struct udmabuf_create_list *head, |
3551 | if (ubuf->pagecount > pglimit) |
3552 | goto err; |
3553 | } |
3554 | + |
3555 | + if (!ubuf->pagecount) |
3556 | + goto err; |
3557 | + |
3558 | ubuf->pages = kmalloc_array(ubuf->pagecount, sizeof(*ubuf->pages), |
3559 | GFP_KERNEL); |
3560 | if (!ubuf->pages) { |
3561 | diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c |
3562 | index 19eee3d0900b0..c51de498b5b4b 100644 |
3563 | --- a/drivers/dma/sh/shdma-base.c |
3564 | +++ b/drivers/dma/sh/shdma-base.c |
3565 | @@ -115,10 +115,8 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) |
3566 | ret = pm_runtime_get(schan->dev); |
3567 | |
3568 | spin_unlock_irq(&schan->chan_lock); |
3569 | - if (ret < 0) { |
3570 | + if (ret < 0) |
3571 | dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret); |
3572 | - pm_runtime_put(schan->dev); |
3573 | - } |
3574 | |
3575 | pm_runtime_barrier(schan->dev); |
3576 | |
3577 | diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig |
3578 | index 2fba0aa7fc54d..20dfe39a0537a 100644 |
3579 | --- a/drivers/firmware/google/Kconfig |
3580 | +++ b/drivers/firmware/google/Kconfig |
3581 | @@ -21,7 +21,7 @@ config GOOGLE_SMI |
3582 | |
3583 | config GOOGLE_COREBOOT_TABLE |
3584 | tristate "Coreboot Table Access" |
3585 | - depends on ACPI || OF |
3586 | + depends on HAS_IOMEM && (ACPI || OF) |
3587 | help |
3588 | This option enables the coreboot_table module, which provides other |
3589 | firmware modules access to the coreboot table. The coreboot table |
3590 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c |
3591 | index ce30d4e8bf25f..f7c4337c1ffe6 100644 |
3592 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c |
3593 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c |
3594 | @@ -165,7 +165,7 @@ static const struct kfd2kgd_calls kfd2kgd = { |
3595 | .get_tile_config = amdgpu_amdkfd_get_tile_config, |
3596 | }; |
3597 | |
3598 | -struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions() |
3599 | +struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions(void) |
3600 | { |
3601 | return (struct kfd2kgd_calls *)&kfd2kgd; |
3602 | } |
3603 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |
3604 | index 82823d9a8ba88..fddeea2b17e50 100644 |
3605 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |
3606 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |
3607 | @@ -1542,6 +1542,7 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, |
3608 | return 0; |
3609 | |
3610 | default: |
3611 | + dma_fence_put(fence); |
3612 | return -EINVAL; |
3613 | } |
3614 | } |
3615 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
3616 | index f9bef3154b998..2659202f2026b 100644 |
3617 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
3618 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c |
3619 | @@ -263,7 +263,7 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev, |
3620 | * adev->gfx.mec.num_pipe_per_mec |
3621 | * adev->gfx.mec.num_queue_per_pipe; |
3622 | |
3623 | - while (queue_bit-- >= 0) { |
3624 | + while (--queue_bit >= 0) { |
3625 | if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap)) |
3626 | continue; |
3627 | |
3628 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
3629 | index 532d1842f6a30..4cc0dd494a42b 100644 |
3630 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
3631 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
3632 | @@ -1305,7 +1305,8 @@ void amdgpu_bo_release_notify(struct ttm_buffer_object *bo) |
3633 | !(abo->flags & AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE)) |
3634 | return; |
3635 | |
3636 | - dma_resv_lock(bo->base.resv, NULL); |
3637 | + if (WARN_ON_ONCE(!dma_resv_trylock(bo->base.resv))) |
3638 | + return; |
3639 | |
3640 | r = amdgpu_fill_buffer(abo, AMDGPU_POISON, bo->base.resv, &fence); |
3641 | if (!WARN_ON(r)) { |
3642 | diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c |
3643 | index 66387caf966e2..3685e89415d5c 100644 |
3644 | --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c |
3645 | +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c |
3646 | @@ -758,7 +758,7 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size) |
3647 | /* Fetch the CRAT table from ACPI */ |
3648 | status = acpi_get_table(CRAT_SIGNATURE, 0, &crat_table); |
3649 | if (status == AE_NOT_FOUND) { |
3650 | - pr_warn("CRAT table not found\n"); |
3651 | + pr_info("CRAT table not found\n"); |
3652 | return -ENODATA; |
3653 | } else if (ACPI_FAILURE(status)) { |
3654 | const char *err = acpi_format_exception(status); |
3655 | diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c |
3656 | index 986ff52d5750c..f4b7f7e6c40e4 100644 |
3657 | --- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c |
3658 | +++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c |
3659 | @@ -82,7 +82,7 @@ static void kfd_exit(void) |
3660 | kfd_chardev_exit(); |
3661 | } |
3662 | |
3663 | -int kgd2kfd_init() |
3664 | +int kgd2kfd_init(void) |
3665 | { |
3666 | return kfd_init(); |
3667 | } |
3668 | diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3669 | index 8e4d863c7570b..c5231c50c4126 100644 |
3670 | --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3671 | +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
3672 | @@ -5013,6 +5013,9 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder, |
3673 | mode = amdgpu_dm_create_common_mode(encoder, |
3674 | common_modes[i].name, common_modes[i].w, |
3675 | common_modes[i].h); |
3676 | + if (!mode) |
3677 | + continue; |
3678 | + |
3679 | drm_mode_probed_add(connector, mode); |
3680 | amdgpu_dm_connector->num_modes++; |
3681 | } |
3682 | @@ -7265,10 +7268,13 @@ cleanup: |
3683 | static int add_affected_mst_dsc_crtcs(struct drm_atomic_state *state, struct drm_crtc *crtc) |
3684 | { |
3685 | struct drm_connector *connector; |
3686 | - struct drm_connector_state *conn_state; |
3687 | + struct drm_connector_state *conn_state, *old_conn_state; |
3688 | struct amdgpu_dm_connector *aconnector = NULL; |
3689 | int i; |
3690 | - for_each_new_connector_in_state(state, connector, conn_state, i) { |
3691 | + for_each_oldnew_connector_in_state(state, connector, old_conn_state, conn_state, i) { |
3692 | + if (!conn_state->crtc) |
3693 | + conn_state = old_conn_state; |
3694 | + |
3695 | if (conn_state->crtc != crtc) |
3696 | continue; |
3697 | |
3698 | diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c |
3699 | index 623455cd75203..d6f988403941b 100644 |
3700 | --- a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c |
3701 | +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c |
3702 | @@ -227,14 +227,6 @@ static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { |
3703 | .funcs = &pflip_irq_info_funcs\ |
3704 | } |
3705 | |
3706 | -#define vupdate_int_entry(reg_num)\ |
3707 | - [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ |
3708 | - IRQ_REG_ENTRY(OTG, reg_num,\ |
3709 | - OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\ |
3710 | - OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\ |
3711 | - .funcs = &vblank_irq_info_funcs\ |
3712 | - } |
3713 | - |
3714 | /* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic |
3715 | * of DCE's DC_IRQ_SOURCE_VUPDATEx. |
3716 | */ |
3717 | @@ -348,12 +340,6 @@ irq_source_info_dcn21[DAL_IRQ_SOURCES_NUMBER] = { |
3718 | dc_underflow_int_entry(6), |
3719 | [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(), |
3720 | [DC_IRQ_SOURCE_VBIOS_SW] = dummy_irq_entry(), |
3721 | - vupdate_int_entry(0), |
3722 | - vupdate_int_entry(1), |
3723 | - vupdate_int_entry(2), |
3724 | - vupdate_int_entry(3), |
3725 | - vupdate_int_entry(4), |
3726 | - vupdate_int_entry(5), |
3727 | vupdate_no_lock_int_entry(0), |
3728 | vupdate_no_lock_int_entry(1), |
3729 | vupdate_no_lock_int_entry(2), |
3730 | diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c |
3731 | index 0cb9dd6986ec3..9c3f9110895e8 100644 |
3732 | --- a/drivers/gpu/drm/bridge/cdns-dsi.c |
3733 | +++ b/drivers/gpu/drm/bridge/cdns-dsi.c |
3734 | @@ -1284,6 +1284,7 @@ static const struct of_device_id cdns_dsi_of_match[] = { |
3735 | { .compatible = "cdns,dsi" }, |
3736 | { }, |
3737 | }; |
3738 | +MODULE_DEVICE_TABLE(of, cdns_dsi_of_match); |
3739 | |
3740 | static struct platform_driver cdns_dsi_platform_driver = { |
3741 | .probe = cdns_dsi_drm_probe, |
3742 | diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c |
3743 | index 04431dbac4a4f..fb0b64c965b74 100644 |
3744 | --- a/drivers/gpu/drm/bridge/sil-sii8620.c |
3745 | +++ b/drivers/gpu/drm/bridge/sil-sii8620.c |
3746 | @@ -2118,7 +2118,7 @@ static void sii8620_init_rcp_input_dev(struct sii8620 *ctx) |
3747 | if (ret) { |
3748 | dev_err(ctx->dev, "Failed to register RC device\n"); |
3749 | ctx->error = ret; |
3750 | - rc_free_device(ctx->rc_dev); |
3751 | + rc_free_device(rc_dev); |
3752 | return; |
3753 | } |
3754 | ctx->rc_dev = rc_dev; |
3755 | diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c |
3756 | index 77384c49fb8dd..2fc27931d3b56 100644 |
3757 | --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c |
3758 | +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c |
3759 | @@ -1057,6 +1057,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev, |
3760 | ret = mipi_dsi_host_register(&dsi->dsi_host); |
3761 | if (ret) { |
3762 | dev_err(dev, "Failed to register MIPI host: %d\n", ret); |
3763 | + pm_runtime_disable(dev); |
3764 | dw_mipi_dsi_debugfs_remove(dsi); |
3765 | return ERR_PTR(ret); |
3766 | } |
3767 | diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
3768 | index 3f0a798906004..aeeab1b57aad3 100644 |
3769 | --- a/drivers/gpu/drm/drm_edid.c |
3770 | +++ b/drivers/gpu/drm/drm_edid.c |
3771 | @@ -4380,7 +4380,8 @@ bool drm_detect_monitor_audio(struct edid *edid) |
3772 | if (!edid_ext) |
3773 | goto end; |
3774 | |
3775 | - has_audio = ((edid_ext[3] & EDID_BASIC_AUDIO) != 0); |
3776 | + has_audio = (edid_ext[0] == CEA_EXT && |
3777 | + (edid_ext[3] & EDID_BASIC_AUDIO) != 0); |
3778 | |
3779 | if (has_audio) { |
3780 | DRM_DEBUG_KMS("Monitor has basic audio support\n"); |
3781 | @@ -4533,16 +4534,8 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, |
3782 | connector->name, dc_bpc); |
3783 | info->bpc = dc_bpc; |
3784 | |
3785 | - /* |
3786 | - * Deep color support mandates RGB444 support for all video |
3787 | - * modes and forbids YCRCB422 support for all video modes per |
3788 | - * HDMI 1.3 spec. |
3789 | - */ |
3790 | - info->color_formats = DRM_COLOR_FORMAT_RGB444; |
3791 | - |
3792 | /* YCRCB444 is optional according to spec. */ |
3793 | if (hdmi[6] & DRM_EDID_HDMI_DC_Y444) { |
3794 | - info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; |
3795 | DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n", |
3796 | connector->name); |
3797 | } |
3798 | diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
3799 | index 448c2f2d803a6..f5ab891731d0b 100644 |
3800 | --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c |
3801 | +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c |
3802 | @@ -166,6 +166,12 @@ static const struct dmi_system_id orientation_data[] = { |
3803 | DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MicroPC"), |
3804 | }, |
3805 | .driver_data = (void *)&lcd720x1280_rightside_up, |
3806 | + }, { /* GPD Win Max */ |
3807 | + .matches = { |
3808 | + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"), |
3809 | + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "G1619-01"), |
3810 | + }, |
3811 | + .driver_data = (void *)&lcd800x1280_rightside_up, |
3812 | }, { /* |
3813 | * GPD Pocket, note that the the DMI data is less generic then |
3814 | * it seems, devices with a board-vendor of "AMI Corporation" |
3815 | diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c |
3816 | index be55548f352af..e24272428744c 100644 |
3817 | --- a/drivers/gpu/drm/imx/parallel-display.c |
3818 | +++ b/drivers/gpu/drm/imx/parallel-display.c |
3819 | @@ -68,8 +68,10 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) |
3820 | ret = of_get_drm_display_mode(np, &imxpd->mode, |
3821 | &imxpd->bus_flags, |
3822 | OF_USE_NATIVE_MODE); |
3823 | - if (ret) |
3824 | + if (ret) { |
3825 | + drm_mode_destroy(connector->dev, mode); |
3826 | return ret; |
3827 | + } |
3828 | |
3829 | drm_mode_copy(mode, &imxpd->mode); |
3830 | mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, |
3831 | diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c |
3832 | index a5d47e301c5f7..13413d2b26028 100644 |
3833 | --- a/drivers/gpu/drm/tegra/dsi.c |
3834 | +++ b/drivers/gpu/drm/tegra/dsi.c |
3835 | @@ -1455,8 +1455,10 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) |
3836 | dsi->slave = platform_get_drvdata(gangster); |
3837 | of_node_put(np); |
3838 | |
3839 | - if (!dsi->slave) |
3840 | + if (!dsi->slave) { |
3841 | + put_device(&gangster->dev); |
3842 | return -EPROBE_DEFER; |
3843 | + } |
3844 | |
3845 | dsi->slave->master = dsi; |
3846 | } |
3847 | diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c |
3848 | index ce7740ef449ba..51d0875a34800 100644 |
3849 | --- a/drivers/greybus/svc.c |
3850 | +++ b/drivers/greybus/svc.c |
3851 | @@ -866,8 +866,14 @@ static int gb_svc_hello(struct gb_operation *op) |
3852 | |
3853 | gb_svc_debugfs_init(svc); |
3854 | |
3855 | - return gb_svc_queue_deferred_request(op); |
3856 | + ret = gb_svc_queue_deferred_request(op); |
3857 | + if (ret) |
3858 | + goto err_remove_debugfs; |
3859 | + |
3860 | + return 0; |
3861 | |
3862 | +err_remove_debugfs: |
3863 | + gb_svc_debugfs_exit(svc); |
3864 | err_unregister_device: |
3865 | gb_svc_watchdog_destroy(svc); |
3866 | device_del(&svc->dev); |
3867 | diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c |
3868 | index 4267e2f2e70f4..a663cbb7b6832 100644 |
3869 | --- a/drivers/hid/hid-logitech-dj.c |
3870 | +++ b/drivers/hid/hid-logitech-dj.c |
3871 | @@ -1000,6 +1000,7 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev, |
3872 | workitem.reports_supported |= STD_KEYBOARD; |
3873 | break; |
3874 | case 0x0f: |
3875 | + case 0x11: |
3876 | device_type = "eQUAD Lightspeed 1.2"; |
3877 | logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem); |
3878 | workitem.reports_supported |= STD_KEYBOARD; |
3879 | diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c |
3880 | index ac076ac73de5d..1547b0ec6a113 100644 |
3881 | --- a/drivers/hid/i2c-hid/i2c-hid-core.c |
3882 | +++ b/drivers/hid/i2c-hid/i2c-hid-core.c |
3883 | @@ -622,6 +622,17 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, |
3884 | if (report_type == HID_OUTPUT_REPORT) |
3885 | return -EINVAL; |
3886 | |
3887 | + /* |
3888 | + * In case of unnumbered reports the response from the device will |
3889 | + * not have the report ID that the upper layers expect, so we need |
3890 | + * to stash it the buffer ourselves and adjust the data size. |
3891 | + */ |
3892 | + if (!report_number) { |
3893 | + buf[0] = 0; |
3894 | + buf++; |
3895 | + count--; |
3896 | + } |
3897 | + |
3898 | /* +2 bytes to include the size of the reply in the query buffer */ |
3899 | ask_count = min(count + 2, (size_t)ihid->bufsize); |
3900 | |
3901 | @@ -643,6 +654,9 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, |
3902 | count = min(count, ret_count - 2); |
3903 | memcpy(buf, ihid->rawbuf + 2, count); |
3904 | |
3905 | + if (!report_number) |
3906 | + count++; |
3907 | + |
3908 | return count; |
3909 | } |
3910 | |
3911 | @@ -659,17 +673,19 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf, |
3912 | |
3913 | mutex_lock(&ihid->reset_lock); |
3914 | |
3915 | - if (report_id) { |
3916 | - buf++; |
3917 | - count--; |
3918 | - } |
3919 | - |
3920 | + /* |
3921 | + * Note that both numbered and unnumbered reports passed here |
3922 | + * are supposed to have report ID stored in the 1st byte of the |
3923 | + * buffer, so we strip it off unconditionally before passing payload |
3924 | + * to i2c_hid_set_or_send_report which takes care of encoding |
3925 | + * everything properly. |
3926 | + */ |
3927 | ret = i2c_hid_set_or_send_report(client, |
3928 | report_type == HID_FEATURE_REPORT ? 0x03 : 0x02, |
3929 | - report_id, buf, count, use_data); |
3930 | + report_id, buf + 1, count - 1, use_data); |
3931 | |
3932 | - if (report_id && ret >= 0) |
3933 | - ret++; /* add report_id to the number of transfered bytes */ |
3934 | + if (ret >= 0) |
3935 | + ret++; /* add report_id to the number of transferred bytes */ |
3936 | |
3937 | mutex_unlock(&ihid->reset_lock); |
3938 | |
3939 | diff --git a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
3940 | index 6cf59fd26ad78..b6d6d119035ca 100644 |
3941 | --- a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
3942 | +++ b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c |
3943 | @@ -656,21 +656,12 @@ static int ish_fw_xfer_direct_dma(struct ishtp_cl_data *client_data, |
3944 | */ |
3945 | payload_max_size &= ~(L1_CACHE_BYTES - 1); |
3946 | |
3947 | - dma_buf = kmalloc(payload_max_size, GFP_KERNEL | GFP_DMA32); |
3948 | + dma_buf = dma_alloc_coherent(devc, payload_max_size, &dma_buf_phy, GFP_KERNEL); |
3949 | if (!dma_buf) { |
3950 | client_data->flag_retry = true; |
3951 | return -ENOMEM; |
3952 | } |
3953 | |
3954 | - dma_buf_phy = dma_map_single(devc, dma_buf, payload_max_size, |
3955 | - DMA_TO_DEVICE); |
3956 | - if (dma_mapping_error(devc, dma_buf_phy)) { |
3957 | - dev_err(cl_data_to_dev(client_data), "DMA map failed\n"); |
3958 | - client_data->flag_retry = true; |
3959 | - rv = -ENOMEM; |
3960 | - goto end_err_dma_buf_release; |
3961 | - } |
3962 | - |
3963 | ldr_xfer_dma_frag.fragment.hdr.command = LOADER_CMD_XFER_FRAGMENT; |
3964 | ldr_xfer_dma_frag.fragment.xfer_mode = LOADER_XFER_MODE_DIRECT_DMA; |
3965 | ldr_xfer_dma_frag.ddr_phys_addr = (u64)dma_buf_phy; |
3966 | @@ -690,14 +681,7 @@ static int ish_fw_xfer_direct_dma(struct ishtp_cl_data *client_data, |
3967 | ldr_xfer_dma_frag.fragment.size = fragment_size; |
3968 | memcpy(dma_buf, &fw->data[fragment_offset], fragment_size); |
3969 | |
3970 | - dma_sync_single_for_device(devc, dma_buf_phy, |
3971 | - payload_max_size, |
3972 | - DMA_TO_DEVICE); |
3973 | - |
3974 | - /* |
3975 | - * Flush cache here because the dma_sync_single_for_device() |
3976 | - * does not do for x86. |
3977 | - */ |
3978 | + /* Flush cache to be sure the data is in main memory. */ |
3979 | clflush_cache_range(dma_buf, payload_max_size); |
3980 | |
3981 | dev_dbg(cl_data_to_dev(client_data), |
3982 | @@ -720,15 +704,8 @@ static int ish_fw_xfer_direct_dma(struct ishtp_cl_data *client_data, |
3983 | fragment_offset += fragment_size; |
3984 | } |
3985 | |
3986 | - dma_unmap_single(devc, dma_buf_phy, payload_max_size, DMA_TO_DEVICE); |
3987 | - kfree(dma_buf); |
3988 | - return 0; |
3989 | - |
3990 | end_err_resp_buf_release: |
3991 | - /* Free ISH buffer if not done already, in error case */ |
3992 | - dma_unmap_single(devc, dma_buf_phy, payload_max_size, DMA_TO_DEVICE); |
3993 | -end_err_dma_buf_release: |
3994 | - kfree(dma_buf); |
3995 | + dma_free_coherent(devc, payload_max_size, dma_buf, dma_buf_phy); |
3996 | return rv; |
3997 | } |
3998 | |
3999 | diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c |
4000 | index bd4e72f6dfd49..44d6de6fc03da 100644 |
4001 | --- a/drivers/hv/hv_balloon.c |
4002 | +++ b/drivers/hv/hv_balloon.c |
4003 | @@ -1550,7 +1550,7 @@ static void balloon_onchannelcallback(void *context) |
4004 | break; |
4005 | |
4006 | default: |
4007 | - pr_warn("Unhandled message: type: %d\n", dm_hdr->type); |
4008 | + pr_warn_ratelimited("Unhandled message: type: %d\n", dm_hdr->type); |
4009 | |
4010 | } |
4011 | } |
4012 | diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c |
4013 | index 6b7ab8f234e87..943654ded73d0 100644 |
4014 | --- a/drivers/hv/vmbus_drv.c |
4015 | +++ b/drivers/hv/vmbus_drv.c |
4016 | @@ -2493,10 +2493,15 @@ static void __exit vmbus_exit(void) |
4017 | if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) { |
4018 | kmsg_dump_unregister(&hv_kmsg_dumper); |
4019 | unregister_die_notifier(&hyperv_die_block); |
4020 | - atomic_notifier_chain_unregister(&panic_notifier_list, |
4021 | - &hyperv_panic_block); |
4022 | } |
4023 | |
4024 | + /* |
4025 | + * The panic notifier is always registered, hence we should |
4026 | + * also unconditionally unregister it here as well. |
4027 | + */ |
4028 | + atomic_notifier_chain_unregister(&panic_notifier_list, |
4029 | + &hyperv_panic_block); |
4030 | + |
4031 | free_page((unsigned long)hv_panic_page); |
4032 | unregister_sysctl_table(hv_ctl_table_hdr); |
4033 | hv_ctl_table_hdr = NULL; |
4034 | diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h |
4035 | index d198af3a92b6f..9731f1f830b16 100644 |
4036 | --- a/drivers/hwmon/pmbus/pmbus.h |
4037 | +++ b/drivers/hwmon/pmbus/pmbus.h |
4038 | @@ -292,6 +292,7 @@ enum pmbus_fan_mode { percent = 0, rpm }; |
4039 | /* |
4040 | * STATUS_VOUT, STATUS_INPUT |
4041 | */ |
4042 | +#define PB_VOLTAGE_VIN_OFF BIT(3) |
4043 | #define PB_VOLTAGE_UV_FAULT BIT(4) |
4044 | #define PB_VOLTAGE_UV_WARNING BIT(5) |
4045 | #define PB_VOLTAGE_OV_WARNING BIT(6) |
4046 | diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c |
4047 | index 8470097907bc2..beb443d020c20 100644 |
4048 | --- a/drivers/hwmon/pmbus/pmbus_core.c |
4049 | +++ b/drivers/hwmon/pmbus/pmbus_core.c |
4050 | @@ -1324,7 +1324,7 @@ static const struct pmbus_limit_attr vin_limit_attrs[] = { |
4051 | .reg = PMBUS_VIN_UV_FAULT_LIMIT, |
4052 | .attr = "lcrit", |
4053 | .alarm = "lcrit_alarm", |
4054 | - .sbit = PB_VOLTAGE_UV_FAULT, |
4055 | + .sbit = PB_VOLTAGE_UV_FAULT | PB_VOLTAGE_VIN_OFF, |
4056 | }, { |
4057 | .reg = PMBUS_VIN_OV_WARN_LIMIT, |
4058 | .attr = "max", |
4059 | @@ -2174,10 +2174,14 @@ static int pmbus_regulator_is_enabled(struct regulator_dev *rdev) |
4060 | { |
4061 | struct device *dev = rdev_get_dev(rdev); |
4062 | struct i2c_client *client = to_i2c_client(dev->parent); |
4063 | + struct pmbus_data *data = i2c_get_clientdata(client); |
4064 | u8 page = rdev_get_id(rdev); |
4065 | int ret; |
4066 | |
4067 | + mutex_lock(&data->update_lock); |
4068 | ret = pmbus_read_byte_data(client, page, PMBUS_OPERATION); |
4069 | + mutex_unlock(&data->update_lock); |
4070 | + |
4071 | if (ret < 0) |
4072 | return ret; |
4073 | |
4074 | @@ -2188,11 +2192,17 @@ static int _pmbus_regulator_on_off(struct regulator_dev *rdev, bool enable) |
4075 | { |
4076 | struct device *dev = rdev_get_dev(rdev); |
4077 | struct i2c_client *client = to_i2c_client(dev->parent); |
4078 | + struct pmbus_data *data = i2c_get_clientdata(client); |
4079 | u8 page = rdev_get_id(rdev); |
4080 | + int ret; |
4081 | |
4082 | - return pmbus_update_byte_data(client, page, PMBUS_OPERATION, |
4083 | - PB_OPERATION_CONTROL_ON, |
4084 | - enable ? PB_OPERATION_CONTROL_ON : 0); |
4085 | + mutex_lock(&data->update_lock); |
4086 | + ret = pmbus_update_byte_data(client, page, PMBUS_OPERATION, |
4087 | + PB_OPERATION_CONTROL_ON, |
4088 | + enable ? PB_OPERATION_CONTROL_ON : 0); |
4089 | + mutex_unlock(&data->update_lock); |
4090 | + |
4091 | + return ret; |
4092 | } |
4093 | |
4094 | static int pmbus_regulator_enable(struct regulator_dev *rdev) |
4095 | diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c |
4096 | index 6c84780e358e8..066b12990fbfb 100644 |
4097 | --- a/drivers/hwmon/sch56xx-common.c |
4098 | +++ b/drivers/hwmon/sch56xx-common.c |
4099 | @@ -424,7 +424,7 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent, |
4100 | if (nowayout) |
4101 | set_bit(WDOG_NO_WAY_OUT, &data->wddev.status); |
4102 | if (output_enable & SCH56XX_WDOG_OUTPUT_ENABLE) |
4103 | - set_bit(WDOG_ACTIVE, &data->wddev.status); |
4104 | + set_bit(WDOG_HW_RUNNING, &data->wddev.status); |
4105 | |
4106 | /* Since the watchdog uses a downcounter there is no register to read |
4107 | the BIOS set timeout from (if any was set at all) -> |
4108 | diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
4109 | index ee44640edeb52..4c9e2fc533529 100644 |
4110 | --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
4111 | +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
4112 | @@ -364,8 +364,12 @@ static ssize_t mode_store(struct device *dev, |
4113 | mode = ETM_MODE_QELEM(config->mode); |
4114 | /* start by clearing QE bits */ |
4115 | config->cfg &= ~(BIT(13) | BIT(14)); |
4116 | - /* if supported, Q elements with instruction counts are enabled */ |
4117 | - if ((mode & BIT(0)) && (drvdata->q_support & BIT(0))) |
4118 | + /* |
4119 | + * if supported, Q elements with instruction counts are enabled. |
4120 | + * Always set the low bit for any requested mode. Valid combos are |
4121 | + * 0b00, 0b01 and 0b11. |
4122 | + */ |
4123 | + if (mode && drvdata->q_support) |
4124 | config->cfg |= BIT(13); |
4125 | /* |
4126 | * if supported, Q elements with and without instruction |
4127 | diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c |
4128 | index 37b3b9307d076..a48bee59dcdec 100644 |
4129 | --- a/drivers/i2c/busses/i2c-xiic.c |
4130 | +++ b/drivers/i2c/busses/i2c-xiic.c |
4131 | @@ -715,7 +715,6 @@ static const struct i2c_adapter_quirks xiic_quirks = { |
4132 | |
4133 | static const struct i2c_adapter xiic_adapter = { |
4134 | .owner = THIS_MODULE, |
4135 | - .name = DRIVER_NAME, |
4136 | .class = I2C_CLASS_DEPRECATED, |
4137 | .algo = &xiic_algorithm, |
4138 | .quirks = &xiic_quirks, |
4139 | @@ -752,6 +751,8 @@ static int xiic_i2c_probe(struct platform_device *pdev) |
4140 | i2c_set_adapdata(&i2c->adap, i2c); |
4141 | i2c->adap.dev.parent = &pdev->dev; |
4142 | i2c->adap.dev.of_node = pdev->dev.of_node; |
4143 | + snprintf(i2c->adap.name, sizeof(i2c->adap.name), |
4144 | + DRIVER_NAME " %s", pdev->name); |
4145 | |
4146 | mutex_init(&i2c->lock); |
4147 | init_waitqueue_head(&i2c->wait); |
4148 | diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c |
4149 | index 5365199a31f41..f7a7405d4350a 100644 |
4150 | --- a/drivers/i2c/muxes/i2c-demux-pinctrl.c |
4151 | +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c |
4152 | @@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) |
4153 | |
4154 | err = device_create_file(&pdev->dev, &dev_attr_available_masters); |
4155 | if (err) |
4156 | - goto err_rollback; |
4157 | + goto err_rollback_activation; |
4158 | |
4159 | err = device_create_file(&pdev->dev, &dev_attr_current_master); |
4160 | if (err) |
4161 | @@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) |
4162 | |
4163 | err_rollback_available: |
4164 | device_remove_file(&pdev->dev, &dev_attr_available_masters); |
4165 | -err_rollback: |
4166 | +err_rollback_activation: |
4167 | i2c_demux_deactivate_master(priv); |
4168 | +err_rollback: |
4169 | for (j = 0; j < i; j++) { |
4170 | of_node_put(priv->chan[j].parent_np); |
4171 | of_changeset_destroy(&priv->chan[j].chgset); |
4172 | diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c |
4173 | index f24148bd15de4..fb77c3ff5a3e4 100644 |
4174 | --- a/drivers/iio/adc/twl6030-gpadc.c |
4175 | +++ b/drivers/iio/adc/twl6030-gpadc.c |
4176 | @@ -911,6 +911,8 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) |
4177 | ret = devm_request_threaded_irq(dev, irq, NULL, |
4178 | twl6030_gpadc_irq_handler, |
4179 | IRQF_ONESHOT, "twl6030_gpadc", indio_dev); |
4180 | + if (ret) |
4181 | + return ret; |
4182 | |
4183 | ret = twl6030_gpadc_enable_irq(TWL6030_GPADC_RT_SW1_EOC_MASK); |
4184 | if (ret < 0) { |
4185 | diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c |
4186 | index e9ceee66d1e7c..d9c41db8155f9 100644 |
4187 | --- a/drivers/iio/afe/iio-rescale.c |
4188 | +++ b/drivers/iio/afe/iio-rescale.c |
4189 | @@ -38,7 +38,7 @@ static int rescale_read_raw(struct iio_dev *indio_dev, |
4190 | int *val, int *val2, long mask) |
4191 | { |
4192 | struct rescale *rescale = iio_priv(indio_dev); |
4193 | - unsigned long long tmp; |
4194 | + s64 tmp; |
4195 | int ret; |
4196 | |
4197 | switch (mask) { |
4198 | @@ -59,10 +59,10 @@ static int rescale_read_raw(struct iio_dev *indio_dev, |
4199 | *val2 = rescale->denominator; |
4200 | return IIO_VAL_FRACTIONAL; |
4201 | case IIO_VAL_FRACTIONAL_LOG2: |
4202 | - tmp = *val * 1000000000LL; |
4203 | - do_div(tmp, rescale->denominator); |
4204 | + tmp = (s64)*val * 1000000000LL; |
4205 | + tmp = div_s64(tmp, rescale->denominator); |
4206 | tmp *= rescale->numerator; |
4207 | - do_div(tmp, 1000000000LL); |
4208 | + tmp = div_s64(tmp, 1000000000LL); |
4209 | *val = tmp; |
4210 | return ret; |
4211 | default: |
4212 | diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c |
4213 | index 5a8351c9a4265..ca0fe902a7db4 100644 |
4214 | --- a/drivers/iio/inkern.c |
4215 | +++ b/drivers/iio/inkern.c |
4216 | @@ -588,28 +588,50 @@ EXPORT_SYMBOL_GPL(iio_read_channel_average_raw); |
4217 | static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, |
4218 | int raw, int *processed, unsigned int scale) |
4219 | { |
4220 | - int scale_type, scale_val, scale_val2, offset; |
4221 | + int scale_type, scale_val, scale_val2; |
4222 | + int offset_type, offset_val, offset_val2; |
4223 | s64 raw64 = raw; |
4224 | - int ret; |
4225 | |
4226 | - ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET); |
4227 | - if (ret >= 0) |
4228 | - raw64 += offset; |
4229 | + offset_type = iio_channel_read(chan, &offset_val, &offset_val2, |
4230 | + IIO_CHAN_INFO_OFFSET); |
4231 | + if (offset_type >= 0) { |
4232 | + switch (offset_type) { |
4233 | + case IIO_VAL_INT: |
4234 | + break; |
4235 | + case IIO_VAL_INT_PLUS_MICRO: |
4236 | + case IIO_VAL_INT_PLUS_NANO: |
4237 | + /* |
4238 | + * Both IIO_VAL_INT_PLUS_MICRO and IIO_VAL_INT_PLUS_NANO |
4239 | + * implicitely truncate the offset to it's integer form. |
4240 | + */ |
4241 | + break; |
4242 | + case IIO_VAL_FRACTIONAL: |
4243 | + offset_val /= offset_val2; |
4244 | + break; |
4245 | + case IIO_VAL_FRACTIONAL_LOG2: |
4246 | + offset_val >>= offset_val2; |
4247 | + break; |
4248 | + default: |
4249 | + return -EINVAL; |
4250 | + } |
4251 | + |
4252 | + raw64 += offset_val; |
4253 | + } |
4254 | |
4255 | scale_type = iio_channel_read(chan, &scale_val, &scale_val2, |
4256 | IIO_CHAN_INFO_SCALE); |
4257 | if (scale_type < 0) { |
4258 | /* |
4259 | - * Just pass raw values as processed if no scaling is |
4260 | - * available. |
4261 | + * If no channel scaling is available apply consumer scale to |
4262 | + * raw value and return. |
4263 | */ |
4264 | - *processed = raw; |
4265 | + *processed = raw * scale; |
4266 | return 0; |
4267 | } |
4268 | |
4269 | switch (scale_type) { |
4270 | case IIO_VAL_INT: |
4271 | - *processed = raw64 * scale_val; |
4272 | + *processed = raw64 * scale_val * scale; |
4273 | break; |
4274 | case IIO_VAL_INT_PLUS_MICRO: |
4275 | if (scale_val2 < 0) |
4276 | diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
4277 | index 5e2b688e36fca..de7df5ab06f3b 100644 |
4278 | --- a/drivers/infiniband/core/cma.c |
4279 | +++ b/drivers/infiniband/core/cma.c |
4280 | @@ -2559,7 +2559,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout) |
4281 | { |
4282 | struct rdma_id_private *id_priv; |
4283 | |
4284 | - if (id->qp_type != IB_QPT_RC) |
4285 | + if (id->qp_type != IB_QPT_RC && id->qp_type != IB_QPT_XRC_INI) |
4286 | return -EINVAL; |
4287 | |
4288 | id_priv = container_of(id, struct rdma_id_private, id); |
4289 | diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c |
4290 | index 664e0f374ac00..747f42855b7bd 100644 |
4291 | --- a/drivers/infiniband/hw/mlx5/devx.c |
4292 | +++ b/drivers/infiniband/hw/mlx5/devx.c |
4293 | @@ -1844,8 +1844,10 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table, |
4294 | key_level2, |
4295 | obj_event, |
4296 | GFP_KERNEL); |
4297 | - if (err) |
4298 | + if (err) { |
4299 | + kfree(obj_event); |
4300 | return err; |
4301 | + } |
4302 | INIT_LIST_HEAD(&obj_event->obj_sub_list); |
4303 | } |
4304 | |
4305 | diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c |
4306 | index a5152f097cb7a..48e8612c1bc8d 100644 |
4307 | --- a/drivers/infiniband/sw/rdmavt/qp.c |
4308 | +++ b/drivers/infiniband/sw/rdmavt/qp.c |
4309 | @@ -3227,7 +3227,11 @@ serr_no_r_lock: |
4310 | spin_lock_irqsave(&sqp->s_lock, flags); |
4311 | rvt_send_complete(sqp, wqe, send_status); |
4312 | if (sqp->ibqp.qp_type == IB_QPT_RC) { |
4313 | - int lastwqe = rvt_error_qp(sqp, IB_WC_WR_FLUSH_ERR); |
4314 | + int lastwqe; |
4315 | + |
4316 | + spin_lock(&sqp->r_lock); |
4317 | + lastwqe = rvt_error_qp(sqp, IB_WC_WR_FLUSH_ERR); |
4318 | + spin_unlock(&sqp->r_lock); |
4319 | |
4320 | sqp->s_flags &= ~RVT_S_BUSY; |
4321 | spin_unlock_irqrestore(&sqp->s_lock, flags); |
4322 | diff --git a/drivers/input/input.c b/drivers/input/input.c |
4323 | index f7398b996bacf..e2eb9b9b8363d 100644 |
4324 | --- a/drivers/input/input.c |
4325 | +++ b/drivers/input/input.c |
4326 | @@ -2181,12 +2181,6 @@ int input_register_device(struct input_dev *dev) |
4327 | /* KEY_RESERVED is not supposed to be transmitted to userspace. */ |
4328 | __clear_bit(KEY_RESERVED, dev->keybit); |
4329 | |
4330 | - /* Buttonpads should not map BTN_RIGHT and/or BTN_MIDDLE. */ |
4331 | - if (test_bit(INPUT_PROP_BUTTONPAD, dev->propbit)) { |
4332 | - __clear_bit(BTN_RIGHT, dev->keybit); |
4333 | - __clear_bit(BTN_MIDDLE, dev->keybit); |
4334 | - } |
4335 | - |
4336 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ |
4337 | input_cleanse_bitmasks(dev); |
4338 | |
4339 | diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c |
4340 | index ef6af714a7e64..02c2fb551f381 100644 |
4341 | --- a/drivers/iommu/arm-smmu-v3.c |
4342 | +++ b/drivers/iommu/arm-smmu-v3.c |
4343 | @@ -1708,6 +1708,7 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev) |
4344 | dev_info(smmu->dev, "\t0x%016llx\n", |
4345 | (unsigned long long)evt[i]); |
4346 | |
4347 | + cond_resched(); |
4348 | } |
4349 | |
4350 | /* |
4351 | diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c |
4352 | index 906582a21124d..628a586be6959 100644 |
4353 | --- a/drivers/iommu/iova.c |
4354 | +++ b/drivers/iommu/iova.c |
4355 | @@ -138,10 +138,11 @@ __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free) |
4356 | cached_iova = rb_entry(iovad->cached32_node, struct iova, node); |
4357 | if (free == cached_iova || |
4358 | (free->pfn_hi < iovad->dma_32bit_pfn && |
4359 | - free->pfn_lo >= cached_iova->pfn_lo)) { |
4360 | + free->pfn_lo >= cached_iova->pfn_lo)) |
4361 | iovad->cached32_node = rb_next(&free->node); |
4362 | + |
4363 | + if (free->pfn_lo < iovad->dma_32bit_pfn) |
4364 | iovad->max32_alloc_size = iovad->dma_32bit_pfn; |
4365 | - } |
4366 | |
4367 | cached_iova = rb_entry(iovad->cached_node, struct iova, node); |
4368 | if (free->pfn_lo >= cached_iova->pfn_lo) |
4369 | diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c |
4370 | index 2639fc7181171..584eefab1dbcd 100644 |
4371 | --- a/drivers/iommu/ipmmu-vmsa.c |
4372 | +++ b/drivers/iommu/ipmmu-vmsa.c |
4373 | @@ -1061,7 +1061,9 @@ static int ipmmu_probe(struct platform_device *pdev) |
4374 | bitmap_zero(mmu->ctx, IPMMU_CTX_MAX); |
4375 | mmu->features = of_device_get_match_data(&pdev->dev); |
4376 | memset(mmu->utlb_ctx, IPMMU_CTX_INVALID, mmu->features->num_utlbs); |
4377 | - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); |
4378 | + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); |
4379 | + if (ret) |
4380 | + return ret; |
4381 | |
4382 | /* Map I/O memory and request IRQ. */ |
4383 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
4384 | diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c |
4385 | index 9d0b42cb9903e..f589ca2480a1d 100644 |
4386 | --- a/drivers/irqchip/irq-gic-v3.c |
4387 | +++ b/drivers/irqchip/irq-gic-v3.c |
4388 | @@ -162,11 +162,11 @@ static inline void __iomem *gic_dist_base(struct irq_data *d) |
4389 | } |
4390 | } |
4391 | |
4392 | -static void gic_do_wait_for_rwp(void __iomem *base) |
4393 | +static void gic_do_wait_for_rwp(void __iomem *base, u32 bit) |
4394 | { |
4395 | u32 count = 1000000; /* 1s! */ |
4396 | |
4397 | - while (readl_relaxed(base + GICD_CTLR) & GICD_CTLR_RWP) { |
4398 | + while (readl_relaxed(base + GICD_CTLR) & bit) { |
4399 | count--; |
4400 | if (!count) { |
4401 | pr_err_ratelimited("RWP timeout, gone fishing\n"); |
4402 | @@ -180,13 +180,13 @@ static void gic_do_wait_for_rwp(void __iomem *base) |
4403 | /* Wait for completion of a distributor change */ |
4404 | static void gic_dist_wait_for_rwp(void) |
4405 | { |
4406 | - gic_do_wait_for_rwp(gic_data.dist_base); |
4407 | + gic_do_wait_for_rwp(gic_data.dist_base, GICD_CTLR_RWP); |
4408 | } |
4409 | |
4410 | /* Wait for completion of a redistributor change */ |
4411 | static void gic_redist_wait_for_rwp(void) |
4412 | { |
4413 | - gic_do_wait_for_rwp(gic_data_rdist_rd_base()); |
4414 | + gic_do_wait_for_rwp(gic_data_rdist_rd_base(), GICR_CTLR_RWP); |
4415 | } |
4416 | |
4417 | #ifdef CONFIG_ARM64 |
4418 | diff --git a/drivers/irqchip/irq-nvic.c b/drivers/irqchip/irq-nvic.c |
4419 | index 160b39b5cd108..128a26d219e2c 100644 |
4420 | --- a/drivers/irqchip/irq-nvic.c |
4421 | +++ b/drivers/irqchip/irq-nvic.c |
4422 | @@ -105,6 +105,7 @@ static int __init nvic_of_init(struct device_node *node, |
4423 | |
4424 | if (!nvic_irq_domain) { |
4425 | pr_warn("Failed to allocate irq domain\n"); |
4426 | + iounmap(nvic_base); |
4427 | return -ENOMEM; |
4428 | } |
4429 | |
4430 | @@ -114,6 +115,7 @@ static int __init nvic_of_init(struct device_node *node, |
4431 | if (ret) { |
4432 | pr_warn("Failed to allocate irq chips\n"); |
4433 | irq_domain_remove(nvic_irq_domain); |
4434 | + iounmap(nvic_base); |
4435 | return ret; |
4436 | } |
4437 | |
4438 | diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c |
4439 | index faa7d61b9d6c4..239a889df6080 100644 |
4440 | --- a/drivers/irqchip/qcom-pdc.c |
4441 | +++ b/drivers/irqchip/qcom-pdc.c |
4442 | @@ -50,17 +50,18 @@ static u32 pdc_reg_read(int reg, u32 i) |
4443 | static void pdc_enable_intr(struct irq_data *d, bool on) |
4444 | { |
4445 | int pin_out = d->hwirq; |
4446 | + unsigned long flags; |
4447 | u32 index, mask; |
4448 | u32 enable; |
4449 | |
4450 | index = pin_out / 32; |
4451 | mask = pin_out % 32; |
4452 | |
4453 | - raw_spin_lock(&pdc_lock); |
4454 | + raw_spin_lock_irqsave(&pdc_lock, flags); |
4455 | enable = pdc_reg_read(IRQ_ENABLE_BANK, index); |
4456 | enable = on ? ENABLE_INTR(enable, mask) : CLEAR_INTR(enable, mask); |
4457 | pdc_reg_write(IRQ_ENABLE_BANK, index, enable); |
4458 | - raw_spin_unlock(&pdc_lock); |
4459 | + raw_spin_unlock_irqrestore(&pdc_lock, flags); |
4460 | } |
4461 | |
4462 | static void qcom_pdc_gic_mask(struct irq_data *d) |
4463 | diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c |
4464 | index 834b35dc3b137..e9b392dc09bc2 100644 |
4465 | --- a/drivers/mailbox/tegra-hsp.c |
4466 | +++ b/drivers/mailbox/tegra-hsp.c |
4467 | @@ -403,6 +403,11 @@ static int tegra_hsp_mailbox_flush(struct mbox_chan *chan, |
4468 | value = tegra_hsp_channel_readl(ch, HSP_SM_SHRD_MBOX); |
4469 | if ((value & HSP_SM_SHRD_MBOX_FULL) == 0) { |
4470 | mbox_chan_txdone(chan, 0); |
4471 | + |
4472 | + /* Wait until channel is empty */ |
4473 | + if (chan->active_req != NULL) |
4474 | + continue; |
4475 | + |
4476 | return 0; |
4477 | } |
4478 | |
4479 | diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c |
4480 | index 571c04e70343a..3ed8ca47bc6e6 100644 |
4481 | --- a/drivers/md/dm-crypt.c |
4482 | +++ b/drivers/md/dm-crypt.c |
4483 | @@ -2010,7 +2010,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string |
4484 | |
4485 | static int get_key_size(char **key_string) |
4486 | { |
4487 | - return (*key_string[0] == ':') ? -EINVAL : strlen(*key_string) >> 1; |
4488 | + return (*key_string[0] == ':') ? -EINVAL : (int)(strlen(*key_string) >> 1); |
4489 | } |
4490 | |
4491 | #endif |
4492 | diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c |
4493 | index 3f15d8dc2b71f..7a73f2fa0ad72 100644 |
4494 | --- a/drivers/md/dm-ioctl.c |
4495 | +++ b/drivers/md/dm-ioctl.c |
4496 | @@ -17,6 +17,7 @@ |
4497 | #include <linux/dm-ioctl.h> |
4498 | #include <linux/hdreg.h> |
4499 | #include <linux/compat.h> |
4500 | +#include <linux/nospec.h> |
4501 | |
4502 | #include <linux/uaccess.h> |
4503 | |
4504 | @@ -1696,6 +1697,7 @@ static ioctl_fn lookup_ioctl(unsigned int cmd, int *ioctl_flags) |
4505 | if (unlikely(cmd >= ARRAY_SIZE(_ioctls))) |
4506 | return NULL; |
4507 | |
4508 | + cmd = array_index_nospec(cmd, ARRAY_SIZE(_ioctls)); |
4509 | *ioctl_flags = _ioctls[cmd].flags; |
4510 | return _ioctls[cmd].fn; |
4511 | } |
4512 | diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c |
4513 | index 809fa44ed9880..86267e01c2511 100644 |
4514 | --- a/drivers/media/i2c/adv7511-v4l2.c |
4515 | +++ b/drivers/media/i2c/adv7511-v4l2.c |
4516 | @@ -555,7 +555,7 @@ static void log_infoframe(struct v4l2_subdev *sd, const struct adv7511_cfg_read_ |
4517 | buffer[3] = 0; |
4518 | buffer[3] = hdmi_infoframe_checksum(buffer, len + 4); |
4519 | |
4520 | - if (hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer)) < 0) { |
4521 | + if (hdmi_infoframe_unpack(&frame, buffer, len + 4) < 0) { |
4522 | v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, cri->desc); |
4523 | return; |
4524 | } |
4525 | diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c |
4526 | index b887299ac195f..1cee69919e1b9 100644 |
4527 | --- a/drivers/media/i2c/adv7604.c |
4528 | +++ b/drivers/media/i2c/adv7604.c |
4529 | @@ -2444,7 +2444,7 @@ static int adv76xx_read_infoframe(struct v4l2_subdev *sd, int index, |
4530 | buffer[i + 3] = infoframe_read(sd, |
4531 | adv76xx_cri[index].payload_addr + i); |
4532 | |
4533 | - if (hdmi_infoframe_unpack(frame, buffer, sizeof(buffer)) < 0) { |
4534 | + if (hdmi_infoframe_unpack(frame, buffer, len + 3) < 0) { |
4535 | v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, |
4536 | adv76xx_cri[index].desc); |
4537 | return -ENOENT; |
4538 | diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c |
4539 | index 02cbab826d0b6..a581e822ce6f5 100644 |
4540 | --- a/drivers/media/i2c/adv7842.c |
4541 | +++ b/drivers/media/i2c/adv7842.c |
4542 | @@ -2574,7 +2574,7 @@ static void log_infoframe(struct v4l2_subdev *sd, struct adv7842_cfg_read_infofr |
4543 | for (i = 0; i < len; i++) |
4544 | buffer[i + 3] = infoframe_read(sd, cri->payload_addr + i); |
4545 | |
4546 | - if (hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer)) < 0) { |
4547 | + if (hdmi_infoframe_unpack(&frame, buffer, len + 3) < 0) { |
4548 | v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, cri->desc); |
4549 | return; |
4550 | } |
4551 | diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c |
4552 | index 570530d976d21..6441e7d63d971 100644 |
4553 | --- a/drivers/media/pci/bt8xx/bttv-driver.c |
4554 | +++ b/drivers/media/pci/bt8xx/bttv-driver.c |
4555 | @@ -3898,7 +3898,7 @@ static int bttv_register_video(struct bttv *btv) |
4556 | |
4557 | /* video */ |
4558 | vdev_init(btv, &btv->video_dev, &bttv_video_template, "video"); |
4559 | - btv->video_dev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | |
4560 | + btv->video_dev.device_caps = V4L2_CAP_VIDEO_CAPTURE | |
4561 | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; |
4562 | if (btv->tuner_type != TUNER_ABSENT) |
4563 | btv->video_dev.device_caps |= V4L2_CAP_TUNER; |
4564 | @@ -3919,7 +3919,7 @@ static int bttv_register_video(struct bttv *btv) |
4565 | /* vbi */ |
4566 | vdev_init(btv, &btv->vbi_dev, &bttv_video_template, "vbi"); |
4567 | btv->vbi_dev.device_caps = V4L2_CAP_VBI_CAPTURE | V4L2_CAP_READWRITE | |
4568 | - V4L2_CAP_STREAMING | V4L2_CAP_TUNER; |
4569 | + V4L2_CAP_STREAMING; |
4570 | if (btv->tuner_type != TUNER_ABSENT) |
4571 | btv->vbi_dev.device_caps |= V4L2_CAP_TUNER; |
4572 | |
4573 | diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c |
4574 | index a57c991b165b1..10d2971ef0624 100644 |
4575 | --- a/drivers/media/pci/cx88/cx88-mpeg.c |
4576 | +++ b/drivers/media/pci/cx88/cx88-mpeg.c |
4577 | @@ -162,6 +162,9 @@ int cx8802_start_dma(struct cx8802_dev *dev, |
4578 | cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET); |
4579 | q->count = 0; |
4580 | |
4581 | + /* clear interrupt status register */ |
4582 | + cx_write(MO_TS_INTSTAT, 0x1f1111); |
4583 | + |
4584 | /* enable irqs */ |
4585 | dprintk(1, "setting the interrupt mask\n"); |
4586 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_TSINT); |
4587 | diff --git a/drivers/media/pci/ivtv/ivtv-driver.h b/drivers/media/pci/ivtv/ivtv-driver.h |
4588 | index cafba6b1055df..90f38552bd362 100644 |
4589 | --- a/drivers/media/pci/ivtv/ivtv-driver.h |
4590 | +++ b/drivers/media/pci/ivtv/ivtv-driver.h |
4591 | @@ -333,7 +333,6 @@ struct ivtv_stream { |
4592 | struct ivtv *itv; /* for ease of use */ |
4593 | const char *name; /* name of the stream */ |
4594 | int type; /* stream type */ |
4595 | - u32 caps; /* V4L2 capabilities */ |
4596 | |
4597 | struct v4l2_fh *fh; /* pointer to the streaming filehandle */ |
4598 | spinlock_t qlock; /* locks access to the queues */ |
4599 | diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c |
4600 | index 137853944e461..396cc931f41a2 100644 |
4601 | --- a/drivers/media/pci/ivtv/ivtv-ioctl.c |
4602 | +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c |
4603 | @@ -443,7 +443,7 @@ static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_f |
4604 | struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; |
4605 | struct v4l2_window *winfmt = &fmt->fmt.win; |
4606 | |
4607 | - if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4608 | + if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4609 | return -EINVAL; |
4610 | if (!itv->osd_video_pbase) |
4611 | return -EINVAL; |
4612 | @@ -554,7 +554,7 @@ static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2 |
4613 | u32 chromakey = fmt->fmt.win.chromakey; |
4614 | u8 global_alpha = fmt->fmt.win.global_alpha; |
4615 | |
4616 | - if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4617 | + if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4618 | return -EINVAL; |
4619 | if (!itv->osd_video_pbase) |
4620 | return -EINVAL; |
4621 | @@ -1386,7 +1386,7 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) |
4622 | 0, |
4623 | }; |
4624 | |
4625 | - if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4626 | + if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4627 | return -ENOTTY; |
4628 | if (!itv->osd_video_pbase) |
4629 | return -ENOTTY; |
4630 | @@ -1453,7 +1453,7 @@ static int ivtv_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffe |
4631 | struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; |
4632 | struct yuv_playback_info *yi = &itv->yuv_info; |
4633 | |
4634 | - if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4635 | + if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4636 | return -ENOTTY; |
4637 | if (!itv->osd_video_pbase) |
4638 | return -ENOTTY; |
4639 | @@ -1473,7 +1473,7 @@ static int ivtv_overlay(struct file *file, void *fh, unsigned int on) |
4640 | struct ivtv *itv = id->itv; |
4641 | struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; |
4642 | |
4643 | - if (!(s->caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4644 | + if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
4645 | return -ENOTTY; |
4646 | if (!itv->osd_video_pbase) |
4647 | return -ENOTTY; |
4648 | diff --git a/drivers/media/pci/ivtv/ivtv-streams.c b/drivers/media/pci/ivtv/ivtv-streams.c |
4649 | index f7de9118f609d..200d2100dbffd 100644 |
4650 | --- a/drivers/media/pci/ivtv/ivtv-streams.c |
4651 | +++ b/drivers/media/pci/ivtv/ivtv-streams.c |
4652 | @@ -176,7 +176,7 @@ static void ivtv_stream_init(struct ivtv *itv, int type) |
4653 | s->itv = itv; |
4654 | s->type = type; |
4655 | s->name = ivtv_stream_info[type].name; |
4656 | - s->caps = ivtv_stream_info[type].v4l2_caps; |
4657 | + s->vdev.device_caps = ivtv_stream_info[type].v4l2_caps; |
4658 | |
4659 | if (ivtv_stream_info[type].pio) |
4660 | s->dma = PCI_DMA_NONE; |
4661 | @@ -299,12 +299,9 @@ static int ivtv_reg_dev(struct ivtv *itv, int type) |
4662 | if (s_mpg->vdev.v4l2_dev) |
4663 | num = s_mpg->vdev.num + ivtv_stream_info[type].num_offset; |
4664 | } |
4665 | - s->vdev.device_caps = s->caps; |
4666 | - if (itv->osd_video_pbase) { |
4667 | - itv->streams[IVTV_DEC_STREAM_TYPE_YUV].vdev.device_caps |= |
4668 | - V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
4669 | - itv->streams[IVTV_DEC_STREAM_TYPE_MPG].vdev.device_caps |= |
4670 | - V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
4671 | + if (itv->osd_video_pbase && (type == IVTV_DEC_STREAM_TYPE_YUV || |
4672 | + type == IVTV_DEC_STREAM_TYPE_MPG)) { |
4673 | + s->vdev.device_caps |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
4674 | itv->v4l2_cap |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY; |
4675 | } |
4676 | video_set_drvdata(&s->vdev, s); |
4677 | diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c |
4678 | index 1e0867016bf37..c87eddb1c93f7 100644 |
4679 | --- a/drivers/media/platform/aspeed-video.c |
4680 | +++ b/drivers/media/platform/aspeed-video.c |
4681 | @@ -151,7 +151,7 @@ |
4682 | #define VE_SRC_TB_EDGE_DET_BOT GENMASK(28, VE_SRC_TB_EDGE_DET_BOT_SHF) |
4683 | |
4684 | #define VE_MODE_DETECT_STATUS 0x098 |
4685 | -#define VE_MODE_DETECT_H_PIXELS GENMASK(11, 0) |
4686 | +#define VE_MODE_DETECT_H_PERIOD GENMASK(11, 0) |
4687 | #define VE_MODE_DETECT_V_LINES_SHF 16 |
4688 | #define VE_MODE_DETECT_V_LINES GENMASK(27, VE_MODE_DETECT_V_LINES_SHF) |
4689 | #define VE_MODE_DETECT_STATUS_VSYNC BIT(28) |
4690 | @@ -162,6 +162,8 @@ |
4691 | #define VE_SYNC_STATUS_VSYNC_SHF 16 |
4692 | #define VE_SYNC_STATUS_VSYNC GENMASK(27, VE_SYNC_STATUS_VSYNC_SHF) |
4693 | |
4694 | +#define VE_H_TOTAL_PIXELS 0x0A0 |
4695 | + |
4696 | #define VE_INTERRUPT_CTRL 0x304 |
4697 | #define VE_INTERRUPT_STATUS 0x308 |
4698 | #define VE_INTERRUPT_MODE_DETECT_WD BIT(0) |
4699 | @@ -743,6 +745,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
4700 | u32 src_lr_edge; |
4701 | u32 src_tb_edge; |
4702 | u32 sync; |
4703 | + u32 htotal; |
4704 | struct v4l2_bt_timings *det = &video->detected_timings; |
4705 | |
4706 | det->width = MIN_WIDTH; |
4707 | @@ -787,6 +790,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
4708 | src_tb_edge = aspeed_video_read(video, VE_SRC_TB_EDGE_DET); |
4709 | mds = aspeed_video_read(video, VE_MODE_DETECT_STATUS); |
4710 | sync = aspeed_video_read(video, VE_SYNC_STATUS); |
4711 | + htotal = aspeed_video_read(video, VE_H_TOTAL_PIXELS); |
4712 | |
4713 | video->frame_bottom = (src_tb_edge & VE_SRC_TB_EDGE_DET_BOT) >> |
4714 | VE_SRC_TB_EDGE_DET_BOT_SHF; |
4715 | @@ -803,8 +807,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) |
4716 | VE_SRC_LR_EDGE_DET_RT_SHF; |
4717 | video->frame_left = src_lr_edge & VE_SRC_LR_EDGE_DET_LEFT; |
4718 | det->hfrontporch = video->frame_left; |
4719 | - det->hbackporch = (mds & VE_MODE_DETECT_H_PIXELS) - |
4720 | - video->frame_right; |
4721 | + det->hbackporch = htotal - video->frame_right; |
4722 | det->hsync = sync & VE_SYNC_STATUS_HSYNC; |
4723 | if (video->frame_left > video->frame_right) |
4724 | continue; |
4725 | diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c |
4726 | index 834f11fe9dc29..0adc54832657b 100644 |
4727 | --- a/drivers/media/platform/coda/coda-common.c |
4728 | +++ b/drivers/media/platform/coda/coda-common.c |
4729 | @@ -372,6 +372,7 @@ static struct vdoa_data *coda_get_vdoa_data(void) |
4730 | if (!vdoa_data) |
4731 | vdoa_data = ERR_PTR(-EPROBE_DEFER); |
4732 | |
4733 | + put_device(&vdoa_pdev->dev); |
4734 | out: |
4735 | of_node_put(vdoa_node); |
4736 | |
4737 | diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c |
4738 | index df66461f5d4f1..e7e8eba048acf 100644 |
4739 | --- a/drivers/media/platform/davinci/vpif.c |
4740 | +++ b/drivers/media/platform/davinci/vpif.c |
4741 | @@ -496,6 +496,7 @@ static int vpif_probe(struct platform_device *pdev) |
4742 | |
4743 | static int vpif_remove(struct platform_device *pdev) |
4744 | { |
4745 | + pm_runtime_put(&pdev->dev); |
4746 | pm_runtime_disable(&pdev->dev); |
4747 | return 0; |
4748 | } |
4749 | diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c |
4750 | index bfca9d0a1fe15..5ae13ee9272d5 100644 |
4751 | --- a/drivers/media/usb/em28xx/em28xx-cards.c |
4752 | +++ b/drivers/media/usb/em28xx/em28xx-cards.c |
4753 | @@ -3821,6 +3821,8 @@ static int em28xx_usb_probe(struct usb_interface *intf, |
4754 | goto err_free; |
4755 | } |
4756 | |
4757 | + kref_init(&dev->ref); |
4758 | + |
4759 | dev->devno = nr; |
4760 | dev->model = id->driver_info; |
4761 | dev->alt = -1; |
4762 | @@ -3921,6 +3923,8 @@ static int em28xx_usb_probe(struct usb_interface *intf, |
4763 | } |
4764 | |
4765 | if (dev->board.has_dual_ts && em28xx_duplicate_dev(dev) == 0) { |
4766 | + kref_init(&dev->dev_next->ref); |
4767 | + |
4768 | dev->dev_next->ts = SECONDARY_TS; |
4769 | dev->dev_next->alt = -1; |
4770 | dev->dev_next->is_audio_only = has_vendor_audio && |
4771 | @@ -3975,12 +3979,8 @@ static int em28xx_usb_probe(struct usb_interface *intf, |
4772 | em28xx_write_reg(dev, 0x0b, 0x82); |
4773 | mdelay(100); |
4774 | } |
4775 | - |
4776 | - kref_init(&dev->dev_next->ref); |
4777 | } |
4778 | |
4779 | - kref_init(&dev->ref); |
4780 | - |
4781 | request_modules(dev); |
4782 | |
4783 | /* |
4784 | @@ -4035,11 +4035,8 @@ static void em28xx_usb_disconnect(struct usb_interface *intf) |
4785 | |
4786 | em28xx_close_extension(dev); |
4787 | |
4788 | - if (dev->dev_next) { |
4789 | - em28xx_close_extension(dev->dev_next); |
4790 | + if (dev->dev_next) |
4791 | em28xx_release_resources(dev->dev_next); |
4792 | - } |
4793 | - |
4794 | em28xx_release_resources(dev); |
4795 | |
4796 | if (dev->dev_next) { |
4797 | diff --git a/drivers/media/usb/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c |
4798 | index 49e75a1a1f3f8..af3b18c6d9e17 100644 |
4799 | --- a/drivers/media/usb/go7007/s2250-board.c |
4800 | +++ b/drivers/media/usb/go7007/s2250-board.c |
4801 | @@ -504,6 +504,7 @@ static int s2250_probe(struct i2c_client *client, |
4802 | u8 *data; |
4803 | struct go7007 *go = i2c_get_adapdata(adapter); |
4804 | struct go7007_usb *usb = go->hpi_context; |
4805 | + int err = -EIO; |
4806 | |
4807 | audio = i2c_new_dummy_device(adapter, TLV320_ADDRESS >> 1); |
4808 | if (IS_ERR(audio)) |
4809 | @@ -532,11 +533,8 @@ static int s2250_probe(struct i2c_client *client, |
4810 | V4L2_CID_HUE, -512, 511, 1, 0); |
4811 | sd->ctrl_handler = &state->hdl; |
4812 | if (state->hdl.error) { |
4813 | - int err = state->hdl.error; |
4814 | - |
4815 | - v4l2_ctrl_handler_free(&state->hdl); |
4816 | - kfree(state); |
4817 | - return err; |
4818 | + err = state->hdl.error; |
4819 | + goto fail; |
4820 | } |
4821 | |
4822 | state->std = V4L2_STD_NTSC; |
4823 | @@ -600,7 +598,7 @@ fail: |
4824 | i2c_unregister_device(audio); |
4825 | v4l2_ctrl_handler_free(&state->hdl); |
4826 | kfree(state); |
4827 | - return -EIO; |
4828 | + return err; |
4829 | } |
4830 | |
4831 | static int s2250_remove(struct i2c_client *client) |
4832 | diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c |
4833 | index bad71d863d395..7849f1fbbcc4d 100644 |
4834 | --- a/drivers/media/usb/hdpvr/hdpvr-video.c |
4835 | +++ b/drivers/media/usb/hdpvr/hdpvr-video.c |
4836 | @@ -308,7 +308,6 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) |
4837 | |
4838 | dev->status = STATUS_STREAMING; |
4839 | |
4840 | - INIT_WORK(&dev->worker, hdpvr_transmit_buffers); |
4841 | schedule_work(&dev->worker); |
4842 | |
4843 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, |
4844 | @@ -1165,6 +1164,9 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, |
4845 | bool ac3 = dev->flags & HDPVR_FLAG_AC3_CAP; |
4846 | int res; |
4847 | |
4848 | + // initialize dev->worker |
4849 | + INIT_WORK(&dev->worker, hdpvr_transmit_buffers); |
4850 | + |
4851 | dev->cur_std = V4L2_STD_525_60; |
4852 | dev->width = 720; |
4853 | dev->height = 480; |
4854 | diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c |
4855 | index 4e1698f788187..ce717502ea4c3 100644 |
4856 | --- a/drivers/media/usb/stk1160/stk1160-core.c |
4857 | +++ b/drivers/media/usb/stk1160/stk1160-core.c |
4858 | @@ -403,7 +403,7 @@ static void stk1160_disconnect(struct usb_interface *interface) |
4859 | /* Here is the only place where isoc get released */ |
4860 | stk1160_uninit_isoc(dev); |
4861 | |
4862 | - stk1160_clear_queue(dev); |
4863 | + stk1160_clear_queue(dev, VB2_BUF_STATE_ERROR); |
4864 | |
4865 | video_unregister_device(&dev->vdev); |
4866 | v4l2_device_disconnect(&dev->v4l2_dev); |
4867 | diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c |
4868 | index bcd14c66e8dfa..a307807571ab9 100644 |
4869 | --- a/drivers/media/usb/stk1160/stk1160-v4l.c |
4870 | +++ b/drivers/media/usb/stk1160/stk1160-v4l.c |
4871 | @@ -258,7 +258,7 @@ out_uninit: |
4872 | stk1160_uninit_isoc(dev); |
4873 | out_stop_hw: |
4874 | usb_set_interface(dev->udev, 0, 0); |
4875 | - stk1160_clear_queue(dev); |
4876 | + stk1160_clear_queue(dev, VB2_BUF_STATE_QUEUED); |
4877 | |
4878 | mutex_unlock(&dev->v4l_lock); |
4879 | |
4880 | @@ -306,7 +306,7 @@ static int stk1160_stop_streaming(struct stk1160 *dev) |
4881 | |
4882 | stk1160_stop_hw(dev); |
4883 | |
4884 | - stk1160_clear_queue(dev); |
4885 | + stk1160_clear_queue(dev, VB2_BUF_STATE_ERROR); |
4886 | |
4887 | stk1160_dbg("streaming stopped\n"); |
4888 | |
4889 | @@ -745,7 +745,7 @@ static const struct video_device v4l_template = { |
4890 | /********************************************************************/ |
4891 | |
4892 | /* Must be called with both v4l_lock and vb_queue_lock hold */ |
4893 | -void stk1160_clear_queue(struct stk1160 *dev) |
4894 | +void stk1160_clear_queue(struct stk1160 *dev, enum vb2_buffer_state vb2_state) |
4895 | { |
4896 | struct stk1160_buffer *buf; |
4897 | unsigned long flags; |
4898 | @@ -756,7 +756,7 @@ void stk1160_clear_queue(struct stk1160 *dev) |
4899 | buf = list_first_entry(&dev->avail_bufs, |
4900 | struct stk1160_buffer, list); |
4901 | list_del(&buf->list); |
4902 | - vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
4903 | + vb2_buffer_done(&buf->vb.vb2_buf, vb2_state); |
4904 | stk1160_dbg("buffer [%p/%d] aborted\n", |
4905 | buf, buf->vb.vb2_buf.index); |
4906 | } |
4907 | @@ -766,7 +766,7 @@ void stk1160_clear_queue(struct stk1160 *dev) |
4908 | buf = dev->isoc_ctl.buf; |
4909 | dev->isoc_ctl.buf = NULL; |
4910 | |
4911 | - vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
4912 | + vb2_buffer_done(&buf->vb.vb2_buf, vb2_state); |
4913 | stk1160_dbg("buffer [%p/%d] aborted\n", |
4914 | buf, buf->vb.vb2_buf.index); |
4915 | } |
4916 | diff --git a/drivers/media/usb/stk1160/stk1160.h b/drivers/media/usb/stk1160/stk1160.h |
4917 | index a31ea1c80f255..a70963ce87533 100644 |
4918 | --- a/drivers/media/usb/stk1160/stk1160.h |
4919 | +++ b/drivers/media/usb/stk1160/stk1160.h |
4920 | @@ -166,7 +166,7 @@ struct regval { |
4921 | int stk1160_vb2_setup(struct stk1160 *dev); |
4922 | int stk1160_video_register(struct stk1160 *dev); |
4923 | void stk1160_video_unregister(struct stk1160 *dev); |
4924 | -void stk1160_clear_queue(struct stk1160 *dev); |
4925 | +void stk1160_clear_queue(struct stk1160 *dev, enum vb2_buffer_state vb2_state); |
4926 | |
4927 | /* Provided by stk1160-video.c */ |
4928 | int stk1160_alloc_isoc(struct stk1160 *dev); |
4929 | diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c |
4930 | index af296b6fcbbdc..9c4c668f9a88a 100644 |
4931 | --- a/drivers/memory/emif.c |
4932 | +++ b/drivers/memory/emif.c |
4933 | @@ -1423,7 +1423,7 @@ static struct emif_data *__init_or_module get_device_details( |
4934 | temp = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); |
4935 | dev_info = devm_kzalloc(dev, sizeof(*dev_info), GFP_KERNEL); |
4936 | |
4937 | - if (!emif || !pd || !dev_info) { |
4938 | + if (!emif || !temp || !dev_info) { |
4939 | dev_err(dev, "%s:%d: allocation error\n", __func__, __LINE__); |
4940 | goto error; |
4941 | } |
4942 | @@ -1515,7 +1515,7 @@ static int __init_or_module emif_probe(struct platform_device *pdev) |
4943 | { |
4944 | struct emif_data *emif; |
4945 | struct resource *res; |
4946 | - int irq; |
4947 | + int irq, ret; |
4948 | |
4949 | if (pdev->dev.of_node) |
4950 | emif = of_get_memory_device_details(pdev->dev.of_node, &pdev->dev); |
4951 | @@ -1549,7 +1549,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev) |
4952 | emif_onetime_settings(emif); |
4953 | emif_debugfs_init(emif); |
4954 | disable_and_clear_all_interrupts(emif); |
4955 | - setup_interrupts(emif, irq); |
4956 | + ret = setup_interrupts(emif, irq); |
4957 | + if (ret) |
4958 | + goto error; |
4959 | |
4960 | /* One-time actions taken on probing the first device */ |
4961 | if (!emif1) { |
4962 | diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c |
4963 | index a6bd2134cea2a..14e4bbe6a9da3 100644 |
4964 | --- a/drivers/mfd/asic3.c |
4965 | +++ b/drivers/mfd/asic3.c |
4966 | @@ -914,14 +914,14 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, |
4967 | ret = mfd_add_devices(&pdev->dev, pdev->id, |
4968 | &asic3_cell_ds1wm, 1, mem, asic->irq_base, NULL); |
4969 | if (ret < 0) |
4970 | - goto out; |
4971 | + goto out_unmap; |
4972 | } |
4973 | |
4974 | if (mem_sdio && (irq >= 0)) { |
4975 | ret = mfd_add_devices(&pdev->dev, pdev->id, |
4976 | &asic3_cell_mmc, 1, mem_sdio, irq, NULL); |
4977 | if (ret < 0) |
4978 | - goto out; |
4979 | + goto out_unmap; |
4980 | } |
4981 | |
4982 | ret = 0; |
4983 | @@ -935,8 +935,12 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, |
4984 | ret = mfd_add_devices(&pdev->dev, 0, |
4985 | asic3_cell_leds, ASIC3_NUM_LEDS, NULL, 0, NULL); |
4986 | } |
4987 | + return ret; |
4988 | |
4989 | - out: |
4990 | +out_unmap: |
4991 | + if (asic->tmio_cnf) |
4992 | + iounmap(asic->tmio_cnf); |
4993 | +out: |
4994 | return ret; |
4995 | } |
4996 | |
4997 | diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c |
4998 | index 1abe7432aad82..e281a9202f110 100644 |
4999 | --- a/drivers/mfd/mc13xxx-core.c |
5000 | +++ b/drivers/mfd/mc13xxx-core.c |
5001 | @@ -323,8 +323,10 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, |
5002 | adc1 |= MC13783_ADC1_ATOX; |
5003 | |
5004 | dev_dbg(mc13xxx->dev, "%s: request irq\n", __func__); |
5005 | - mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_ADCDONE, |
5006 | + ret = mc13xxx_irq_request(mc13xxx, MC13XXX_IRQ_ADCDONE, |
5007 | mc13xxx_handler_adcdone, __func__, &adcdone_data); |
5008 | + if (ret) |
5009 | + goto out; |
5010 | |
5011 | mc13xxx_reg_write(mc13xxx, MC13XXX_ADC0, adc0); |
5012 | mc13xxx_reg_write(mc13xxx, MC13XXX_ADC1, adc1); |
5013 | diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c |
5014 | index 1fadb95b85b09..ba5d5c102b3cc 100644 |
5015 | --- a/drivers/misc/cardreader/alcor_pci.c |
5016 | +++ b/drivers/misc/cardreader/alcor_pci.c |
5017 | @@ -260,7 +260,7 @@ static int alcor_pci_probe(struct pci_dev *pdev, |
5018 | if (!priv) |
5019 | return -ENOMEM; |
5020 | |
5021 | - ret = ida_simple_get(&alcor_pci_idr, 0, 0, GFP_KERNEL); |
5022 | + ret = ida_alloc(&alcor_pci_idr, GFP_KERNEL); |
5023 | if (ret < 0) |
5024 | return ret; |
5025 | priv->id = ret; |
5026 | @@ -274,7 +274,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, |
5027 | ret = pci_request_regions(pdev, DRV_NAME_ALCOR_PCI); |
5028 | if (ret) { |
5029 | dev_err(&pdev->dev, "Cannot request region\n"); |
5030 | - return -ENOMEM; |
5031 | + ret = -ENOMEM; |
5032 | + goto error_free_ida; |
5033 | } |
5034 | |
5035 | if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { |
5036 | @@ -318,6 +319,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, |
5037 | |
5038 | error_release_regions: |
5039 | pci_release_regions(pdev); |
5040 | +error_free_ida: |
5041 | + ida_free(&alcor_pci_idr, priv->id); |
5042 | return ret; |
5043 | } |
5044 | |
5045 | @@ -331,7 +334,7 @@ static void alcor_pci_remove(struct pci_dev *pdev) |
5046 | |
5047 | mfd_remove_devices(&pdev->dev); |
5048 | |
5049 | - ida_simple_remove(&alcor_pci_idr, priv->id); |
5050 | + ida_free(&alcor_pci_idr, priv->id); |
5051 | |
5052 | pci_release_regions(pdev); |
5053 | pci_set_drvdata(pdev, NULL); |
5054 | diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c |
5055 | index 8d18f19c99c4b..2f88581057335 100644 |
5056 | --- a/drivers/misc/kgdbts.c |
5057 | +++ b/drivers/misc/kgdbts.c |
5058 | @@ -1060,10 +1060,10 @@ static int kgdbts_option_setup(char *opt) |
5059 | { |
5060 | if (strlen(opt) >= MAX_CONFIG_LEN) { |
5061 | printk(KERN_ERR "kgdbts: config string too long\n"); |
5062 | - return -ENOSPC; |
5063 | + return 1; |
5064 | } |
5065 | strcpy(config, opt); |
5066 | - return 0; |
5067 | + return 1; |
5068 | } |
5069 | |
5070 | __setup("kgdbts=", kgdbts_option_setup); |
5071 | diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c |
5072 | index e955f1ef25643..32801639e0be5 100644 |
5073 | --- a/drivers/mmc/core/host.c |
5074 | +++ b/drivers/mmc/core/host.c |
5075 | @@ -497,6 +497,16 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) |
5076 | |
5077 | EXPORT_SYMBOL(mmc_alloc_host); |
5078 | |
5079 | +static int mmc_validate_host_caps(struct mmc_host *host) |
5080 | +{ |
5081 | + if (host->caps & MMC_CAP_SDIO_IRQ && !host->ops->enable_sdio_irq) { |
5082 | + dev_warn(host->parent, "missing ->enable_sdio_irq() ops\n"); |
5083 | + return -EINVAL; |
5084 | + } |
5085 | + |
5086 | + return 0; |
5087 | +} |
5088 | + |
5089 | /** |
5090 | * mmc_add_host - initialise host hardware |
5091 | * @host: mmc host |
5092 | @@ -509,8 +519,9 @@ int mmc_add_host(struct mmc_host *host) |
5093 | { |
5094 | int err; |
5095 | |
5096 | - WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && |
5097 | - !host->ops->enable_sdio_irq); |
5098 | + err = mmc_validate_host_caps(host); |
5099 | + if (err) |
5100 | + return err; |
5101 | |
5102 | err = device_add(&host->class_dev); |
5103 | if (err) |
5104 | diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c |
5105 | index ebfaeb33bc8c0..ade7c022a33c0 100644 |
5106 | --- a/drivers/mmc/host/davinci_mmc.c |
5107 | +++ b/drivers/mmc/host/davinci_mmc.c |
5108 | @@ -1376,8 +1376,12 @@ static int davinci_mmcsd_suspend(struct device *dev) |
5109 | static int davinci_mmcsd_resume(struct device *dev) |
5110 | { |
5111 | struct mmc_davinci_host *host = dev_get_drvdata(dev); |
5112 | + int ret; |
5113 | + |
5114 | + ret = clk_enable(host->clk); |
5115 | + if (ret) |
5116 | + return ret; |
5117 | |
5118 | - clk_enable(host->clk); |
5119 | mmc_davinci_reset_ctrl(host, 0); |
5120 | |
5121 | return 0; |
5122 | diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c |
5123 | index 0953bd8a4f79d..3bb59d670220f 100644 |
5124 | --- a/drivers/mmc/host/mmci_stm32_sdmmc.c |
5125 | +++ b/drivers/mmc/host/mmci_stm32_sdmmc.c |
5126 | @@ -36,8 +36,8 @@ int sdmmc_idma_validate_data(struct mmci_host *host, |
5127 | * excepted the last element which has no constraint on idmasize |
5128 | */ |
5129 | for_each_sg(data->sg, sg, data->sg_len - 1, i) { |
5130 | - if (!IS_ALIGNED(sg_dma_address(data->sg), sizeof(u32)) || |
5131 | - !IS_ALIGNED(sg_dma_len(data->sg), SDMMC_IDMA_BURST)) { |
5132 | + if (!IS_ALIGNED(sg->offset, sizeof(u32)) || |
5133 | + !IS_ALIGNED(sg->length, SDMMC_IDMA_BURST)) { |
5134 | dev_err(mmc_dev(host->mmc), |
5135 | "unaligned scatterlist: ofst:%x length:%d\n", |
5136 | data->sg->offset, data->sg->length); |
5137 | @@ -45,7 +45,7 @@ int sdmmc_idma_validate_data(struct mmci_host *host, |
5138 | } |
5139 | } |
5140 | |
5141 | - if (!IS_ALIGNED(sg_dma_address(data->sg), sizeof(u32))) { |
5142 | + if (!IS_ALIGNED(sg->offset, sizeof(u32))) { |
5143 | dev_err(mmc_dev(host->mmc), |
5144 | "unaligned last scatterlist: ofst:%x length:%d\n", |
5145 | data->sg->offset, data->sg->length); |
5146 | diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c |
5147 | index 689eb119d44fc..23fd93407eced 100644 |
5148 | --- a/drivers/mmc/host/renesas_sdhi_core.c |
5149 | +++ b/drivers/mmc/host/renesas_sdhi_core.c |
5150 | @@ -349,10 +349,10 @@ static void renesas_sdhi_hs400_complete(struct tmio_mmc_host *host) |
5151 | SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) | |
5152 | sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2)); |
5153 | |
5154 | - /* Set the sampling clock selection range of HS400 mode */ |
5155 | sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DTCNTL, |
5156 | SH_MOBILE_SDHI_SCC_DTCNTL_TAPEN | |
5157 | - 0x4 << SH_MOBILE_SDHI_SCC_DTCNTL_TAPNUM_SHIFT); |
5158 | + sd_scc_read32(host, priv, |
5159 | + SH_MOBILE_SDHI_SCC_DTCNTL)); |
5160 | |
5161 | |
5162 | if (host->pdata->flags & TMIO_MMC_HAVE_4TAP_HS400) |
5163 | diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c |
5164 | index 5f57e78e5f13f..6f6fb4c4448f0 100644 |
5165 | --- a/drivers/mmc/host/sdhci-xenon.c |
5166 | +++ b/drivers/mmc/host/sdhci-xenon.c |
5167 | @@ -240,16 +240,6 @@ static void xenon_voltage_switch(struct sdhci_host *host) |
5168 | { |
5169 | /* Wait for 5ms after set 1.8V signal enable bit */ |
5170 | usleep_range(5000, 5500); |
5171 | - |
5172 | - /* |
5173 | - * For some reason the controller's Host Control2 register reports |
5174 | - * the bit representing 1.8V signaling as 0 when read after it was |
5175 | - * written as 1. Subsequent read reports 1. |
5176 | - * |
5177 | - * Since this may cause some issues, do an empty read of the Host |
5178 | - * Control2 register here to circumvent this. |
5179 | - */ |
5180 | - sdhci_readw(host, SDHCI_HOST_CONTROL2); |
5181 | } |
5182 | |
5183 | static const struct sdhci_ops sdhci_xenon_ops = { |
5184 | diff --git a/drivers/mtd/nand/onenand/generic.c b/drivers/mtd/nand/onenand/generic.c |
5185 | index 8b6f4da5d7201..a4b8b65fe15f5 100644 |
5186 | --- a/drivers/mtd/nand/onenand/generic.c |
5187 | +++ b/drivers/mtd/nand/onenand/generic.c |
5188 | @@ -53,7 +53,12 @@ static int generic_onenand_probe(struct platform_device *pdev) |
5189 | } |
5190 | |
5191 | info->onenand.mmcontrol = pdata ? pdata->mmcontrol : NULL; |
5192 | - info->onenand.irq = platform_get_irq(pdev, 0); |
5193 | + |
5194 | + err = platform_get_irq(pdev, 0); |
5195 | + if (err < 0) |
5196 | + goto out_iounmap; |
5197 | + |
5198 | + info->onenand.irq = err; |
5199 | |
5200 | info->mtd.dev.parent = &pdev->dev; |
5201 | info->mtd.priv = &info->onenand; |
5202 | diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c |
5203 | index 23d11e8b56441..17c751f359d3d 100644 |
5204 | --- a/drivers/mtd/nand/raw/atmel/nand-controller.c |
5205 | +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c |
5206 | @@ -2004,13 +2004,15 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, |
5207 | nc->mck = of_clk_get(dev->parent->of_node, 0); |
5208 | if (IS_ERR(nc->mck)) { |
5209 | dev_err(dev, "Failed to retrieve MCK clk\n"); |
5210 | - return PTR_ERR(nc->mck); |
5211 | + ret = PTR_ERR(nc->mck); |
5212 | + goto out_release_dma; |
5213 | } |
5214 | |
5215 | np = of_parse_phandle(dev->parent->of_node, "atmel,smc", 0); |
5216 | if (!np) { |
5217 | dev_err(dev, "Missing or invalid atmel,smc property\n"); |
5218 | - return -EINVAL; |
5219 | + ret = -EINVAL; |
5220 | + goto out_release_dma; |
5221 | } |
5222 | |
5223 | nc->smc = syscon_node_to_regmap(np); |
5224 | @@ -2018,10 +2020,16 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, |
5225 | if (IS_ERR(nc->smc)) { |
5226 | ret = PTR_ERR(nc->smc); |
5227 | dev_err(dev, "Could not get SMC regmap (err = %d)\n", ret); |
5228 | - return ret; |
5229 | + goto out_release_dma; |
5230 | } |
5231 | |
5232 | return 0; |
5233 | + |
5234 | +out_release_dma: |
5235 | + if (nc->dmac) |
5236 | + dma_release_channel(nc->dmac); |
5237 | + |
5238 | + return ret; |
5239 | } |
5240 | |
5241 | static int |
5242 | diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5243 | index ab2f824abf549..02218c3b548f9 100644 |
5244 | --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5245 | +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
5246 | @@ -645,6 +645,7 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, |
5247 | const struct nand_sdr_timings *sdr) |
5248 | { |
5249 | struct gpmi_nfc_hardware_timing *hw = &this->hw; |
5250 | + struct resources *r = &this->resources; |
5251 | unsigned int dll_threshold_ps = this->devdata->max_chain_delay; |
5252 | unsigned int period_ps, reference_period_ps; |
5253 | unsigned int data_setup_cycles, data_hold_cycles, addr_setup_cycles; |
5254 | @@ -668,6 +669,8 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, |
5255 | wrn_dly_sel = BV_GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY; |
5256 | } |
5257 | |
5258 | + hw->clk_rate = clk_round_rate(r->clock[0], hw->clk_rate); |
5259 | + |
5260 | /* SDR core timings are given in picoseconds */ |
5261 | period_ps = div_u64((u64)NSEC_PER_SEC * 1000, hw->clk_rate); |
5262 | |
5263 | diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c |
5264 | index d636bbe214cb9..df521ff0b3280 100644 |
5265 | --- a/drivers/mtd/ubi/build.c |
5266 | +++ b/drivers/mtd/ubi/build.c |
5267 | @@ -350,9 +350,6 @@ static ssize_t dev_attribute_show(struct device *dev, |
5268 | * we still can use 'ubi->ubi_num'. |
5269 | */ |
5270 | ubi = container_of(dev, struct ubi_device, dev); |
5271 | - ubi = ubi_get_device(ubi->ubi_num); |
5272 | - if (!ubi) |
5273 | - return -ENODEV; |
5274 | |
5275 | if (attr == &dev_eraseblock_size) |
5276 | ret = sprintf(buf, "%d\n", ubi->leb_size); |
5277 | @@ -381,7 +378,6 @@ static ssize_t dev_attribute_show(struct device *dev, |
5278 | else |
5279 | ret = -EINVAL; |
5280 | |
5281 | - ubi_put_device(ubi); |
5282 | return ret; |
5283 | } |
5284 | |
5285 | @@ -956,9 +952,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
5286 | goto out_detach; |
5287 | } |
5288 | |
5289 | - /* Make device "available" before it becomes accessible via sysfs */ |
5290 | - ubi_devices[ubi_num] = ubi; |
5291 | - |
5292 | err = uif_init(ubi); |
5293 | if (err) |
5294 | goto out_detach; |
5295 | @@ -1003,6 +996,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, |
5296 | wake_up_process(ubi->bgt_thread); |
5297 | spin_unlock(&ubi->wl_lock); |
5298 | |
5299 | + ubi_devices[ubi_num] = ubi; |
5300 | ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL); |
5301 | return ubi_num; |
5302 | |
5303 | @@ -1011,7 +1005,6 @@ out_debugfs: |
5304 | out_uif: |
5305 | uif_close(ubi); |
5306 | out_detach: |
5307 | - ubi_devices[ubi_num] = NULL; |
5308 | ubi_wl_close(ubi); |
5309 | ubi_free_internal_volumes(ubi); |
5310 | vfree(ubi->vtbl); |
5311 | diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c |
5312 | index 53f448e7433a9..6e95c4b1473e6 100644 |
5313 | --- a/drivers/mtd/ubi/fastmap.c |
5314 | +++ b/drivers/mtd/ubi/fastmap.c |
5315 | @@ -468,7 +468,9 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai, |
5316 | if (err == UBI_IO_FF_BITFLIPS) |
5317 | scrub = 1; |
5318 | |
5319 | - add_aeb(ai, free, pnum, ec, scrub); |
5320 | + ret = add_aeb(ai, free, pnum, ec, scrub); |
5321 | + if (ret) |
5322 | + goto out; |
5323 | continue; |
5324 | } else if (err == 0 || err == UBI_IO_BITFLIPS) { |
5325 | dbg_bld("Found non empty PEB:%i in pool", pnum); |
5326 | @@ -638,8 +640,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
5327 | if (fm_pos >= fm_size) |
5328 | goto fail_bad; |
5329 | |
5330 | - add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum), |
5331 | - be32_to_cpu(fmec->ec), 0); |
5332 | + ret = add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum), |
5333 | + be32_to_cpu(fmec->ec), 0); |
5334 | + if (ret) |
5335 | + goto fail; |
5336 | } |
5337 | |
5338 | /* read EC values from used list */ |
5339 | @@ -649,8 +653,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
5340 | if (fm_pos >= fm_size) |
5341 | goto fail_bad; |
5342 | |
5343 | - add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
5344 | - be32_to_cpu(fmec->ec), 0); |
5345 | + ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
5346 | + be32_to_cpu(fmec->ec), 0); |
5347 | + if (ret) |
5348 | + goto fail; |
5349 | } |
5350 | |
5351 | /* read EC values from scrub list */ |
5352 | @@ -660,8 +666,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
5353 | if (fm_pos >= fm_size) |
5354 | goto fail_bad; |
5355 | |
5356 | - add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
5357 | - be32_to_cpu(fmec->ec), 1); |
5358 | + ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum), |
5359 | + be32_to_cpu(fmec->ec), 1); |
5360 | + if (ret) |
5361 | + goto fail; |
5362 | } |
5363 | |
5364 | /* read EC values from erase list */ |
5365 | @@ -671,8 +679,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, |
5366 | if (fm_pos >= fm_size) |
5367 | goto fail_bad; |
5368 | |
5369 | - add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum), |
5370 | - be32_to_cpu(fmec->ec), 1); |
5371 | + ret = add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum), |
5372 | + be32_to_cpu(fmec->ec), 1); |
5373 | + if (ret) |
5374 | + goto fail; |
5375 | } |
5376 | |
5377 | ai->mean_ec = div_u64(ai->ec_sum, ai->ec_count); |
5378 | diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c |
5379 | index 139ee132bfbcf..1bc7b3a056046 100644 |
5380 | --- a/drivers/mtd/ubi/vmt.c |
5381 | +++ b/drivers/mtd/ubi/vmt.c |
5382 | @@ -56,16 +56,11 @@ static ssize_t vol_attribute_show(struct device *dev, |
5383 | { |
5384 | int ret; |
5385 | struct ubi_volume *vol = container_of(dev, struct ubi_volume, dev); |
5386 | - struct ubi_device *ubi; |
5387 | - |
5388 | - ubi = ubi_get_device(vol->ubi->ubi_num); |
5389 | - if (!ubi) |
5390 | - return -ENODEV; |
5391 | + struct ubi_device *ubi = vol->ubi; |
5392 | |
5393 | spin_lock(&ubi->volumes_lock); |
5394 | if (!ubi->volumes[vol->vol_id]) { |
5395 | spin_unlock(&ubi->volumes_lock); |
5396 | - ubi_put_device(ubi); |
5397 | return -ENODEV; |
5398 | } |
5399 | /* Take a reference to prevent volume removal */ |
5400 | @@ -103,7 +98,6 @@ static ssize_t vol_attribute_show(struct device *dev, |
5401 | vol->ref_count -= 1; |
5402 | ubi_assert(vol->ref_count >= 0); |
5403 | spin_unlock(&ubi->volumes_lock); |
5404 | - ubi_put_device(ubi); |
5405 | return ret; |
5406 | } |
5407 | |
5408 | diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c |
5409 | index 249d2fba28c7f..6458da9c13b95 100644 |
5410 | --- a/drivers/net/can/usb/ems_usb.c |
5411 | +++ b/drivers/net/can/usb/ems_usb.c |
5412 | @@ -823,7 +823,6 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne |
5413 | |
5414 | usb_unanchor_urb(urb); |
5415 | usb_free_coherent(dev->udev, size, buf, urb->transfer_dma); |
5416 | - dev_kfree_skb(skb); |
5417 | |
5418 | atomic_dec(&dev->active_tx_urbs); |
5419 | |
5420 | diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c |
5421 | index 41eee6f0491c6..957e51a77d4d1 100644 |
5422 | --- a/drivers/net/can/usb/mcba_usb.c |
5423 | +++ b/drivers/net/can/usb/mcba_usb.c |
5424 | @@ -33,10 +33,6 @@ |
5425 | #define MCBA_USB_RX_BUFF_SIZE 64 |
5426 | #define MCBA_USB_TX_BUFF_SIZE (sizeof(struct mcba_usb_msg)) |
5427 | |
5428 | -/* MCBA endpoint numbers */ |
5429 | -#define MCBA_USB_EP_IN 1 |
5430 | -#define MCBA_USB_EP_OUT 1 |
5431 | - |
5432 | /* Microchip command id */ |
5433 | #define MBCA_CMD_RECEIVE_MESSAGE 0xE3 |
5434 | #define MBCA_CMD_I_AM_ALIVE_FROM_CAN 0xF5 |
5435 | @@ -84,6 +80,8 @@ struct mcba_priv { |
5436 | atomic_t free_ctx_cnt; |
5437 | void *rxbuf[MCBA_MAX_RX_URBS]; |
5438 | dma_addr_t rxbuf_dma[MCBA_MAX_RX_URBS]; |
5439 | + int rx_pipe; |
5440 | + int tx_pipe; |
5441 | }; |
5442 | |
5443 | /* CAN frame */ |
5444 | @@ -272,10 +270,8 @@ static netdev_tx_t mcba_usb_xmit(struct mcba_priv *priv, |
5445 | |
5446 | memcpy(buf, usb_msg, MCBA_USB_TX_BUFF_SIZE); |
5447 | |
5448 | - usb_fill_bulk_urb(urb, priv->udev, |
5449 | - usb_sndbulkpipe(priv->udev, MCBA_USB_EP_OUT), buf, |
5450 | - MCBA_USB_TX_BUFF_SIZE, mcba_usb_write_bulk_callback, |
5451 | - ctx); |
5452 | + usb_fill_bulk_urb(urb, priv->udev, priv->tx_pipe, buf, MCBA_USB_TX_BUFF_SIZE, |
5453 | + mcba_usb_write_bulk_callback, ctx); |
5454 | |
5455 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
5456 | usb_anchor_urb(urb, &priv->tx_submitted); |
5457 | @@ -368,7 +364,6 @@ static netdev_tx_t mcba_usb_start_xmit(struct sk_buff *skb, |
5458 | xmit_failed: |
5459 | can_free_echo_skb(priv->netdev, ctx->ndx); |
5460 | mcba_usb_free_ctx(ctx); |
5461 | - dev_kfree_skb(skb); |
5462 | stats->tx_dropped++; |
5463 | |
5464 | return NETDEV_TX_OK; |
5465 | @@ -611,7 +606,7 @@ static void mcba_usb_read_bulk_callback(struct urb *urb) |
5466 | resubmit_urb: |
5467 | |
5468 | usb_fill_bulk_urb(urb, priv->udev, |
5469 | - usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_OUT), |
5470 | + priv->rx_pipe, |
5471 | urb->transfer_buffer, MCBA_USB_RX_BUFF_SIZE, |
5472 | mcba_usb_read_bulk_callback, priv); |
5473 | |
5474 | @@ -656,7 +651,7 @@ static int mcba_usb_start(struct mcba_priv *priv) |
5475 | urb->transfer_dma = buf_dma; |
5476 | |
5477 | usb_fill_bulk_urb(urb, priv->udev, |
5478 | - usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_IN), |
5479 | + priv->rx_pipe, |
5480 | buf, MCBA_USB_RX_BUFF_SIZE, |
5481 | mcba_usb_read_bulk_callback, priv); |
5482 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
5483 | @@ -810,6 +805,13 @@ static int mcba_usb_probe(struct usb_interface *intf, |
5484 | struct mcba_priv *priv; |
5485 | int err = -ENOMEM; |
5486 | struct usb_device *usbdev = interface_to_usbdev(intf); |
5487 | + struct usb_endpoint_descriptor *in, *out; |
5488 | + |
5489 | + err = usb_find_common_endpoints(intf->cur_altsetting, &in, &out, NULL, NULL); |
5490 | + if (err) { |
5491 | + dev_err(&intf->dev, "Can't find endpoints\n"); |
5492 | + return err; |
5493 | + } |
5494 | |
5495 | netdev = alloc_candev(sizeof(struct mcba_priv), MCBA_MAX_TX_URBS); |
5496 | if (!netdev) { |
5497 | @@ -855,6 +857,9 @@ static int mcba_usb_probe(struct usb_interface *intf, |
5498 | goto cleanup_free_candev; |
5499 | } |
5500 | |
5501 | + priv->rx_pipe = usb_rcvbulkpipe(priv->udev, in->bEndpointAddress); |
5502 | + priv->tx_pipe = usb_sndbulkpipe(priv->udev, out->bEndpointAddress); |
5503 | + |
5504 | devm_can_led_init(netdev); |
5505 | |
5506 | /* Start USB dev only if we have successfully registered CAN device */ |
5507 | diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c |
5508 | index 7000c6cd1e48b..282c53ef76d23 100644 |
5509 | --- a/drivers/net/can/vxcan.c |
5510 | +++ b/drivers/net/can/vxcan.c |
5511 | @@ -148,7 +148,7 @@ static void vxcan_setup(struct net_device *dev) |
5512 | dev->hard_header_len = 0; |
5513 | dev->addr_len = 0; |
5514 | dev->tx_queue_len = 0; |
5515 | - dev->flags = (IFF_NOARP|IFF_ECHO); |
5516 | + dev->flags = IFF_NOARP; |
5517 | dev->netdev_ops = &vxcan_netdev_ops; |
5518 | dev->needs_free_netdev = true; |
5519 | |
5520 | diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c |
5521 | index e15d18bb981e9..5cc31118b97e9 100644 |
5522 | --- a/drivers/net/dsa/bcm_sf2_cfp.c |
5523 | +++ b/drivers/net/dsa/bcm_sf2_cfp.c |
5524 | @@ -542,14 +542,14 @@ static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv, |
5525 | static struct cfp_rule *bcm_sf2_cfp_rule_find(struct bcm_sf2_priv *priv, |
5526 | int port, u32 location) |
5527 | { |
5528 | - struct cfp_rule *rule = NULL; |
5529 | + struct cfp_rule *rule; |
5530 | |
5531 | list_for_each_entry(rule, &priv->cfp.rules_list, next) { |
5532 | if (rule->port == port && rule->fs.location == location) |
5533 | - break; |
5534 | + return rule; |
5535 | } |
5536 | |
5537 | - return rule; |
5538 | + return NULL; |
5539 | } |
5540 | |
5541 | static int bcm_sf2_cfp_rule_cmp(struct bcm_sf2_priv *priv, int port, |
5542 | diff --git a/drivers/net/dsa/microchip/ksz8795_spi.c b/drivers/net/dsa/microchip/ksz8795_spi.c |
5543 | index 8b00f8e6c02f4..5639c5c59e255 100644 |
5544 | --- a/drivers/net/dsa/microchip/ksz8795_spi.c |
5545 | +++ b/drivers/net/dsa/microchip/ksz8795_spi.c |
5546 | @@ -86,12 +86,23 @@ static const struct of_device_id ksz8795_dt_ids[] = { |
5547 | }; |
5548 | MODULE_DEVICE_TABLE(of, ksz8795_dt_ids); |
5549 | |
5550 | +static const struct spi_device_id ksz8795_spi_ids[] = { |
5551 | + { "ksz8765" }, |
5552 | + { "ksz8794" }, |
5553 | + { "ksz8795" }, |
5554 | + { "ksz8863" }, |
5555 | + { "ksz8873" }, |
5556 | + { }, |
5557 | +}; |
5558 | +MODULE_DEVICE_TABLE(spi, ksz8795_spi_ids); |
5559 | + |
5560 | static struct spi_driver ksz8795_spi_driver = { |
5561 | .driver = { |
5562 | .name = "ksz8795-switch", |
5563 | .owner = THIS_MODULE, |
5564 | .of_match_table = of_match_ptr(ksz8795_dt_ids), |
5565 | }, |
5566 | + .id_table = ksz8795_spi_ids, |
5567 | .probe = ksz8795_spi_probe, |
5568 | .remove = ksz8795_spi_remove, |
5569 | .shutdown = ksz8795_spi_shutdown, |
5570 | diff --git a/drivers/net/dsa/microchip/ksz9477_spi.c b/drivers/net/dsa/microchip/ksz9477_spi.c |
5571 | index 1142768969c20..9bda83d063e8e 100644 |
5572 | --- a/drivers/net/dsa/microchip/ksz9477_spi.c |
5573 | +++ b/drivers/net/dsa/microchip/ksz9477_spi.c |
5574 | @@ -88,12 +88,24 @@ static const struct of_device_id ksz9477_dt_ids[] = { |
5575 | }; |
5576 | MODULE_DEVICE_TABLE(of, ksz9477_dt_ids); |
5577 | |
5578 | +static const struct spi_device_id ksz9477_spi_ids[] = { |
5579 | + { "ksz9477" }, |
5580 | + { "ksz9897" }, |
5581 | + { "ksz9893" }, |
5582 | + { "ksz9563" }, |
5583 | + { "ksz8563" }, |
5584 | + { "ksz9567" }, |
5585 | + { }, |
5586 | +}; |
5587 | +MODULE_DEVICE_TABLE(spi, ksz9477_spi_ids); |
5588 | + |
5589 | static struct spi_driver ksz9477_spi_driver = { |
5590 | .driver = { |
5591 | .name = "ksz9477-switch", |
5592 | .owner = THIS_MODULE, |
5593 | .of_match_table = of_match_ptr(ksz9477_dt_ids), |
5594 | }, |
5595 | + .id_table = ksz9477_spi_ids, |
5596 | .probe = ksz9477_spi_probe, |
5597 | .remove = ksz9477_spi_remove, |
5598 | .shutdown = ksz9477_spi_shutdown, |
5599 | diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
5600 | index 40b105daaf9e7..87d28ef82559e 100644 |
5601 | --- a/drivers/net/dsa/mv88e6xxx/chip.c |
5602 | +++ b/drivers/net/dsa/mv88e6xxx/chip.c |
5603 | @@ -3062,6 +3062,7 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { |
5604 | .port_set_duplex = mv88e6xxx_port_set_duplex, |
5605 | .port_set_speed = mv88e6185_port_set_speed, |
5606 | .port_tag_remap = mv88e6095_port_tag_remap, |
5607 | + .port_set_policy = mv88e6352_port_set_policy, |
5608 | .port_set_frame_mode = mv88e6351_port_set_frame_mode, |
5609 | .port_set_egress_floods = mv88e6352_port_set_egress_floods, |
5610 | .port_set_ether_type = mv88e6351_port_set_ether_type, |
5611 | diff --git a/drivers/net/ethernet/8390/mcf8390.c b/drivers/net/ethernet/8390/mcf8390.c |
5612 | index 4ad8031ab6695..065fdbe66c425 100644 |
5613 | --- a/drivers/net/ethernet/8390/mcf8390.c |
5614 | +++ b/drivers/net/ethernet/8390/mcf8390.c |
5615 | @@ -406,12 +406,12 @@ static int mcf8390_init(struct net_device *dev) |
5616 | static int mcf8390_probe(struct platform_device *pdev) |
5617 | { |
5618 | struct net_device *dev; |
5619 | - struct resource *mem, *irq; |
5620 | + struct resource *mem; |
5621 | resource_size_t msize; |
5622 | - int ret; |
5623 | + int ret, irq; |
5624 | |
5625 | - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
5626 | - if (irq == NULL) { |
5627 | + irq = platform_get_irq(pdev, 0); |
5628 | + if (irq < 0) { |
5629 | dev_err(&pdev->dev, "no IRQ specified?\n"); |
5630 | return -ENXIO; |
5631 | } |
5632 | @@ -434,7 +434,7 @@ static int mcf8390_probe(struct platform_device *pdev) |
5633 | SET_NETDEV_DEV(dev, &pdev->dev); |
5634 | platform_set_drvdata(pdev, dev); |
5635 | |
5636 | - dev->irq = irq->start; |
5637 | + dev->irq = irq; |
5638 | dev->base_addr = mem->start; |
5639 | |
5640 | ret = mcf8390_init(dev); |
5641 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
5642 | index 8ba369c0100b4..9e8a0c772ca93 100644 |
5643 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
5644 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
5645 | @@ -559,7 +559,8 @@ struct nqe_cn { |
5646 | #define BNXT_MAX_MTU 9500 |
5647 | #define BNXT_MAX_PAGE_MODE_MTU \ |
5648 | ((unsigned int)PAGE_SIZE - VLAN_ETH_HLEN - NET_IP_ALIGN - \ |
5649 | - XDP_PACKET_HEADROOM) |
5650 | + XDP_PACKET_HEADROOM - \ |
5651 | + SKB_DATA_ALIGN((unsigned int)sizeof(struct skb_shared_info))) |
5652 | |
5653 | #define BNXT_MIN_PKT_SIZE 52 |
5654 | |
5655 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
5656 | index 97aff84fd1d17..d74c6a34b936a 100644 |
5657 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
5658 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
5659 | @@ -1673,9 +1673,7 @@ static int bnxt_set_pauseparam(struct net_device *dev, |
5660 | } |
5661 | |
5662 | link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL; |
5663 | - if (bp->hwrm_spec_code >= 0x10201) |
5664 | - link_info->req_flow_ctrl = |
5665 | - PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE; |
5666 | + link_info->req_flow_ctrl = 0; |
5667 | } else { |
5668 | /* when transition from auto pause to force pause, |
5669 | * force a link change |
5670 | diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
5671 | index 6437fe6b9abf0..a6b8f573ab5b5 100644 |
5672 | --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
5673 | +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c |
5674 | @@ -148,7 +148,7 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev) |
5675 | base = of_iomap(node, 0); |
5676 | if (!base) { |
5677 | err = -ENOMEM; |
5678 | - goto err_close; |
5679 | + goto err_put; |
5680 | } |
5681 | |
5682 | err = fsl_mc_allocate_irqs(mc_dev); |
5683 | @@ -191,6 +191,8 @@ err_free_mc_irq: |
5684 | fsl_mc_free_irqs(mc_dev); |
5685 | err_unmap: |
5686 | iounmap(base); |
5687 | +err_put: |
5688 | + of_node_put(node); |
5689 | err_close: |
5690 | dprtc_close(mc_dev->mc_io, 0, mc_dev->mc_handle); |
5691 | err_free_mcp: |
5692 | diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
5693 | index 8ecfabaefa85b..d58abdfdb9b7b 100644 |
5694 | --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
5695 | +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
5696 | @@ -8344,11 +8344,11 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, |
5697 | } |
5698 | |
5699 | if (!ret) { |
5700 | - if (is_kill) |
5701 | - hclge_rm_vport_vlan_table(vport, vlan_id, false); |
5702 | - else |
5703 | + if (!is_kill) |
5704 | hclge_add_vport_vlan_table(vport, vlan_id, |
5705 | writen_to_tbl); |
5706 | + else if (is_kill && vlan_id != 0) |
5707 | + hclge_rm_vport_vlan_table(vport, vlan_id, false); |
5708 | } else if (is_kill) { |
5709 | /* when remove hw vlan filter failed, record the vlan id, |
5710 | * and try to remove it from hw later, to be consistence |
5711 | diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
5712 | index a9ad788c4913d..fd2da58c71401 100644 |
5713 | --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
5714 | +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c |
5715 | @@ -505,13 +505,11 @@ static struct sk_buff *i40e_construct_skb_zc(struct i40e_ring *rx_ring, |
5716 | struct sk_buff *skb; |
5717 | |
5718 | /* allocate a skb to store the frags */ |
5719 | - skb = __napi_alloc_skb(&rx_ring->q_vector->napi, |
5720 | - xdp->data_end - xdp->data_hard_start, |
5721 | + skb = __napi_alloc_skb(&rx_ring->q_vector->napi, datasize, |
5722 | GFP_ATOMIC | __GFP_NOWARN); |
5723 | if (unlikely(!skb)) |
5724 | return NULL; |
5725 | |
5726 | - skb_reserve(skb, xdp->data - xdp->data_hard_start); |
5727 | memcpy(__skb_put(skb, datasize), xdp->data, datasize); |
5728 | if (metasize) |
5729 | skb_metadata_set(skb, metasize); |
5730 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
5731 | index 5e8f8eb916e64..20f840ea05030 100644 |
5732 | --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
5733 | +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c |
5734 | @@ -3003,12 +3003,16 @@ static int qed_iov_pre_update_vport(struct qed_hwfn *hwfn, |
5735 | u8 mask = QED_ACCEPT_UCAST_UNMATCHED | QED_ACCEPT_MCAST_UNMATCHED; |
5736 | struct qed_filter_accept_flags *flags = ¶ms->accept_flags; |
5737 | struct qed_public_vf_info *vf_info; |
5738 | + u16 tlv_mask; |
5739 | + |
5740 | + tlv_mask = BIT(QED_IOV_VP_UPDATE_ACCEPT_PARAM) | |
5741 | + BIT(QED_IOV_VP_UPDATE_ACCEPT_ANY_VLAN); |
5742 | |
5743 | /* Untrusted VFs can't even be trusted to know that fact. |
5744 | * Simply indicate everything is configured fine, and trace |
5745 | * configuration 'behind their back'. |
5746 | */ |
5747 | - if (!(*tlvs & BIT(QED_IOV_VP_UPDATE_ACCEPT_PARAM))) |
5748 | + if (!(*tlvs & tlv_mask)) |
5749 | return 0; |
5750 | |
5751 | vf_info = qed_iov_get_public_vf_info(hwfn, vfid, true); |
5752 | @@ -3025,6 +3029,13 @@ static int qed_iov_pre_update_vport(struct qed_hwfn *hwfn, |
5753 | flags->tx_accept_filter &= ~mask; |
5754 | } |
5755 | |
5756 | + if (params->update_accept_any_vlan_flg) { |
5757 | + vf_info->accept_any_vlan = params->accept_any_vlan; |
5758 | + |
5759 | + if (vf_info->forced_vlan && !vf_info->is_trusted_configured) |
5760 | + params->accept_any_vlan = false; |
5761 | + } |
5762 | + |
5763 | return 0; |
5764 | } |
5765 | |
5766 | @@ -4717,6 +4728,7 @@ static int qed_get_vf_config(struct qed_dev *cdev, |
5767 | tx_rate = vf_info->tx_rate; |
5768 | ivi->max_tx_rate = tx_rate ? tx_rate : link.speed; |
5769 | ivi->min_tx_rate = qed_iov_get_vf_min_rate(hwfn, vf_id); |
5770 | + ivi->trusted = vf_info->is_trusted_request; |
5771 | |
5772 | return 0; |
5773 | } |
5774 | @@ -5147,6 +5159,12 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) |
5775 | |
5776 | params.update_ctl_frame_check = 1; |
5777 | params.mac_chk_en = !vf_info->is_trusted_configured; |
5778 | + params.update_accept_any_vlan_flg = 0; |
5779 | + |
5780 | + if (vf_info->accept_any_vlan && vf_info->forced_vlan) { |
5781 | + params.update_accept_any_vlan_flg = 1; |
5782 | + params.accept_any_vlan = vf_info->accept_any_vlan; |
5783 | + } |
5784 | |
5785 | if (vf_info->rx_accept_mode & mask) { |
5786 | flags->update_rx_mode_config = 1; |
5787 | @@ -5162,13 +5180,20 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) |
5788 | if (!vf_info->is_trusted_configured) { |
5789 | flags->rx_accept_filter &= ~mask; |
5790 | flags->tx_accept_filter &= ~mask; |
5791 | + params.accept_any_vlan = false; |
5792 | } |
5793 | |
5794 | if (flags->update_rx_mode_config || |
5795 | flags->update_tx_mode_config || |
5796 | - params.update_ctl_frame_check) |
5797 | + params.update_ctl_frame_check || |
5798 | + params.update_accept_any_vlan_flg) { |
5799 | + DP_VERBOSE(hwfn, QED_MSG_IOV, |
5800 | + "vport update config for %s VF[abs 0x%x rel 0x%x]\n", |
5801 | + vf_info->is_trusted_configured ? "trusted" : "untrusted", |
5802 | + vf->abs_vf_id, vf->relative_vf_id); |
5803 | qed_sp_vport_update(hwfn, ¶ms, |
5804 | QED_SPQ_MODE_EBLOCK, NULL); |
5805 | + } |
5806 | } |
5807 | } |
5808 | |
5809 | diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.h b/drivers/net/ethernet/qlogic/qed/qed_sriov.h |
5810 | index 9a8fd79611f24..853be06bccdf6 100644 |
5811 | --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.h |
5812 | +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.h |
5813 | @@ -88,6 +88,7 @@ struct qed_public_vf_info { |
5814 | bool is_trusted_request; |
5815 | u8 rx_accept_mode; |
5816 | u8 tx_accept_mode; |
5817 | + bool accept_any_vlan; |
5818 | }; |
5819 | |
5820 | struct qed_iov_vf_init_params { |
5821 | diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c |
5822 | index b81579afa361d..f16032635ba73 100644 |
5823 | --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c |
5824 | +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c |
5825 | @@ -723,6 +723,9 @@ qede_build_skb(struct qede_rx_queue *rxq, |
5826 | buf = page_address(bd->data) + bd->page_offset; |
5827 | skb = build_skb(buf, rxq->rx_buf_seg_size); |
5828 | |
5829 | + if (unlikely(!skb)) |
5830 | + return NULL; |
5831 | + |
5832 | skb_reserve(skb, pad); |
5833 | skb_put(skb, len); |
5834 | |
5835 | diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h |
5836 | index f4aa6331b367b..0a9d24e86715d 100644 |
5837 | --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h |
5838 | +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h |
5839 | @@ -52,7 +52,7 @@ static inline int qlcnic_dcb_get_hw_capability(struct qlcnic_dcb *dcb) |
5840 | if (dcb && dcb->ops->get_hw_capability) |
5841 | return dcb->ops->get_hw_capability(dcb); |
5842 | |
5843 | - return 0; |
5844 | + return -EOPNOTSUPP; |
5845 | } |
5846 | |
5847 | static inline void qlcnic_dcb_free(struct qlcnic_dcb *dcb) |
5848 | @@ -66,7 +66,7 @@ static inline int qlcnic_dcb_attach(struct qlcnic_dcb *dcb) |
5849 | if (dcb && dcb->ops->attach) |
5850 | return dcb->ops->attach(dcb); |
5851 | |
5852 | - return 0; |
5853 | + return -EOPNOTSUPP; |
5854 | } |
5855 | |
5856 | static inline int |
5857 | @@ -75,7 +75,7 @@ qlcnic_dcb_query_hw_capability(struct qlcnic_dcb *dcb, char *buf) |
5858 | if (dcb && dcb->ops->query_hw_capability) |
5859 | return dcb->ops->query_hw_capability(dcb, buf); |
5860 | |
5861 | - return 0; |
5862 | + return -EOPNOTSUPP; |
5863 | } |
5864 | |
5865 | static inline void qlcnic_dcb_get_info(struct qlcnic_dcb *dcb) |
5866 | @@ -90,7 +90,7 @@ qlcnic_dcb_query_cee_param(struct qlcnic_dcb *dcb, char *buf, u8 type) |
5867 | if (dcb && dcb->ops->query_cee_param) |
5868 | return dcb->ops->query_cee_param(dcb, buf, type); |
5869 | |
5870 | - return 0; |
5871 | + return -EOPNOTSUPP; |
5872 | } |
5873 | |
5874 | static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb) |
5875 | @@ -98,7 +98,7 @@ static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb) |
5876 | if (dcb && dcb->ops->get_cee_cfg) |
5877 | return dcb->ops->get_cee_cfg(dcb); |
5878 | |
5879 | - return 0; |
5880 | + return -EOPNOTSUPP; |
5881 | } |
5882 | |
5883 | static inline void qlcnic_dcb_aen_handler(struct qlcnic_dcb *dcb, void *msg) |
5884 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
5885 | index a46fea472bc46..70cbf48c2c038 100644 |
5886 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
5887 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |
5888 | @@ -428,8 +428,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) |
5889 | plat->phylink_node = np; |
5890 | |
5891 | /* Get max speed of operation from device tree */ |
5892 | - if (of_property_read_u32(np, "max-speed", &plat->max_speed)) |
5893 | - plat->max_speed = -1; |
5894 | + of_property_read_u32(np, "max-speed", &plat->max_speed); |
5895 | |
5896 | plat->bus_id = of_alias_get_id(np, "ethernet"); |
5897 | if (plat->bus_id < 0) |
5898 | diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c |
5899 | index d007dfeba5c35..3133f903279ce 100644 |
5900 | --- a/drivers/net/ethernet/sun/sunhme.c |
5901 | +++ b/drivers/net/ethernet/sun/sunhme.c |
5902 | @@ -3164,7 +3164,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, |
5903 | if (err) { |
5904 | printk(KERN_ERR "happymeal(PCI): Cannot register net device, " |
5905 | "aborting.\n"); |
5906 | - goto err_out_iounmap; |
5907 | + goto err_out_free_coherent; |
5908 | } |
5909 | |
5910 | pci_set_drvdata(pdev, hp); |
5911 | @@ -3197,6 +3197,10 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, |
5912 | |
5913 | return 0; |
5914 | |
5915 | +err_out_free_coherent: |
5916 | + dma_free_coherent(hp->dma_dev, PAGE_SIZE, |
5917 | + hp->happy_block, hp->hblock_dvma); |
5918 | + |
5919 | err_out_iounmap: |
5920 | iounmap(hp->gregs); |
5921 | |
5922 | diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c |
5923 | index bd0beb16d68a9..02d6f3ad9aca8 100644 |
5924 | --- a/drivers/net/hamradio/6pack.c |
5925 | +++ b/drivers/net/hamradio/6pack.c |
5926 | @@ -674,14 +674,14 @@ static void sixpack_close(struct tty_struct *tty) |
5927 | */ |
5928 | netif_stop_queue(sp->dev); |
5929 | |
5930 | + unregister_netdev(sp->dev); |
5931 | + |
5932 | del_timer_sync(&sp->tx_t); |
5933 | del_timer_sync(&sp->resync_t); |
5934 | |
5935 | /* Free all 6pack frame buffers. */ |
5936 | kfree(sp->rbuff); |
5937 | kfree(sp->xbuff); |
5938 | - |
5939 | - unregister_netdev(sp->dev); |
5940 | } |
5941 | |
5942 | /* Perform I/O control on an active 6pack channel. */ |
5943 | diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c |
5944 | index 694e2f5dbbe59..39801c31e5071 100644 |
5945 | --- a/drivers/net/macvtap.c |
5946 | +++ b/drivers/net/macvtap.c |
5947 | @@ -133,11 +133,17 @@ static void macvtap_setup(struct net_device *dev) |
5948 | dev->tx_queue_len = TUN_READQ_SIZE; |
5949 | } |
5950 | |
5951 | +static struct net *macvtap_link_net(const struct net_device *dev) |
5952 | +{ |
5953 | + return dev_net(macvlan_dev_real_dev(dev)); |
5954 | +} |
5955 | + |
5956 | static struct rtnl_link_ops macvtap_link_ops __read_mostly = { |
5957 | .kind = "macvtap", |
5958 | .setup = macvtap_setup, |
5959 | .newlink = macvtap_newlink, |
5960 | .dellink = macvtap_dellink, |
5961 | + .get_link_net = macvtap_link_net, |
5962 | .priv_size = sizeof(struct macvtap_dev), |
5963 | }; |
5964 | |
5965 | diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c |
5966 | index c23fec34b50e9..7be75a611e9e8 100644 |
5967 | --- a/drivers/net/phy/broadcom.c |
5968 | +++ b/drivers/net/phy/broadcom.c |
5969 | @@ -11,6 +11,7 @@ |
5970 | */ |
5971 | |
5972 | #include "bcm-phy-lib.h" |
5973 | +#include <linux/delay.h> |
5974 | #include <linux/module.h> |
5975 | #include <linux/phy.h> |
5976 | #include <linux/brcmphy.h> |
5977 | @@ -479,6 +480,26 @@ static int brcm_fet_config_init(struct phy_device *phydev) |
5978 | if (err < 0) |
5979 | return err; |
5980 | |
5981 | + /* The datasheet indicates the PHY needs up to 1us to complete a reset, |
5982 | + * build some slack here. |
5983 | + */ |
5984 | + usleep_range(1000, 2000); |
5985 | + |
5986 | + /* The PHY requires 65 MDC clock cycles to complete a write operation |
5987 | + * and turnaround the line properly. |
5988 | + * |
5989 | + * We ignore -EIO here as the MDIO controller (e.g.: mdio-bcm-unimac) |
5990 | + * may flag the lack of turn-around as a read failure. This is |
5991 | + * particularly true with this combination since the MDIO controller |
5992 | + * only used 64 MDC cycles. This is not a critical failure in this |
5993 | + * specific case and it has no functional impact otherwise, so we let |
5994 | + * that one go through. If there is a genuine bus error, the next read |
5995 | + * of MII_BRCM_FET_INTREG will error out. |
5996 | + */ |
5997 | + err = phy_read(phydev, MII_BMCR); |
5998 | + if (err < 0 && err != -EIO) |
5999 | + return err; |
6000 | + |
6001 | reg = phy_read(phydev, MII_BRCM_FET_INTREG); |
6002 | if (reg < 0) |
6003 | return reg; |
6004 | diff --git a/drivers/net/tap.c b/drivers/net/tap.c |
6005 | index f285422a80717..f870d08bb1f86 100644 |
6006 | --- a/drivers/net/tap.c |
6007 | +++ b/drivers/net/tap.c |
6008 | @@ -1214,7 +1214,8 @@ static int tap_sendmsg(struct socket *sock, struct msghdr *m, |
6009 | struct xdp_buff *xdp; |
6010 | int i; |
6011 | |
6012 | - if (ctl && (ctl->type == TUN_MSG_PTR)) { |
6013 | + if (m->msg_controllen == sizeof(struct tun_msg_ctl) && |
6014 | + ctl && ctl->type == TUN_MSG_PTR) { |
6015 | for (i = 0; i < ctl->num; i++) { |
6016 | xdp = &((struct xdp_buff *)ctl->ptr)[i]; |
6017 | tap_get_user_xdp(q, xdp); |
6018 | diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
6019 | index 10211ea605140..d9993884a97d9 100644 |
6020 | --- a/drivers/net/tun.c |
6021 | +++ b/drivers/net/tun.c |
6022 | @@ -2561,7 +2561,8 @@ static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) |
6023 | if (!tun) |
6024 | return -EBADFD; |
6025 | |
6026 | - if (ctl && (ctl->type == TUN_MSG_PTR)) { |
6027 | + if (m->msg_controllen == sizeof(struct tun_msg_ctl) && |
6028 | + ctl && ctl->type == TUN_MSG_PTR) { |
6029 | struct tun_page tpage; |
6030 | int n = ctl->num; |
6031 | int flush = 0; |
6032 | diff --git a/drivers/net/wireless/ath/ath10k/wow.c b/drivers/net/wireless/ath/ath10k/wow.c |
6033 | index 8c26adddd034e..b4f54ca127561 100644 |
6034 | --- a/drivers/net/wireless/ath/ath10k/wow.c |
6035 | +++ b/drivers/net/wireless/ath/ath10k/wow.c |
6036 | @@ -337,14 +337,15 @@ static int ath10k_vif_wow_set_wakeups(struct ath10k_vif *arvif, |
6037 | if (patterns[i].mask[j / 8] & BIT(j % 8)) |
6038 | bitmask[j] = 0xff; |
6039 | old_pattern.mask = bitmask; |
6040 | - new_pattern = old_pattern; |
6041 | |
6042 | if (ar->wmi.rx_decap_mode == ATH10K_HW_TXRX_NATIVE_WIFI) { |
6043 | - if (patterns[i].pkt_offset < ETH_HLEN) |
6044 | + if (patterns[i].pkt_offset < ETH_HLEN) { |
6045 | ath10k_wow_convert_8023_to_80211(&new_pattern, |
6046 | &old_pattern); |
6047 | - else |
6048 | + } else { |
6049 | + new_pattern = old_pattern; |
6050 | new_pattern.pkt_offset += WOW_HDR_LEN - ETH_HLEN; |
6051 | + } |
6052 | } |
6053 | |
6054 | if (WARN_ON(new_pattern.pattern_len > WOW_MAX_PATTERN_SIZE)) |
6055 | diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c |
6056 | index 94d34ee02265d..01163b3339451 100644 |
6057 | --- a/drivers/net/wireless/ath/ath5k/eeprom.c |
6058 | +++ b/drivers/net/wireless/ath/ath5k/eeprom.c |
6059 | @@ -746,6 +746,9 @@ ath5k_eeprom_convert_pcal_info_5111(struct ath5k_hw *ah, int mode, |
6060 | } |
6061 | } |
6062 | |
6063 | + if (idx == AR5K_EEPROM_N_PD_CURVES) |
6064 | + goto err_out; |
6065 | + |
6066 | ee->ee_pd_gains[mode] = 1; |
6067 | |
6068 | pd = &chinfo[pier].pd_curves[idx]; |
6069 | diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c |
6070 | index 510e61e97dbcb..994ec48b2f669 100644 |
6071 | --- a/drivers/net/wireless/ath/ath9k/htc_hst.c |
6072 | +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c |
6073 | @@ -30,6 +30,7 @@ static int htc_issue_send(struct htc_target *target, struct sk_buff* skb, |
6074 | hdr->endpoint_id = epid; |
6075 | hdr->flags = flags; |
6076 | hdr->payload_len = cpu_to_be16(len); |
6077 | + memset(hdr->control, 0, sizeof(hdr->control)); |
6078 | |
6079 | status = target->hif->send(target->hif_dev, endpoint->ul_pipeid, skb); |
6080 | |
6081 | @@ -272,6 +273,10 @@ int htc_connect_service(struct htc_target *target, |
6082 | conn_msg->dl_pipeid = endpoint->dl_pipeid; |
6083 | conn_msg->ul_pipeid = endpoint->ul_pipeid; |
6084 | |
6085 | + /* To prevent infoleak */ |
6086 | + conn_msg->svc_meta_len = 0; |
6087 | + conn_msg->pad = 0; |
6088 | + |
6089 | ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); |
6090 | if (ret) |
6091 | goto err; |
6092 | diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c |
6093 | index 21ca62b06214a..8d708e7588bcb 100644 |
6094 | --- a/drivers/net/wireless/ath/carl9170/main.c |
6095 | +++ b/drivers/net/wireless/ath/carl9170/main.c |
6096 | @@ -1917,7 +1917,7 @@ static int carl9170_parse_eeprom(struct ar9170 *ar) |
6097 | WARN_ON(!(tx_streams >= 1 && tx_streams <= |
6098 | IEEE80211_HT_MCS_TX_MAX_STREAMS)); |
6099 | |
6100 | - tx_params = (tx_streams - 1) << |
6101 | + tx_params |= (tx_streams - 1) << |
6102 | IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; |
6103 | |
6104 | carl9170_band_2GHz.ht_cap.mcs.tx_params |= tx_params; |
6105 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c |
6106 | index 3aed4c4b887aa..544ad80629a99 100644 |
6107 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c |
6108 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c |
6109 | @@ -207,6 +207,8 @@ static int brcmf_init_nvram_parser(struct nvram_parser *nvp, |
6110 | size = BRCMF_FW_MAX_NVRAM_SIZE; |
6111 | else |
6112 | size = data_len; |
6113 | + /* Add space for properties we may add */ |
6114 | + size += strlen(BRCMF_FW_DEFAULT_BOARDREV) + 1; |
6115 | /* Alloc for extra 0 byte + roundup by 4 + length field */ |
6116 | size += 1 + 3 + sizeof(u32); |
6117 | nvp->nvram = kzalloc(size, GFP_KERNEL); |
6118 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
6119 | index e6001f0a81a3a..b5d2e5b9f67cc 100644 |
6120 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
6121 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
6122 | @@ -12,6 +12,7 @@ |
6123 | #include <linux/interrupt.h> |
6124 | #include <linux/bcma/bcma.h> |
6125 | #include <linux/sched.h> |
6126 | +#include <linux/io.h> |
6127 | #include <asm/unaligned.h> |
6128 | |
6129 | #include <soc.h> |
6130 | @@ -444,47 +445,6 @@ brcmf_pcie_write_ram32(struct brcmf_pciedev_info *devinfo, u32 mem_offset, |
6131 | } |
6132 | |
6133 | |
6134 | -static void |
6135 | -brcmf_pcie_copy_mem_todev(struct brcmf_pciedev_info *devinfo, u32 mem_offset, |
6136 | - void *srcaddr, u32 len) |
6137 | -{ |
6138 | - void __iomem *address = devinfo->tcm + mem_offset; |
6139 | - __le32 *src32; |
6140 | - __le16 *src16; |
6141 | - u8 *src8; |
6142 | - |
6143 | - if (((ulong)address & 4) || ((ulong)srcaddr & 4) || (len & 4)) { |
6144 | - if (((ulong)address & 2) || ((ulong)srcaddr & 2) || (len & 2)) { |
6145 | - src8 = (u8 *)srcaddr; |
6146 | - while (len) { |
6147 | - iowrite8(*src8, address); |
6148 | - address++; |
6149 | - src8++; |
6150 | - len--; |
6151 | - } |
6152 | - } else { |
6153 | - len = len / 2; |
6154 | - src16 = (__le16 *)srcaddr; |
6155 | - while (len) { |
6156 | - iowrite16(le16_to_cpu(*src16), address); |
6157 | - address += 2; |
6158 | - src16++; |
6159 | - len--; |
6160 | - } |
6161 | - } |
6162 | - } else { |
6163 | - len = len / 4; |
6164 | - src32 = (__le32 *)srcaddr; |
6165 | - while (len) { |
6166 | - iowrite32(le32_to_cpu(*src32), address); |
6167 | - address += 4; |
6168 | - src32++; |
6169 | - len--; |
6170 | - } |
6171 | - } |
6172 | -} |
6173 | - |
6174 | - |
6175 | static void |
6176 | brcmf_pcie_copy_dev_tomem(struct brcmf_pciedev_info *devinfo, u32 mem_offset, |
6177 | void *dstaddr, u32 len) |
6178 | @@ -1346,6 +1306,18 @@ static void brcmf_pcie_down(struct device *dev) |
6179 | { |
6180 | } |
6181 | |
6182 | +static int brcmf_pcie_preinit(struct device *dev) |
6183 | +{ |
6184 | + struct brcmf_bus *bus_if = dev_get_drvdata(dev); |
6185 | + struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; |
6186 | + |
6187 | + brcmf_dbg(PCIE, "Enter\n"); |
6188 | + |
6189 | + brcmf_pcie_intr_enable(buspub->devinfo); |
6190 | + brcmf_pcie_hostready(buspub->devinfo); |
6191 | + |
6192 | + return 0; |
6193 | +} |
6194 | |
6195 | static int brcmf_pcie_tx(struct device *dev, struct sk_buff *skb) |
6196 | { |
6197 | @@ -1454,6 +1426,7 @@ static int brcmf_pcie_reset(struct device *dev) |
6198 | } |
6199 | |
6200 | static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { |
6201 | + .preinit = brcmf_pcie_preinit, |
6202 | .txdata = brcmf_pcie_tx, |
6203 | .stop = brcmf_pcie_down, |
6204 | .txctl = brcmf_pcie_tx_ctlpkt, |
6205 | @@ -1561,8 +1534,8 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, |
6206 | return err; |
6207 | |
6208 | brcmf_dbg(PCIE, "Download FW %s\n", devinfo->fw_name); |
6209 | - brcmf_pcie_copy_mem_todev(devinfo, devinfo->ci->rambase, |
6210 | - (void *)fw->data, fw->size); |
6211 | + memcpy_toio(devinfo->tcm + devinfo->ci->rambase, |
6212 | + (void *)fw->data, fw->size); |
6213 | |
6214 | resetintr = get_unaligned_le32(fw->data); |
6215 | release_firmware(fw); |
6216 | @@ -1576,7 +1549,7 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo, |
6217 | brcmf_dbg(PCIE, "Download NVRAM %s\n", devinfo->nvram_name); |
6218 | address = devinfo->ci->rambase + devinfo->ci->ramsize - |
6219 | nvram_len; |
6220 | - brcmf_pcie_copy_mem_todev(devinfo, address, nvram, nvram_len); |
6221 | + memcpy_toio(devinfo->tcm + address, nvram, nvram_len); |
6222 | brcmf_fw_nvram_free(nvram); |
6223 | } else { |
6224 | brcmf_dbg(PCIE, "No matching NVRAM file found %s\n", |
6225 | @@ -1775,6 +1748,8 @@ static void brcmf_pcie_setup(struct device *dev, int ret, |
6226 | ret = brcmf_chip_get_raminfo(devinfo->ci); |
6227 | if (ret) { |
6228 | brcmf_err(bus, "Failed to get RAM info\n"); |
6229 | + release_firmware(fw); |
6230 | + brcmf_fw_nvram_free(nvram); |
6231 | goto fail; |
6232 | } |
6233 | |
6234 | @@ -1824,9 +1799,6 @@ static void brcmf_pcie_setup(struct device *dev, int ret, |
6235 | |
6236 | init_waitqueue_head(&devinfo->mbdata_resp_wait); |
6237 | |
6238 | - brcmf_pcie_intr_enable(devinfo); |
6239 | - brcmf_pcie_hostready(devinfo); |
6240 | - |
6241 | ret = brcmf_attach(&devinfo->pdev->dev); |
6242 | if (ret) |
6243 | goto fail; |
6244 | diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |
6245 | index 6512d25e35630..f3bb1f91b5878 100644 |
6246 | --- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |
6247 | +++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |
6248 | @@ -303,7 +303,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw) |
6249 | |
6250 | priv->is_open = 1; |
6251 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
6252 | - return 0; |
6253 | + return ret; |
6254 | } |
6255 | |
6256 | static void iwlagn_mac_stop(struct ieee80211_hw *hw) |
6257 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
6258 | index 7272d8522a9e9..c5b08a68f6fa1 100644 |
6259 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
6260 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c |
6261 | @@ -1417,8 +1417,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm) |
6262 | while (!sband && i < NUM_NL80211_BANDS) |
6263 | sband = mvm->hw->wiphy->bands[i++]; |
6264 | |
6265 | - if (WARN_ON_ONCE(!sband)) |
6266 | + if (WARN_ON_ONCE(!sband)) { |
6267 | + ret = -ENODEV; |
6268 | goto error; |
6269 | + } |
6270 | |
6271 | chan = &sband->channels[0]; |
6272 | |
6273 | diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c |
6274 | index 0a5695c3d9241..625492284389c 100644 |
6275 | --- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c |
6276 | +++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c |
6277 | @@ -605,6 +605,9 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
6278 | struct ieee80211_sta_rates *sta_rates = rcu_dereference(sta->rates); |
6279 | int i; |
6280 | |
6281 | + if (!sta_rates) |
6282 | + return; |
6283 | + |
6284 | spin_lock_bh(&dev->mt76.lock); |
6285 | for (i = 0; i < ARRAY_SIZE(msta->rates); i++) { |
6286 | msta->rates[i].idx = sta_rates->rate[i].idx; |
6287 | diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c |
6288 | index 38183aef0eb92..5ad8b0afa41f0 100644 |
6289 | --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c |
6290 | +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c |
6291 | @@ -385,6 +385,9 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw, |
6292 | struct ieee80211_sta_rates *sta_rates = rcu_dereference(sta->rates); |
6293 | int i; |
6294 | |
6295 | + if (!sta_rates) |
6296 | + return; |
6297 | + |
6298 | spin_lock_bh(&dev->mt76.lock); |
6299 | for (i = 0; i < ARRAY_SIZE(msta->rates); i++) { |
6300 | msta->rates[i].idx = sta_rates->rate[i].idx; |
6301 | diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c |
6302 | index cf372684b6812..3836d6ac53049 100644 |
6303 | --- a/drivers/net/wireless/ray_cs.c |
6304 | +++ b/drivers/net/wireless/ray_cs.c |
6305 | @@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link) |
6306 | goto failed; |
6307 | local->sram = ioremap(link->resource[2]->start, |
6308 | resource_size(link->resource[2])); |
6309 | + if (!local->sram) |
6310 | + goto failed; |
6311 | |
6312 | /*** Set up 16k window for shared memory (receive buffer) ***************/ |
6313 | link->resource[3]->flags |= |
6314 | @@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link) |
6315 | goto failed; |
6316 | local->rmem = ioremap(link->resource[3]->start, |
6317 | resource_size(link->resource[3])); |
6318 | + if (!local->rmem) |
6319 | + goto failed; |
6320 | |
6321 | /*** Set up window for attribute memory ***********************************/ |
6322 | link->resource[4]->flags |= |
6323 | @@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link) |
6324 | goto failed; |
6325 | local->amem = ioremap(link->resource[4]->start, |
6326 | resource_size(link->resource[4])); |
6327 | + if (!local->amem) |
6328 | + goto failed; |
6329 | |
6330 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); |
6331 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); |
6332 | diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c |
6333 | index 544287e9f449b..f4de8be05c614 100644 |
6334 | --- a/drivers/parisc/dino.c |
6335 | +++ b/drivers/parisc/dino.c |
6336 | @@ -142,9 +142,8 @@ struct dino_device |
6337 | { |
6338 | struct pci_hba_data hba; /* 'C' inheritance - must be first */ |
6339 | spinlock_t dinosaur_pen; |
6340 | - unsigned long txn_addr; /* EIR addr to generate interrupt */ |
6341 | - u32 txn_data; /* EIR data assign to each dino */ |
6342 | u32 imr; /* IRQ's which are enabled */ |
6343 | + struct gsc_irq gsc_irq; |
6344 | int global_irq[DINO_LOCAL_IRQS]; /* map IMR bit to global irq */ |
6345 | #ifdef DINO_DEBUG |
6346 | unsigned int dino_irr0; /* save most recent IRQ line stat */ |
6347 | @@ -339,14 +338,43 @@ static void dino_unmask_irq(struct irq_data *d) |
6348 | if (tmp & DINO_MASK_IRQ(local_irq)) { |
6349 | DBG(KERN_WARNING "%s(): IRQ asserted! (ILR 0x%x)\n", |
6350 | __func__, tmp); |
6351 | - gsc_writel(dino_dev->txn_data, dino_dev->txn_addr); |
6352 | + gsc_writel(dino_dev->gsc_irq.txn_data, dino_dev->gsc_irq.txn_addr); |
6353 | } |
6354 | } |
6355 | |
6356 | +#ifdef CONFIG_SMP |
6357 | +static int dino_set_affinity_irq(struct irq_data *d, const struct cpumask *dest, |
6358 | + bool force) |
6359 | +{ |
6360 | + struct dino_device *dino_dev = irq_data_get_irq_chip_data(d); |
6361 | + struct cpumask tmask; |
6362 | + int cpu_irq; |
6363 | + u32 eim; |
6364 | + |
6365 | + if (!cpumask_and(&tmask, dest, cpu_online_mask)) |
6366 | + return -EINVAL; |
6367 | + |
6368 | + cpu_irq = cpu_check_affinity(d, &tmask); |
6369 | + if (cpu_irq < 0) |
6370 | + return cpu_irq; |
6371 | + |
6372 | + dino_dev->gsc_irq.txn_addr = txn_affinity_addr(d->irq, cpu_irq); |
6373 | + eim = ((u32) dino_dev->gsc_irq.txn_addr) | dino_dev->gsc_irq.txn_data; |
6374 | + __raw_writel(eim, dino_dev->hba.base_addr+DINO_IAR0); |
6375 | + |
6376 | + irq_data_update_effective_affinity(d, &tmask); |
6377 | + |
6378 | + return IRQ_SET_MASK_OK; |
6379 | +} |
6380 | +#endif |
6381 | + |
6382 | static struct irq_chip dino_interrupt_type = { |
6383 | .name = "GSC-PCI", |
6384 | .irq_unmask = dino_unmask_irq, |
6385 | .irq_mask = dino_mask_irq, |
6386 | +#ifdef CONFIG_SMP |
6387 | + .irq_set_affinity = dino_set_affinity_irq, |
6388 | +#endif |
6389 | }; |
6390 | |
6391 | |
6392 | @@ -806,7 +834,6 @@ static int __init dino_common_init(struct parisc_device *dev, |
6393 | { |
6394 | int status; |
6395 | u32 eim; |
6396 | - struct gsc_irq gsc_irq; |
6397 | struct resource *res; |
6398 | |
6399 | pcibios_register_hba(&dino_dev->hba); |
6400 | @@ -821,10 +848,8 @@ static int __init dino_common_init(struct parisc_device *dev, |
6401 | ** still only has 11 IRQ input lines - just map some of them |
6402 | ** to a different processor. |
6403 | */ |
6404 | - dev->irq = gsc_alloc_irq(&gsc_irq); |
6405 | - dino_dev->txn_addr = gsc_irq.txn_addr; |
6406 | - dino_dev->txn_data = gsc_irq.txn_data; |
6407 | - eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data; |
6408 | + dev->irq = gsc_alloc_irq(&dino_dev->gsc_irq); |
6409 | + eim = ((u32) dino_dev->gsc_irq.txn_addr) | dino_dev->gsc_irq.txn_data; |
6410 | |
6411 | /* |
6412 | ** Dino needs a PA "IRQ" to get a processor's attention. |
6413 | diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c |
6414 | index ed9371acf37eb..ec175ae998733 100644 |
6415 | --- a/drivers/parisc/gsc.c |
6416 | +++ b/drivers/parisc/gsc.c |
6417 | @@ -135,10 +135,41 @@ static void gsc_asic_unmask_irq(struct irq_data *d) |
6418 | */ |
6419 | } |
6420 | |
6421 | +#ifdef CONFIG_SMP |
6422 | +static int gsc_set_affinity_irq(struct irq_data *d, const struct cpumask *dest, |
6423 | + bool force) |
6424 | +{ |
6425 | + struct gsc_asic *gsc_dev = irq_data_get_irq_chip_data(d); |
6426 | + struct cpumask tmask; |
6427 | + int cpu_irq; |
6428 | + |
6429 | + if (!cpumask_and(&tmask, dest, cpu_online_mask)) |
6430 | + return -EINVAL; |
6431 | + |
6432 | + cpu_irq = cpu_check_affinity(d, &tmask); |
6433 | + if (cpu_irq < 0) |
6434 | + return cpu_irq; |
6435 | + |
6436 | + gsc_dev->gsc_irq.txn_addr = txn_affinity_addr(d->irq, cpu_irq); |
6437 | + gsc_dev->eim = ((u32) gsc_dev->gsc_irq.txn_addr) | gsc_dev->gsc_irq.txn_data; |
6438 | + |
6439 | + /* switch IRQ's for devices below LASI/WAX to other CPU */ |
6440 | + gsc_writel(gsc_dev->eim, gsc_dev->hpa + OFFSET_IAR); |
6441 | + |
6442 | + irq_data_update_effective_affinity(d, &tmask); |
6443 | + |
6444 | + return IRQ_SET_MASK_OK; |
6445 | +} |
6446 | +#endif |
6447 | + |
6448 | + |
6449 | static struct irq_chip gsc_asic_interrupt_type = { |
6450 | .name = "GSC-ASIC", |
6451 | .irq_unmask = gsc_asic_unmask_irq, |
6452 | .irq_mask = gsc_asic_mask_irq, |
6453 | +#ifdef CONFIG_SMP |
6454 | + .irq_set_affinity = gsc_set_affinity_irq, |
6455 | +#endif |
6456 | }; |
6457 | |
6458 | int gsc_assign_irq(struct irq_chip *type, void *data) |
6459 | diff --git a/drivers/parisc/gsc.h b/drivers/parisc/gsc.h |
6460 | index 86abad3fa2150..73cbd0bb1975a 100644 |
6461 | --- a/drivers/parisc/gsc.h |
6462 | +++ b/drivers/parisc/gsc.h |
6463 | @@ -31,6 +31,7 @@ struct gsc_asic { |
6464 | int version; |
6465 | int type; |
6466 | int eim; |
6467 | + struct gsc_irq gsc_irq; |
6468 | int global_irq[32]; |
6469 | }; |
6470 | |
6471 | diff --git a/drivers/parisc/lasi.c b/drivers/parisc/lasi.c |
6472 | index 4e4fd12c2112e..6ef621adb63a8 100644 |
6473 | --- a/drivers/parisc/lasi.c |
6474 | +++ b/drivers/parisc/lasi.c |
6475 | @@ -163,7 +163,6 @@ static int __init lasi_init_chip(struct parisc_device *dev) |
6476 | { |
6477 | extern void (*chassis_power_off)(void); |
6478 | struct gsc_asic *lasi; |
6479 | - struct gsc_irq gsc_irq; |
6480 | int ret; |
6481 | |
6482 | lasi = kzalloc(sizeof(*lasi), GFP_KERNEL); |
6483 | @@ -185,7 +184,7 @@ static int __init lasi_init_chip(struct parisc_device *dev) |
6484 | lasi_init_irq(lasi); |
6485 | |
6486 | /* the IRQ lasi should use */ |
6487 | - dev->irq = gsc_alloc_irq(&gsc_irq); |
6488 | + dev->irq = gsc_alloc_irq(&lasi->gsc_irq); |
6489 | if (dev->irq < 0) { |
6490 | printk(KERN_ERR "%s(): cannot get GSC irq\n", |
6491 | __func__); |
6492 | @@ -193,9 +192,9 @@ static int __init lasi_init_chip(struct parisc_device *dev) |
6493 | return -EBUSY; |
6494 | } |
6495 | |
6496 | - lasi->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data; |
6497 | + lasi->eim = ((u32) lasi->gsc_irq.txn_addr) | lasi->gsc_irq.txn_data; |
6498 | |
6499 | - ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "lasi", lasi); |
6500 | + ret = request_irq(lasi->gsc_irq.irq, gsc_asic_intr, 0, "lasi", lasi); |
6501 | if (ret < 0) { |
6502 | kfree(lasi); |
6503 | return ret; |
6504 | diff --git a/drivers/parisc/wax.c b/drivers/parisc/wax.c |
6505 | index 5b6df15162354..73a2b01f8d9ca 100644 |
6506 | --- a/drivers/parisc/wax.c |
6507 | +++ b/drivers/parisc/wax.c |
6508 | @@ -68,7 +68,6 @@ static int __init wax_init_chip(struct parisc_device *dev) |
6509 | { |
6510 | struct gsc_asic *wax; |
6511 | struct parisc_device *parent; |
6512 | - struct gsc_irq gsc_irq; |
6513 | int ret; |
6514 | |
6515 | wax = kzalloc(sizeof(*wax), GFP_KERNEL); |
6516 | @@ -85,7 +84,7 @@ static int __init wax_init_chip(struct parisc_device *dev) |
6517 | wax_init_irq(wax); |
6518 | |
6519 | /* the IRQ wax should use */ |
6520 | - dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ); |
6521 | + dev->irq = gsc_claim_irq(&wax->gsc_irq, WAX_GSC_IRQ); |
6522 | if (dev->irq < 0) { |
6523 | printk(KERN_ERR "%s(): cannot get GSC irq\n", |
6524 | __func__); |
6525 | @@ -93,9 +92,9 @@ static int __init wax_init_chip(struct parisc_device *dev) |
6526 | return -EBUSY; |
6527 | } |
6528 | |
6529 | - wax->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data; |
6530 | + wax->eim = ((u32) wax->gsc_irq.txn_addr) | wax->gsc_irq.txn_data; |
6531 | |
6532 | - ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "wax", wax); |
6533 | + ret = request_irq(wax->gsc_irq.irq, gsc_asic_intr, 0, "wax", wax); |
6534 | if (ret < 0) { |
6535 | kfree(wax); |
6536 | return ret; |
6537 | diff --git a/drivers/pci/access.c b/drivers/pci/access.c |
6538 | index 0914ddeae17f4..c909c66a63e2d 100644 |
6539 | --- a/drivers/pci/access.c |
6540 | +++ b/drivers/pci/access.c |
6541 | @@ -160,9 +160,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn, |
6542 | * write happen to have any RW1C (write-one-to-clear) bits set, we |
6543 | * just inadvertently cleared something we shouldn't have. |
6544 | */ |
6545 | - dev_warn_ratelimited(&bus->dev, "%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n", |
6546 | - size, pci_domain_nr(bus), bus->number, |
6547 | - PCI_SLOT(devfn), PCI_FUNC(devfn), where); |
6548 | + if (!bus->unsafe_warn) { |
6549 | + dev_warn(&bus->dev, "%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n", |
6550 | + size, pci_domain_nr(bus), bus->number, |
6551 | + PCI_SLOT(devfn), PCI_FUNC(devfn), where); |
6552 | + bus->unsafe_warn = 1; |
6553 | + } |
6554 | |
6555 | mask = ~(((1 << (size * 8)) - 1) << ((where & 0x3) * 8)); |
6556 | tmp = readl(addr) & mask; |
6557 | diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
6558 | index d2f8cd3a9568b..721d2652319ce 100644 |
6559 | --- a/drivers/pci/controller/pci-aardvark.c |
6560 | +++ b/drivers/pci/controller/pci-aardvark.c |
6561 | @@ -835,7 +835,9 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, |
6562 | case PCI_EXP_RTSTA: { |
6563 | u32 isr0 = advk_readl(pcie, PCIE_ISR0_REG); |
6564 | u32 msglog = advk_readl(pcie, PCIE_MSG_LOG_REG); |
6565 | - *value = (isr0 & PCIE_MSG_PM_PME_MASK) << 16 | (msglog >> 16); |
6566 | + *value = msglog >> 16; |
6567 | + if (isr0 & PCIE_MSG_PM_PME_MASK) |
6568 | + *value |= PCI_EXP_RTSTA_PME; |
6569 | return PCI_BRIDGE_EMUL_HANDLED; |
6570 | } |
6571 | |
6572 | @@ -1168,7 +1170,7 @@ static void advk_msi_irq_compose_msi_msg(struct irq_data *data, |
6573 | |
6574 | msg->address_lo = lower_32_bits(msi_msg); |
6575 | msg->address_hi = upper_32_bits(msi_msg); |
6576 | - msg->data = data->irq; |
6577 | + msg->data = data->hwirq; |
6578 | } |
6579 | |
6580 | static int advk_msi_set_affinity(struct irq_data *irq_data, |
6581 | @@ -1185,15 +1187,11 @@ static int advk_msi_irq_domain_alloc(struct irq_domain *domain, |
6582 | int hwirq, i; |
6583 | |
6584 | mutex_lock(&pcie->msi_used_lock); |
6585 | - hwirq = bitmap_find_next_zero_area(pcie->msi_used, MSI_IRQ_NUM, |
6586 | - 0, nr_irqs, 0); |
6587 | - if (hwirq >= MSI_IRQ_NUM) { |
6588 | - mutex_unlock(&pcie->msi_used_lock); |
6589 | - return -ENOSPC; |
6590 | - } |
6591 | - |
6592 | - bitmap_set(pcie->msi_used, hwirq, nr_irqs); |
6593 | + hwirq = bitmap_find_free_region(pcie->msi_used, MSI_IRQ_NUM, |
6594 | + order_base_2(nr_irqs)); |
6595 | mutex_unlock(&pcie->msi_used_lock); |
6596 | + if (hwirq < 0) |
6597 | + return -ENOSPC; |
6598 | |
6599 | for (i = 0; i < nr_irqs; i++) |
6600 | irq_domain_set_info(domain, virq + i, hwirq + i, |
6601 | @@ -1211,7 +1209,7 @@ static void advk_msi_irq_domain_free(struct irq_domain *domain, |
6602 | struct advk_pcie *pcie = domain->host_data; |
6603 | |
6604 | mutex_lock(&pcie->msi_used_lock); |
6605 | - bitmap_clear(pcie->msi_used, d->hwirq, nr_irqs); |
6606 | + bitmap_release_region(pcie->msi_used, d->hwirq, order_base_2(nr_irqs)); |
6607 | mutex_unlock(&pcie->msi_used_lock); |
6608 | } |
6609 | |
6610 | diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c |
6611 | index 907b8be86ce04..13f3bc239c660 100644 |
6612 | --- a/drivers/pci/hotplug/pciehp_hpc.c |
6613 | +++ b/drivers/pci/hotplug/pciehp_hpc.c |
6614 | @@ -79,6 +79,8 @@ static int pcie_poll_cmd(struct controller *ctrl, int timeout) |
6615 | if (slot_status & PCI_EXP_SLTSTA_CC) { |
6616 | pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, |
6617 | PCI_EXP_SLTSTA_CC); |
6618 | + ctrl->cmd_busy = 0; |
6619 | + smp_mb(); |
6620 | return 1; |
6621 | } |
6622 | if (timeout < 0) |
6623 | @@ -957,6 +959,8 @@ static void quirk_cmd_compl(struct pci_dev *pdev) |
6624 | } |
6625 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, |
6626 | PCI_CLASS_BRIDGE_PCI, 8, quirk_cmd_compl); |
6627 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_QCOM, 0x0110, |
6628 | + PCI_CLASS_BRIDGE_PCI, 8, quirk_cmd_compl); |
6629 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_QCOM, 0x0400, |
6630 | PCI_CLASS_BRIDGE_PCI, 8, quirk_cmd_compl); |
6631 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_QCOM, 0x0401, |
6632 | diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c |
6633 | index 4da37f650f983..7018eb21d1892 100644 |
6634 | --- a/drivers/perf/qcom_l2_pmu.c |
6635 | +++ b/drivers/perf/qcom_l2_pmu.c |
6636 | @@ -781,7 +781,7 @@ static struct cluster_pmu *l2_cache_associate_cpu_with_cluster( |
6637 | { |
6638 | u64 mpidr; |
6639 | int cpu_cluster_id; |
6640 | - struct cluster_pmu *cluster = NULL; |
6641 | + struct cluster_pmu *cluster; |
6642 | |
6643 | /* |
6644 | * This assumes that the cluster_id is in MPIDR[aff1] for |
6645 | @@ -803,10 +803,10 @@ static struct cluster_pmu *l2_cache_associate_cpu_with_cluster( |
6646 | cluster->cluster_id); |
6647 | cpumask_set_cpu(cpu, &cluster->cluster_cpus); |
6648 | *per_cpu_ptr(l2cache_pmu->pmu_cluster, cpu) = cluster; |
6649 | - break; |
6650 | + return cluster; |
6651 | } |
6652 | |
6653 | - return cluster; |
6654 | + return NULL; |
6655 | } |
6656 | |
6657 | static int l2cache_pmu_online_cpu(unsigned int cpu, struct hlist_node *node) |
6658 | diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c |
6659 | index 14e0551cd3190..0aa740b73d0db 100644 |
6660 | --- a/drivers/phy/phy-core-mipi-dphy.c |
6661 | +++ b/drivers/phy/phy-core-mipi-dphy.c |
6662 | @@ -66,10 +66,10 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, |
6663 | cfg->hs_trail = max(4 * 8 * ui, 60000 + 4 * 4 * ui); |
6664 | |
6665 | cfg->init = 100; |
6666 | - cfg->lpx = 60000; |
6667 | + cfg->lpx = 50000; |
6668 | cfg->ta_get = 5 * cfg->lpx; |
6669 | cfg->ta_go = 4 * cfg->lpx; |
6670 | - cfg->ta_sure = 2 * cfg->lpx; |
6671 | + cfg->ta_sure = cfg->lpx; |
6672 | cfg->wakeup = 1000; |
6673 | |
6674 | cfg->hs_clk_rate = hs_clk_rate; |
6675 | diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
6676 | index 53f52b9a0acdc..c2df70712ca22 100644 |
6677 | --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
6678 | +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c |
6679 | @@ -1038,6 +1038,7 @@ int mtk_pctrl_init(struct platform_device *pdev, |
6680 | node = of_parse_phandle(np, "mediatek,pctl-regmap", 0); |
6681 | if (node) { |
6682 | pctl->regmap1 = syscon_node_to_regmap(node); |
6683 | + of_node_put(node); |
6684 | if (IS_ERR(pctl->regmap1)) |
6685 | return PTR_ERR(pctl->regmap1); |
6686 | } else if (regmap) { |
6687 | @@ -1051,6 +1052,7 @@ int mtk_pctrl_init(struct platform_device *pdev, |
6688 | node = of_parse_phandle(np, "mediatek,pctl-regmap", 1); |
6689 | if (node) { |
6690 | pctl->regmap2 = syscon_node_to_regmap(node); |
6691 | + of_node_put(node); |
6692 | if (IS_ERR(pctl->regmap2)) |
6693 | return PTR_ERR(pctl->regmap2); |
6694 | } |
6695 | diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c |
6696 | index 923264d0e9ef2..31449514a8c0c 100644 |
6697 | --- a/drivers/pinctrl/mediatek/pinctrl-paris.c |
6698 | +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c |
6699 | @@ -198,8 +198,7 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev, |
6700 | } |
6701 | |
6702 | static int mtk_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, |
6703 | - enum pin_config_param param, |
6704 | - enum pin_config_param arg) |
6705 | + enum pin_config_param param, u32 arg) |
6706 | { |
6707 | struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev); |
6708 | const struct mtk_pin_desc *desc; |
6709 | @@ -647,10 +646,10 @@ static int mtk_pconf_group_get(struct pinctrl_dev *pctldev, unsigned group, |
6710 | unsigned long *config) |
6711 | { |
6712 | struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev); |
6713 | + struct mtk_pinctrl_group *grp = &hw->groups[group]; |
6714 | |
6715 | - *config = hw->groups[group].config; |
6716 | - |
6717 | - return 0; |
6718 | + /* One pin per group only */ |
6719 | + return mtk_pinconf_get(pctldev, grp->pin, config); |
6720 | } |
6721 | |
6722 | static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group, |
6723 | @@ -666,8 +665,6 @@ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group, |
6724 | pinconf_to_config_argument(configs[i])); |
6725 | if (ret < 0) |
6726 | return ret; |
6727 | - |
6728 | - grp->config = configs[i]; |
6729 | } |
6730 | |
6731 | return 0; |
6732 | diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
6733 | index 2a8190b11d104..9f00adfefba8e 100644 |
6734 | --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
6735 | +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c |
6736 | @@ -1923,8 +1923,10 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) |
6737 | } |
6738 | |
6739 | prcm_np = of_parse_phandle(np, "prcm", 0); |
6740 | - if (prcm_np) |
6741 | + if (prcm_np) { |
6742 | npct->prcm_base = of_iomap(prcm_np, 0); |
6743 | + of_node_put(prcm_np); |
6744 | + } |
6745 | if (!npct->prcm_base) { |
6746 | if (version == PINCTRL_NMK_STN8815) { |
6747 | dev_info(&pdev->dev, |
6748 | diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
6749 | index 17f909d8b63a9..2dccd24c65557 100644 |
6750 | --- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
6751 | +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c |
6752 | @@ -78,7 +78,6 @@ struct npcm7xx_gpio { |
6753 | struct gpio_chip gc; |
6754 | int irqbase; |
6755 | int irq; |
6756 | - void *priv; |
6757 | struct irq_chip irq_chip; |
6758 | u32 pinctrl_id; |
6759 | int (*direction_input)(struct gpio_chip *chip, unsigned offset); |
6760 | @@ -226,7 +225,7 @@ static void npcmgpio_irq_handler(struct irq_desc *desc) |
6761 | chained_irq_enter(chip, desc); |
6762 | sts = ioread32(bank->base + NPCM7XX_GP_N_EVST); |
6763 | en = ioread32(bank->base + NPCM7XX_GP_N_EVEN); |
6764 | - dev_dbg(chip->parent_device, "==> got irq sts %.8x %.8x\n", sts, |
6765 | + dev_dbg(bank->gc.parent, "==> got irq sts %.8x %.8x\n", sts, |
6766 | en); |
6767 | |
6768 | sts &= en; |
6769 | @@ -241,33 +240,33 @@ static int npcmgpio_set_irq_type(struct irq_data *d, unsigned int type) |
6770 | gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
6771 | unsigned int gpio = BIT(d->hwirq); |
6772 | |
6773 | - dev_dbg(d->chip->parent_device, "setirqtype: %u.%u = %u\n", gpio, |
6774 | + dev_dbg(bank->gc.parent, "setirqtype: %u.%u = %u\n", gpio, |
6775 | d->irq, type); |
6776 | switch (type) { |
6777 | case IRQ_TYPE_EDGE_RISING: |
6778 | - dev_dbg(d->chip->parent_device, "edge.rising\n"); |
6779 | + dev_dbg(bank->gc.parent, "edge.rising\n"); |
6780 | npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio); |
6781 | npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
6782 | break; |
6783 | case IRQ_TYPE_EDGE_FALLING: |
6784 | - dev_dbg(d->chip->parent_device, "edge.falling\n"); |
6785 | + dev_dbg(bank->gc.parent, "edge.falling\n"); |
6786 | npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio); |
6787 | npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
6788 | break; |
6789 | case IRQ_TYPE_EDGE_BOTH: |
6790 | - dev_dbg(d->chip->parent_device, "edge.both\n"); |
6791 | + dev_dbg(bank->gc.parent, "edge.both\n"); |
6792 | npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio); |
6793 | break; |
6794 | case IRQ_TYPE_LEVEL_LOW: |
6795 | - dev_dbg(d->chip->parent_device, "level.low\n"); |
6796 | + dev_dbg(bank->gc.parent, "level.low\n"); |
6797 | npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
6798 | break; |
6799 | case IRQ_TYPE_LEVEL_HIGH: |
6800 | - dev_dbg(d->chip->parent_device, "level.high\n"); |
6801 | + dev_dbg(bank->gc.parent, "level.high\n"); |
6802 | npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio); |
6803 | break; |
6804 | default: |
6805 | - dev_dbg(d->chip->parent_device, "invalid irq type\n"); |
6806 | + dev_dbg(bank->gc.parent, "invalid irq type\n"); |
6807 | return -EINVAL; |
6808 | } |
6809 | |
6810 | @@ -289,7 +288,7 @@ static void npcmgpio_irq_ack(struct irq_data *d) |
6811 | gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
6812 | unsigned int gpio = d->hwirq; |
6813 | |
6814 | - dev_dbg(d->chip->parent_device, "irq_ack: %u.%u\n", gpio, d->irq); |
6815 | + dev_dbg(bank->gc.parent, "irq_ack: %u.%u\n", gpio, d->irq); |
6816 | iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVST); |
6817 | } |
6818 | |
6819 | @@ -301,7 +300,7 @@ static void npcmgpio_irq_mask(struct irq_data *d) |
6820 | unsigned int gpio = d->hwirq; |
6821 | |
6822 | /* Clear events */ |
6823 | - dev_dbg(d->chip->parent_device, "irq_mask: %u.%u\n", gpio, d->irq); |
6824 | + dev_dbg(bank->gc.parent, "irq_mask: %u.%u\n", gpio, d->irq); |
6825 | iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVENC); |
6826 | } |
6827 | |
6828 | @@ -313,7 +312,7 @@ static void npcmgpio_irq_unmask(struct irq_data *d) |
6829 | unsigned int gpio = d->hwirq; |
6830 | |
6831 | /* Enable events */ |
6832 | - dev_dbg(d->chip->parent_device, "irq_unmask: %u.%u\n", gpio, d->irq); |
6833 | + dev_dbg(bank->gc.parent, "irq_unmask: %u.%u\n", gpio, d->irq); |
6834 | iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVENS); |
6835 | } |
6836 | |
6837 | @@ -323,7 +322,7 @@ static unsigned int npcmgpio_irq_startup(struct irq_data *d) |
6838 | unsigned int gpio = d->hwirq; |
6839 | |
6840 | /* active-high, input, clear interrupt, enable interrupt */ |
6841 | - dev_dbg(d->chip->parent_device, "startup: %u.%u\n", gpio, d->irq); |
6842 | + dev_dbg(gc->parent, "startup: %u.%u\n", gpio, d->irq); |
6843 | npcmgpio_direction_input(gc, gpio); |
6844 | npcmgpio_irq_ack(d); |
6845 | npcmgpio_irq_unmask(d); |
6846 | @@ -905,7 +904,7 @@ static struct npcm7xx_func npcm7xx_funcs[] = { |
6847 | #define DRIVE_STRENGTH_HI_SHIFT 12 |
6848 | #define DRIVE_STRENGTH_MASK 0x0000FF00 |
6849 | |
6850 | -#define DS(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \ |
6851 | +#define DSTR(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \ |
6852 | ((hi) << DRIVE_STRENGTH_HI_SHIFT)) |
6853 | #define DSLO(x) (((x) >> DRIVE_STRENGTH_LO_SHIFT) & 0xF) |
6854 | #define DSHI(x) (((x) >> DRIVE_STRENGTH_HI_SHIFT) & 0xF) |
6855 | @@ -925,31 +924,31 @@ struct npcm7xx_pincfg { |
6856 | static const struct npcm7xx_pincfg pincfg[] = { |
6857 | /* PIN FUNCTION 1 FUNCTION 2 FUNCTION 3 FLAGS */ |
6858 | NPCM7XX_PINCFG(0, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, 0), |
6859 | - NPCM7XX_PINCFG(1, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6860 | - NPCM7XX_PINCFG(2, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6861 | + NPCM7XX_PINCFG(1, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6862 | + NPCM7XX_PINCFG(2, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6863 | NPCM7XX_PINCFG(3, iox1, MFSEL1, 30, none, NONE, 0, none, NONE, 0, 0), |
6864 | NPCM7XX_PINCFG(4, iox2, MFSEL3, 14, smb1d, I2CSEGSEL, 7, none, NONE, 0, SLEW), |
6865 | NPCM7XX_PINCFG(5, iox2, MFSEL3, 14, smb1d, I2CSEGSEL, 7, none, NONE, 0, SLEW), |
6866 | NPCM7XX_PINCFG(6, iox2, MFSEL3, 14, smb2d, I2CSEGSEL, 10, none, NONE, 0, SLEW), |
6867 | NPCM7XX_PINCFG(7, iox2, MFSEL3, 14, smb2d, I2CSEGSEL, 10, none, NONE, 0, SLEW), |
6868 | - NPCM7XX_PINCFG(8, lkgpo1, FLOCKR1, 4, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6869 | - NPCM7XX_PINCFG(9, lkgpo2, FLOCKR1, 8, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6870 | - NPCM7XX_PINCFG(10, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6871 | - NPCM7XX_PINCFG(11, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6872 | + NPCM7XX_PINCFG(8, lkgpo1, FLOCKR1, 4, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6873 | + NPCM7XX_PINCFG(9, lkgpo2, FLOCKR1, 8, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6874 | + NPCM7XX_PINCFG(10, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6875 | + NPCM7XX_PINCFG(11, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6876 | NPCM7XX_PINCFG(12, gspi, MFSEL1, 24, smb5b, I2CSEGSEL, 19, none, NONE, 0, SLEW), |
6877 | NPCM7XX_PINCFG(13, gspi, MFSEL1, 24, smb5b, I2CSEGSEL, 19, none, NONE, 0, SLEW), |
6878 | NPCM7XX_PINCFG(14, gspi, MFSEL1, 24, smb5c, I2CSEGSEL, 20, none, NONE, 0, SLEW), |
6879 | NPCM7XX_PINCFG(15, gspi, MFSEL1, 24, smb5c, I2CSEGSEL, 20, none, NONE, 0, SLEW), |
6880 | - NPCM7XX_PINCFG(16, lkgpo0, FLOCKR1, 0, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6881 | - NPCM7XX_PINCFG(17, pspi2, MFSEL3, 13, smb4den, I2CSEGSEL, 23, none, NONE, 0, DS(8, 12)), |
6882 | - NPCM7XX_PINCFG(18, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DS(8, 12)), |
6883 | - NPCM7XX_PINCFG(19, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DS(8, 12)), |
6884 | + NPCM7XX_PINCFG(16, lkgpo0, FLOCKR1, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6885 | + NPCM7XX_PINCFG(17, pspi2, MFSEL3, 13, smb4den, I2CSEGSEL, 23, none, NONE, 0, DSTR(8, 12)), |
6886 | + NPCM7XX_PINCFG(18, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DSTR(8, 12)), |
6887 | + NPCM7XX_PINCFG(19, pspi2, MFSEL3, 13, smb4b, I2CSEGSEL, 14, none, NONE, 0, DSTR(8, 12)), |
6888 | NPCM7XX_PINCFG(20, smb4c, I2CSEGSEL, 15, smb15, MFSEL3, 8, none, NONE, 0, 0), |
6889 | NPCM7XX_PINCFG(21, smb4c, I2CSEGSEL, 15, smb15, MFSEL3, 8, none, NONE, 0, 0), |
6890 | NPCM7XX_PINCFG(22, smb4d, I2CSEGSEL, 16, smb14, MFSEL3, 7, none, NONE, 0, 0), |
6891 | NPCM7XX_PINCFG(23, smb4d, I2CSEGSEL, 16, smb14, MFSEL3, 7, none, NONE, 0, 0), |
6892 | - NPCM7XX_PINCFG(24, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6893 | - NPCM7XX_PINCFG(25, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
6894 | + NPCM7XX_PINCFG(24, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6895 | + NPCM7XX_PINCFG(25, ioxh, MFSEL3, 18, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
6896 | NPCM7XX_PINCFG(26, smb5, MFSEL1, 2, none, NONE, 0, none, NONE, 0, 0), |
6897 | NPCM7XX_PINCFG(27, smb5, MFSEL1, 2, none, NONE, 0, none, NONE, 0, 0), |
6898 | NPCM7XX_PINCFG(28, smb4, MFSEL1, 1, none, NONE, 0, none, NONE, 0, 0), |
6899 | @@ -965,12 +964,12 @@ static const struct npcm7xx_pincfg pincfg[] = { |
6900 | NPCM7XX_PINCFG(39, smb3b, I2CSEGSEL, 11, none, NONE, 0, none, NONE, 0, SLEW), |
6901 | NPCM7XX_PINCFG(40, smb3b, I2CSEGSEL, 11, none, NONE, 0, none, NONE, 0, SLEW), |
6902 | NPCM7XX_PINCFG(41, bmcuart0a, MFSEL1, 9, none, NONE, 0, none, NONE, 0, 0), |
6903 | - NPCM7XX_PINCFG(42, bmcuart0a, MFSEL1, 9, none, NONE, 0, none, NONE, 0, DS(2, 4) | GPO), |
6904 | + NPCM7XX_PINCFG(42, bmcuart0a, MFSEL1, 9, none, NONE, 0, none, NONE, 0, DSTR(2, 4) | GPO), |
6905 | NPCM7XX_PINCFG(43, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, bmcuart1, MFSEL3, 24, 0), |
6906 | NPCM7XX_PINCFG(44, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, bmcuart1, MFSEL3, 24, 0), |
6907 | NPCM7XX_PINCFG(45, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, 0), |
6908 | - NPCM7XX_PINCFG(46, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DS(2, 8)), |
6909 | - NPCM7XX_PINCFG(47, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DS(2, 8)), |
6910 | + NPCM7XX_PINCFG(46, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DSTR(2, 8)), |
6911 | + NPCM7XX_PINCFG(47, uart1, MFSEL1, 10, jtag2, MFSEL4, 0, none, NONE, 0, DSTR(2, 8)), |
6912 | NPCM7XX_PINCFG(48, uart2, MFSEL1, 11, bmcuart0b, MFSEL4, 1, none, NONE, 0, GPO), |
6913 | NPCM7XX_PINCFG(49, uart2, MFSEL1, 11, bmcuart0b, MFSEL4, 1, none, NONE, 0, 0), |
6914 | NPCM7XX_PINCFG(50, uart2, MFSEL1, 11, none, NONE, 0, none, NONE, 0, 0), |
6915 | @@ -980,8 +979,8 @@ static const struct npcm7xx_pincfg pincfg[] = { |
6916 | NPCM7XX_PINCFG(54, uart2, MFSEL1, 11, none, NONE, 0, none, NONE, 0, 0), |
6917 | NPCM7XX_PINCFG(55, uart2, MFSEL1, 11, none, NONE, 0, none, NONE, 0, 0), |
6918 | NPCM7XX_PINCFG(56, r1err, MFSEL1, 12, none, NONE, 0, none, NONE, 0, 0), |
6919 | - NPCM7XX_PINCFG(57, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
6920 | - NPCM7XX_PINCFG(58, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
6921 | + NPCM7XX_PINCFG(57, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
6922 | + NPCM7XX_PINCFG(58, r1md, MFSEL1, 13, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
6923 | NPCM7XX_PINCFG(59, smb3d, I2CSEGSEL, 13, none, NONE, 0, none, NONE, 0, 0), |
6924 | NPCM7XX_PINCFG(60, smb3d, I2CSEGSEL, 13, none, NONE, 0, none, NONE, 0, 0), |
6925 | NPCM7XX_PINCFG(61, uart1, MFSEL1, 10, none, NONE, 0, none, NONE, 0, GPO), |
6926 | @@ -1004,19 +1003,19 @@ static const struct npcm7xx_pincfg pincfg[] = { |
6927 | NPCM7XX_PINCFG(77, fanin13, MFSEL2, 13, none, NONE, 0, none, NONE, 0, 0), |
6928 | NPCM7XX_PINCFG(78, fanin14, MFSEL2, 14, none, NONE, 0, none, NONE, 0, 0), |
6929 | NPCM7XX_PINCFG(79, fanin15, MFSEL2, 15, none, NONE, 0, none, NONE, 0, 0), |
6930 | - NPCM7XX_PINCFG(80, pwm0, MFSEL2, 16, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6931 | - NPCM7XX_PINCFG(81, pwm1, MFSEL2, 17, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6932 | - NPCM7XX_PINCFG(82, pwm2, MFSEL2, 18, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6933 | - NPCM7XX_PINCFG(83, pwm3, MFSEL2, 19, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6934 | - NPCM7XX_PINCFG(84, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6935 | - NPCM7XX_PINCFG(85, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6936 | - NPCM7XX_PINCFG(86, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6937 | + NPCM7XX_PINCFG(80, pwm0, MFSEL2, 16, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6938 | + NPCM7XX_PINCFG(81, pwm1, MFSEL2, 17, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6939 | + NPCM7XX_PINCFG(82, pwm2, MFSEL2, 18, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6940 | + NPCM7XX_PINCFG(83, pwm3, MFSEL2, 19, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6941 | + NPCM7XX_PINCFG(84, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6942 | + NPCM7XX_PINCFG(85, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6943 | + NPCM7XX_PINCFG(86, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6944 | NPCM7XX_PINCFG(87, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
6945 | NPCM7XX_PINCFG(88, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
6946 | NPCM7XX_PINCFG(89, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
6947 | NPCM7XX_PINCFG(90, r2err, MFSEL1, 15, none, NONE, 0, none, NONE, 0, 0), |
6948 | - NPCM7XX_PINCFG(91, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
6949 | - NPCM7XX_PINCFG(92, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DS(2, 4)), |
6950 | + NPCM7XX_PINCFG(91, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
6951 | + NPCM7XX_PINCFG(92, r2md, MFSEL1, 16, none, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
6952 | NPCM7XX_PINCFG(93, ga20kbc, MFSEL1, 17, smb5d, I2CSEGSEL, 21, none, NONE, 0, 0), |
6953 | NPCM7XX_PINCFG(94, ga20kbc, MFSEL1, 17, smb5d, I2CSEGSEL, 21, none, NONE, 0, 0), |
6954 | NPCM7XX_PINCFG(95, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, 0), |
6955 | @@ -1062,34 +1061,34 @@ static const struct npcm7xx_pincfg pincfg[] = { |
6956 | NPCM7XX_PINCFG(133, smb10, MFSEL4, 13, none, NONE, 0, none, NONE, 0, 0), |
6957 | NPCM7XX_PINCFG(134, smb11, MFSEL4, 14, none, NONE, 0, none, NONE, 0, 0), |
6958 | NPCM7XX_PINCFG(135, smb11, MFSEL4, 14, none, NONE, 0, none, NONE, 0, 0), |
6959 | - NPCM7XX_PINCFG(136, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6960 | - NPCM7XX_PINCFG(137, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6961 | - NPCM7XX_PINCFG(138, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6962 | - NPCM7XX_PINCFG(139, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6963 | - NPCM7XX_PINCFG(140, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6964 | + NPCM7XX_PINCFG(136, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6965 | + NPCM7XX_PINCFG(137, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6966 | + NPCM7XX_PINCFG(138, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6967 | + NPCM7XX_PINCFG(139, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6968 | + NPCM7XX_PINCFG(140, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6969 | NPCM7XX_PINCFG(141, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, 0), |
6970 | - NPCM7XX_PINCFG(142, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6971 | + NPCM7XX_PINCFG(142, sd1, MFSEL3, 12, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6972 | NPCM7XX_PINCFG(143, sd1, MFSEL3, 12, sd1pwr, MFSEL4, 5, none, NONE, 0, 0), |
6973 | - NPCM7XX_PINCFG(144, pwm4, MFSEL2, 20, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6974 | - NPCM7XX_PINCFG(145, pwm5, MFSEL2, 21, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6975 | - NPCM7XX_PINCFG(146, pwm6, MFSEL2, 22, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6976 | - NPCM7XX_PINCFG(147, pwm7, MFSEL2, 23, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
6977 | - NPCM7XX_PINCFG(148, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6978 | - NPCM7XX_PINCFG(149, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6979 | - NPCM7XX_PINCFG(150, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6980 | - NPCM7XX_PINCFG(151, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6981 | - NPCM7XX_PINCFG(152, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6982 | + NPCM7XX_PINCFG(144, pwm4, MFSEL2, 20, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6983 | + NPCM7XX_PINCFG(145, pwm5, MFSEL2, 21, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6984 | + NPCM7XX_PINCFG(146, pwm6, MFSEL2, 22, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6985 | + NPCM7XX_PINCFG(147, pwm7, MFSEL2, 23, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
6986 | + NPCM7XX_PINCFG(148, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6987 | + NPCM7XX_PINCFG(149, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6988 | + NPCM7XX_PINCFG(150, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6989 | + NPCM7XX_PINCFG(151, mmc8, MFSEL3, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6990 | + NPCM7XX_PINCFG(152, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6991 | NPCM7XX_PINCFG(153, mmcwp, FLOCKR1, 24, none, NONE, 0, none, NONE, 0, 0), /* Z1/A1 */ |
6992 | - NPCM7XX_PINCFG(154, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6993 | + NPCM7XX_PINCFG(154, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
6994 | NPCM7XX_PINCFG(155, mmccd, MFSEL3, 25, mmcrst, MFSEL4, 6, none, NONE, 0, 0), /* Z1/A1 */ |
6995 | - NPCM7XX_PINCFG(156, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6996 | - NPCM7XX_PINCFG(157, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6997 | - NPCM7XX_PINCFG(158, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6998 | - NPCM7XX_PINCFG(159, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
6999 | - |
7000 | - NPCM7XX_PINCFG(160, clkout, MFSEL1, 21, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7001 | - NPCM7XX_PINCFG(161, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, DS(8, 12)), |
7002 | - NPCM7XX_PINCFG(162, serirq, NONE, 0, gpio, MFSEL1, 31, none, NONE, 0, DS(8, 12)), |
7003 | + NPCM7XX_PINCFG(156, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7004 | + NPCM7XX_PINCFG(157, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7005 | + NPCM7XX_PINCFG(158, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7006 | + NPCM7XX_PINCFG(159, mmc, MFSEL3, 10, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7007 | + |
7008 | + NPCM7XX_PINCFG(160, clkout, MFSEL1, 21, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7009 | + NPCM7XX_PINCFG(161, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, DSTR(8, 12)), |
7010 | + NPCM7XX_PINCFG(162, serirq, NONE, 0, gpio, MFSEL1, 31, none, NONE, 0, DSTR(8, 12)), |
7011 | NPCM7XX_PINCFG(163, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, 0), |
7012 | NPCM7XX_PINCFG(164, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, SLEWLPC), |
7013 | NPCM7XX_PINCFG(165, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, SLEWLPC), |
7014 | @@ -1102,25 +1101,25 @@ static const struct npcm7xx_pincfg pincfg[] = { |
7015 | NPCM7XX_PINCFG(172, smb6, MFSEL3, 1, none, NONE, 0, none, NONE, 0, 0), |
7016 | NPCM7XX_PINCFG(173, smb7, MFSEL3, 2, none, NONE, 0, none, NONE, 0, 0), |
7017 | NPCM7XX_PINCFG(174, smb7, MFSEL3, 2, none, NONE, 0, none, NONE, 0, 0), |
7018 | - NPCM7XX_PINCFG(175, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DS(8, 12)), |
7019 | - NPCM7XX_PINCFG(176, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DS(8, 12)), |
7020 | - NPCM7XX_PINCFG(177, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DS(8, 12)), |
7021 | - NPCM7XX_PINCFG(178, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7022 | - NPCM7XX_PINCFG(179, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7023 | - NPCM7XX_PINCFG(180, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7024 | + NPCM7XX_PINCFG(175, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DSTR(8, 12)), |
7025 | + NPCM7XX_PINCFG(176, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DSTR(8, 12)), |
7026 | + NPCM7XX_PINCFG(177, pspi1, MFSEL3, 4, faninx, MFSEL3, 3, none, NONE, 0, DSTR(8, 12)), |
7027 | + NPCM7XX_PINCFG(178, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7028 | + NPCM7XX_PINCFG(179, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7029 | + NPCM7XX_PINCFG(180, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7030 | NPCM7XX_PINCFG(181, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
7031 | NPCM7XX_PINCFG(182, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
7032 | - NPCM7XX_PINCFG(183, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7033 | - NPCM7XX_PINCFG(184, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
7034 | - NPCM7XX_PINCFG(185, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
7035 | - NPCM7XX_PINCFG(186, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
7036 | - NPCM7XX_PINCFG(187, spi3cs1, MFSEL4, 17, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
7037 | - NPCM7XX_PINCFG(188, spi3quad, MFSEL4, 20, spi3cs2, MFSEL4, 18, none, NONE, 0, DS(8, 12) | SLEW), |
7038 | - NPCM7XX_PINCFG(189, spi3quad, MFSEL4, 20, spi3cs3, MFSEL4, 19, none, NONE, 0, DS(8, 12) | SLEW), |
7039 | - NPCM7XX_PINCFG(190, gpio, FLOCKR1, 20, nprd_smi, NONE, 0, none, NONE, 0, DS(2, 4)), |
7040 | - NPCM7XX_PINCFG(191, none, NONE, 0, none, NONE, 0, none, NONE, 0, DS(8, 12)), /* XX */ |
7041 | - |
7042 | - NPCM7XX_PINCFG(192, none, NONE, 0, none, NONE, 0, none, NONE, 0, DS(8, 12)), /* XX */ |
7043 | + NPCM7XX_PINCFG(183, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7044 | + NPCM7XX_PINCFG(184, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
7045 | + NPCM7XX_PINCFG(185, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
7046 | + NPCM7XX_PINCFG(186, spi3, MFSEL4, 16, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
7047 | + NPCM7XX_PINCFG(187, spi3cs1, MFSEL4, 17, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
7048 | + NPCM7XX_PINCFG(188, spi3quad, MFSEL4, 20, spi3cs2, MFSEL4, 18, none, NONE, 0, DSTR(8, 12) | SLEW), |
7049 | + NPCM7XX_PINCFG(189, spi3quad, MFSEL4, 20, spi3cs3, MFSEL4, 19, none, NONE, 0, DSTR(8, 12) | SLEW), |
7050 | + NPCM7XX_PINCFG(190, gpio, FLOCKR1, 20, nprd_smi, NONE, 0, none, NONE, 0, DSTR(2, 4)), |
7051 | + NPCM7XX_PINCFG(191, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), /* XX */ |
7052 | + |
7053 | + NPCM7XX_PINCFG(192, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), /* XX */ |
7054 | NPCM7XX_PINCFG(193, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
7055 | NPCM7XX_PINCFG(194, smb0b, I2CSEGSEL, 0, none, NONE, 0, none, NONE, 0, 0), |
7056 | NPCM7XX_PINCFG(195, smb0b, I2CSEGSEL, 0, none, NONE, 0, none, NONE, 0, 0), |
7057 | @@ -1131,11 +1130,11 @@ static const struct npcm7xx_pincfg pincfg[] = { |
7058 | NPCM7XX_PINCFG(200, r2, MFSEL1, 14, none, NONE, 0, none, NONE, 0, 0), |
7059 | NPCM7XX_PINCFG(201, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, 0), |
7060 | NPCM7XX_PINCFG(202, smb0c, I2CSEGSEL, 1, none, NONE, 0, none, NONE, 0, 0), |
7061 | - NPCM7XX_PINCFG(203, faninx, MFSEL3, 3, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
7062 | + NPCM7XX_PINCFG(203, faninx, MFSEL3, 3, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
7063 | NPCM7XX_PINCFG(204, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, SLEW), |
7064 | NPCM7XX_PINCFG(205, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, SLEW), |
7065 | - NPCM7XX_PINCFG(206, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DS(4, 8)), |
7066 | - NPCM7XX_PINCFG(207, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DS(4, 8)), |
7067 | + NPCM7XX_PINCFG(206, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DSTR(4, 8)), |
7068 | + NPCM7XX_PINCFG(207, ddc, NONE, 0, gpio, MFSEL3, 22, none, NONE, 0, DSTR(4, 8)), |
7069 | NPCM7XX_PINCFG(208, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, 0), |
7070 | NPCM7XX_PINCFG(209, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, 0), |
7071 | NPCM7XX_PINCFG(210, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, 0), |
7072 | @@ -1147,20 +1146,20 @@ static const struct npcm7xx_pincfg pincfg[] = { |
7073 | NPCM7XX_PINCFG(216, rg2mdio, MFSEL4, 23, ddr, MFSEL3, 26, none, NONE, 0, 0), |
7074 | NPCM7XX_PINCFG(217, rg2mdio, MFSEL4, 23, ddr, MFSEL3, 26, none, NONE, 0, 0), |
7075 | NPCM7XX_PINCFG(218, wdog1, MFSEL3, 19, none, NONE, 0, none, NONE, 0, 0), |
7076 | - NPCM7XX_PINCFG(219, wdog2, MFSEL3, 20, none, NONE, 0, none, NONE, 0, DS(4, 8)), |
7077 | + NPCM7XX_PINCFG(219, wdog2, MFSEL3, 20, none, NONE, 0, none, NONE, 0, DSTR(4, 8)), |
7078 | NPCM7XX_PINCFG(220, smb12, MFSEL3, 5, none, NONE, 0, none, NONE, 0, 0), |
7079 | NPCM7XX_PINCFG(221, smb12, MFSEL3, 5, none, NONE, 0, none, NONE, 0, 0), |
7080 | NPCM7XX_PINCFG(222, smb13, MFSEL3, 6, none, NONE, 0, none, NONE, 0, 0), |
7081 | NPCM7XX_PINCFG(223, smb13, MFSEL3, 6, none, NONE, 0, none, NONE, 0, 0), |
7082 | |
7083 | NPCM7XX_PINCFG(224, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, SLEW), |
7084 | - NPCM7XX_PINCFG(225, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
7085 | - NPCM7XX_PINCFG(226, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW | GPO), |
7086 | - NPCM7XX_PINCFG(227, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7087 | - NPCM7XX_PINCFG(228, spixcs1, MFSEL4, 28, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7088 | - NPCM7XX_PINCFG(229, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7089 | - NPCM7XX_PINCFG(230, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DS(8, 12) | SLEW), |
7090 | - NPCM7XX_PINCFG(231, clkreq, MFSEL4, 9, none, NONE, 0, none, NONE, 0, DS(8, 12)), |
7091 | + NPCM7XX_PINCFG(225, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
7092 | + NPCM7XX_PINCFG(226, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW | GPO), |
7093 | + NPCM7XX_PINCFG(227, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7094 | + NPCM7XX_PINCFG(228, spixcs1, MFSEL4, 28, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7095 | + NPCM7XX_PINCFG(229, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7096 | + NPCM7XX_PINCFG(230, spix, MFSEL4, 27, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW), |
7097 | + NPCM7XX_PINCFG(231, clkreq, MFSEL4, 9, none, NONE, 0, none, NONE, 0, DSTR(8, 12)), |
7098 | NPCM7XX_PINCFG(253, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPI), /* SDHC1 power */ |
7099 | NPCM7XX_PINCFG(254, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPI), /* SDHC2 power */ |
7100 | NPCM7XX_PINCFG(255, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPI), /* DACOSEL */ |
7101 | @@ -1561,7 +1560,7 @@ static int npcm7xx_get_groups_count(struct pinctrl_dev *pctldev) |
7102 | { |
7103 | struct npcm7xx_pinctrl *npcm = pinctrl_dev_get_drvdata(pctldev); |
7104 | |
7105 | - dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups)); |
7106 | + dev_dbg(npcm->dev, "group size: %zu\n", ARRAY_SIZE(npcm7xx_groups)); |
7107 | return ARRAY_SIZE(npcm7xx_groups); |
7108 | } |
7109 | |
7110 | diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c |
7111 | index 9eb86309c70bf..355bc4c748e26 100644 |
7112 | --- a/drivers/pinctrl/pinconf-generic.c |
7113 | +++ b/drivers/pinctrl/pinconf-generic.c |
7114 | @@ -30,10 +30,10 @@ static const struct pin_config_item conf_items[] = { |
7115 | PCONFDUMP(PIN_CONFIG_BIAS_BUS_HOLD, "input bias bus hold", NULL, false), |
7116 | PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL, false), |
7117 | PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL, false), |
7118 | - PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", NULL, false), |
7119 | + PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", "ohms", true), |
7120 | PCONFDUMP(PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, |
7121 | - "input bias pull to pin specific state", NULL, false), |
7122 | - PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL, false), |
7123 | + "input bias pull to pin specific state", "ohms", true), |
7124 | + PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", "ohms", true), |
7125 | PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL, false), |
7126 | PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL, false), |
7127 | PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL, false), |
7128 | diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c |
7129 | index 59fe3204e965d..4b972be3487f9 100644 |
7130 | --- a/drivers/pinctrl/pinctrl-rockchip.c |
7131 | +++ b/drivers/pinctrl/pinctrl-rockchip.c |
7132 | @@ -3433,6 +3433,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
7133 | node = of_parse_phandle(np, "rockchip,grf", 0); |
7134 | if (node) { |
7135 | info->regmap_base = syscon_node_to_regmap(node); |
7136 | + of_node_put(node); |
7137 | if (IS_ERR(info->regmap_base)) |
7138 | return PTR_ERR(info->regmap_base); |
7139 | } else { |
7140 | @@ -3469,6 +3470,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) |
7141 | node = of_parse_phandle(np, "rockchip,pmu", 0); |
7142 | if (node) { |
7143 | info->regmap_pmu = syscon_node_to_regmap(node); |
7144 | + of_node_put(node); |
7145 | if (IS_ERR(info->regmap_pmu)) |
7146 | return PTR_ERR(info->regmap_pmu); |
7147 | } |
7148 | diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c |
7149 | index 601fffeba39fe..131fa7958f754 100644 |
7150 | --- a/drivers/pinctrl/samsung/pinctrl-samsung.c |
7151 | +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c |
7152 | @@ -1002,6 +1002,16 @@ samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev) |
7153 | return &(of_data->ctrl[id]); |
7154 | } |
7155 | |
7156 | +static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d) |
7157 | +{ |
7158 | + struct samsung_pin_bank *bank; |
7159 | + unsigned int i; |
7160 | + |
7161 | + bank = d->pin_banks; |
7162 | + for (i = 0; i < d->nr_banks; ++i, ++bank) |
7163 | + of_node_put(bank->of_node); |
7164 | +} |
7165 | + |
7166 | /* retrieve the soc specific data */ |
7167 | static const struct samsung_pin_ctrl * |
7168 | samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, |
7169 | @@ -1116,19 +1126,19 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) |
7170 | if (ctrl->retention_data) { |
7171 | drvdata->retention_ctrl = ctrl->retention_data->init(drvdata, |
7172 | ctrl->retention_data); |
7173 | - if (IS_ERR(drvdata->retention_ctrl)) |
7174 | - return PTR_ERR(drvdata->retention_ctrl); |
7175 | + if (IS_ERR(drvdata->retention_ctrl)) { |
7176 | + ret = PTR_ERR(drvdata->retention_ctrl); |
7177 | + goto err_put_banks; |
7178 | + } |
7179 | } |
7180 | |
7181 | ret = samsung_pinctrl_register(pdev, drvdata); |
7182 | if (ret) |
7183 | - return ret; |
7184 | + goto err_put_banks; |
7185 | |
7186 | ret = samsung_gpiolib_register(pdev, drvdata); |
7187 | - if (ret) { |
7188 | - samsung_pinctrl_unregister(pdev, drvdata); |
7189 | - return ret; |
7190 | - } |
7191 | + if (ret) |
7192 | + goto err_unregister; |
7193 | |
7194 | if (ctrl->eint_gpio_init) |
7195 | ctrl->eint_gpio_init(drvdata); |
7196 | @@ -1138,6 +1148,12 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) |
7197 | platform_set_drvdata(pdev, drvdata); |
7198 | |
7199 | return 0; |
7200 | + |
7201 | +err_unregister: |
7202 | + samsung_pinctrl_unregister(pdev, drvdata); |
7203 | +err_put_banks: |
7204 | + samsung_banks_of_node_put(drvdata); |
7205 | + return ret; |
7206 | } |
7207 | |
7208 | /** |
7209 | diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77470.c b/drivers/pinctrl/sh-pfc/pfc-r8a77470.c |
7210 | index b3b116da1bb0d..14005725a726b 100644 |
7211 | --- a/drivers/pinctrl/sh-pfc/pfc-r8a77470.c |
7212 | +++ b/drivers/pinctrl/sh-pfc/pfc-r8a77470.c |
7213 | @@ -2121,7 +2121,7 @@ static const unsigned int vin0_clk_mux[] = { |
7214 | VI0_CLK_MARK, |
7215 | }; |
7216 | /* - VIN1 ------------------------------------------------------------------- */ |
7217 | -static const union vin_data vin1_data_pins = { |
7218 | +static const union vin_data12 vin1_data_pins = { |
7219 | .data12 = { |
7220 | RCAR_GP_PIN(3, 1), RCAR_GP_PIN(3, 2), |
7221 | RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4), |
7222 | @@ -2131,7 +2131,7 @@ static const union vin_data vin1_data_pins = { |
7223 | RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16), |
7224 | }, |
7225 | }; |
7226 | -static const union vin_data vin1_data_mux = { |
7227 | +static const union vin_data12 vin1_data_mux = { |
7228 | .data12 = { |
7229 | VI1_DATA0_MARK, VI1_DATA1_MARK, |
7230 | VI1_DATA2_MARK, VI1_DATA3_MARK, |
7231 | diff --git a/drivers/power/reset/gemini-poweroff.c b/drivers/power/reset/gemini-poweroff.c |
7232 | index 90e35c07240ae..b7f7a8225f22e 100644 |
7233 | --- a/drivers/power/reset/gemini-poweroff.c |
7234 | +++ b/drivers/power/reset/gemini-poweroff.c |
7235 | @@ -107,8 +107,8 @@ static int gemini_poweroff_probe(struct platform_device *pdev) |
7236 | return PTR_ERR(gpw->base); |
7237 | |
7238 | irq = platform_get_irq(pdev, 0); |
7239 | - if (!irq) |
7240 | - return -EINVAL; |
7241 | + if (irq < 0) |
7242 | + return irq; |
7243 | |
7244 | gpw->dev = dev; |
7245 | |
7246 | diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c |
7247 | index 69452fc085b99..4c229e6fb750a 100644 |
7248 | --- a/drivers/power/supply/ab8500_fg.c |
7249 | +++ b/drivers/power/supply/ab8500_fg.c |
7250 | @@ -2541,8 +2541,10 @@ static int ab8500_fg_sysfs_init(struct ab8500_fg *di) |
7251 | ret = kobject_init_and_add(&di->fg_kobject, |
7252 | &ab8500_fg_ktype, |
7253 | NULL, "battery"); |
7254 | - if (ret < 0) |
7255 | + if (ret < 0) { |
7256 | + kobject_put(&di->fg_kobject); |
7257 | dev_err(di->dev, "failed to create sysfs entry\n"); |
7258 | + } |
7259 | |
7260 | return ret; |
7261 | } |
7262 | diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c |
7263 | index e84b6e4da14a8..9fda98b950bab 100644 |
7264 | --- a/drivers/power/supply/axp20x_battery.c |
7265 | +++ b/drivers/power/supply/axp20x_battery.c |
7266 | @@ -185,7 +185,6 @@ static int axp20x_battery_get_prop(struct power_supply *psy, |
7267 | union power_supply_propval *val) |
7268 | { |
7269 | struct axp20x_batt_ps *axp20x_batt = power_supply_get_drvdata(psy); |
7270 | - struct iio_channel *chan; |
7271 | int ret = 0, reg, val1; |
7272 | |
7273 | switch (psp) { |
7274 | @@ -265,12 +264,12 @@ static int axp20x_battery_get_prop(struct power_supply *psy, |
7275 | if (ret) |
7276 | return ret; |
7277 | |
7278 | - if (reg & AXP20X_PWR_STATUS_BAT_CHARGING) |
7279 | - chan = axp20x_batt->batt_chrg_i; |
7280 | - else |
7281 | - chan = axp20x_batt->batt_dischrg_i; |
7282 | - |
7283 | - ret = iio_read_channel_processed(chan, &val->intval); |
7284 | + if (reg & AXP20X_PWR_STATUS_BAT_CHARGING) { |
7285 | + ret = iio_read_channel_processed(axp20x_batt->batt_chrg_i, &val->intval); |
7286 | + } else { |
7287 | + ret = iio_read_channel_processed(axp20x_batt->batt_dischrg_i, &val1); |
7288 | + val->intval = -val1; |
7289 | + } |
7290 | if (ret) |
7291 | return ret; |
7292 | |
7293 | diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c |
7294 | index 7d09e49f04d3b..2ee6bb7c08045 100644 |
7295 | --- a/drivers/power/supply/axp288_charger.c |
7296 | +++ b/drivers/power/supply/axp288_charger.c |
7297 | @@ -41,11 +41,11 @@ |
7298 | #define VBUS_ISPOUT_CUR_LIM_1500MA 0x1 /* 1500mA */ |
7299 | #define VBUS_ISPOUT_CUR_LIM_2000MA 0x2 /* 2000mA */ |
7300 | #define VBUS_ISPOUT_CUR_NO_LIM 0x3 /* 2500mA */ |
7301 | -#define VBUS_ISPOUT_VHOLD_SET_MASK 0x31 |
7302 | +#define VBUS_ISPOUT_VHOLD_SET_MASK 0x38 |
7303 | #define VBUS_ISPOUT_VHOLD_SET_BIT_POS 0x3 |
7304 | #define VBUS_ISPOUT_VHOLD_SET_OFFSET 4000 /* 4000mV */ |
7305 | #define VBUS_ISPOUT_VHOLD_SET_LSB_RES 100 /* 100mV */ |
7306 | -#define VBUS_ISPOUT_VHOLD_SET_4300MV 0x3 /* 4300mV */ |
7307 | +#define VBUS_ISPOUT_VHOLD_SET_4400MV 0x4 /* 4400mV */ |
7308 | #define VBUS_ISPOUT_VBUS_PATH_DIS BIT(7) |
7309 | |
7310 | #define CHRG_CCCV_CC_MASK 0xf /* 4 bits */ |
7311 | @@ -744,6 +744,16 @@ static int charger_init_hw_regs(struct axp288_chrg_info *info) |
7312 | ret = axp288_charger_vbus_path_select(info, true); |
7313 | if (ret < 0) |
7314 | return ret; |
7315 | + } else { |
7316 | + /* Set Vhold to the factory default / recommended 4.4V */ |
7317 | + val = VBUS_ISPOUT_VHOLD_SET_4400MV << VBUS_ISPOUT_VHOLD_SET_BIT_POS; |
7318 | + ret = regmap_update_bits(info->regmap, AXP20X_VBUS_IPSOUT_MGMT, |
7319 | + VBUS_ISPOUT_VHOLD_SET_MASK, val); |
7320 | + if (ret < 0) { |
7321 | + dev_err(&info->pdev->dev, "register(%x) write error(%d)\n", |
7322 | + AXP20X_VBUS_IPSOUT_MGMT, ret); |
7323 | + return ret; |
7324 | + } |
7325 | } |
7326 | |
7327 | /* Read current charge voltage and current limit */ |
7328 | diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c |
7329 | index 1ae5d6d42c9e3..64d87dccea82c 100644 |
7330 | --- a/drivers/power/supply/bq24190_charger.c |
7331 | +++ b/drivers/power/supply/bq24190_charger.c |
7332 | @@ -41,6 +41,7 @@ |
7333 | #define BQ24190_REG_POC_CHG_CONFIG_DISABLE 0x0 |
7334 | #define BQ24190_REG_POC_CHG_CONFIG_CHARGE 0x1 |
7335 | #define BQ24190_REG_POC_CHG_CONFIG_OTG 0x2 |
7336 | +#define BQ24190_REG_POC_CHG_CONFIG_OTG_ALT 0x3 |
7337 | #define BQ24190_REG_POC_SYS_MIN_MASK (BIT(3) | BIT(2) | BIT(1)) |
7338 | #define BQ24190_REG_POC_SYS_MIN_SHIFT 1 |
7339 | #define BQ24190_REG_POC_SYS_MIN_MIN 3000 |
7340 | @@ -550,7 +551,11 @@ static int bq24190_vbus_is_enabled(struct regulator_dev *dev) |
7341 | pm_runtime_mark_last_busy(bdi->dev); |
7342 | pm_runtime_put_autosuspend(bdi->dev); |
7343 | |
7344 | - return ret ? ret : val == BQ24190_REG_POC_CHG_CONFIG_OTG; |
7345 | + if (ret) |
7346 | + return ret; |
7347 | + |
7348 | + return (val == BQ24190_REG_POC_CHG_CONFIG_OTG || |
7349 | + val == BQ24190_REG_POC_CHG_CONFIG_OTG_ALT); |
7350 | } |
7351 | |
7352 | static const struct regulator_ops bq24190_vbus_ops = { |
7353 | diff --git a/drivers/power/supply/wm8350_power.c b/drivers/power/supply/wm8350_power.c |
7354 | index 26923af574f43..4fe9ea9721b39 100644 |
7355 | --- a/drivers/power/supply/wm8350_power.c |
7356 | +++ b/drivers/power/supply/wm8350_power.c |
7357 | @@ -408,44 +408,112 @@ static const struct power_supply_desc wm8350_usb_desc = { |
7358 | * Initialisation |
7359 | *********************************************************************/ |
7360 | |
7361 | -static void wm8350_init_charger(struct wm8350 *wm8350) |
7362 | +static int wm8350_init_charger(struct wm8350 *wm8350) |
7363 | { |
7364 | + int ret; |
7365 | + |
7366 | /* register our interest in charger events */ |
7367 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, |
7368 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, |
7369 | wm8350_charger_handler, 0, "Battery hot", wm8350); |
7370 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, |
7371 | + if (ret) |
7372 | + goto err; |
7373 | + |
7374 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, |
7375 | wm8350_charger_handler, 0, "Battery cold", wm8350); |
7376 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, |
7377 | + if (ret) |
7378 | + goto free_chg_bat_hot; |
7379 | + |
7380 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, |
7381 | wm8350_charger_handler, 0, "Battery fail", wm8350); |
7382 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, |
7383 | + if (ret) |
7384 | + goto free_chg_bat_cold; |
7385 | + |
7386 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, |
7387 | wm8350_charger_handler, 0, |
7388 | "Charger timeout", wm8350); |
7389 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, |
7390 | + if (ret) |
7391 | + goto free_chg_bat_fail; |
7392 | + |
7393 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, |
7394 | wm8350_charger_handler, 0, |
7395 | "Charge end", wm8350); |
7396 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, |
7397 | + if (ret) |
7398 | + goto free_chg_to; |
7399 | + |
7400 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, |
7401 | wm8350_charger_handler, 0, |
7402 | "Charge start", wm8350); |
7403 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, |
7404 | + if (ret) |
7405 | + goto free_chg_end; |
7406 | + |
7407 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, |
7408 | wm8350_charger_handler, 0, |
7409 | "Fast charge ready", wm8350); |
7410 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, |
7411 | + if (ret) |
7412 | + goto free_chg_start; |
7413 | + |
7414 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, |
7415 | wm8350_charger_handler, 0, |
7416 | "Battery <3.9V", wm8350); |
7417 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, |
7418 | + if (ret) |
7419 | + goto free_chg_fast_rdy; |
7420 | + |
7421 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, |
7422 | wm8350_charger_handler, 0, |
7423 | "Battery <3.1V", wm8350); |
7424 | - wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, |
7425 | + if (ret) |
7426 | + goto free_chg_vbatt_lt_3p9; |
7427 | + |
7428 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, |
7429 | wm8350_charger_handler, 0, |
7430 | "Battery <2.85V", wm8350); |
7431 | + if (ret) |
7432 | + goto free_chg_vbatt_lt_3p1; |
7433 | |
7434 | /* and supply change events */ |
7435 | - wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, |
7436 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, |
7437 | wm8350_charger_handler, 0, "USB", wm8350); |
7438 | - wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, |
7439 | + if (ret) |
7440 | + goto free_chg_vbatt_lt_2p85; |
7441 | + |
7442 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, |
7443 | wm8350_charger_handler, 0, "Wall", wm8350); |
7444 | - wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, |
7445 | + if (ret) |
7446 | + goto free_ext_usb_fb; |
7447 | + |
7448 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, |
7449 | wm8350_charger_handler, 0, "Battery", wm8350); |
7450 | + if (ret) |
7451 | + goto free_ext_wall_fb; |
7452 | + |
7453 | + return 0; |
7454 | + |
7455 | +free_ext_wall_fb: |
7456 | + wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, wm8350); |
7457 | +free_ext_usb_fb: |
7458 | + wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB, wm8350); |
7459 | +free_chg_vbatt_lt_2p85: |
7460 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350); |
7461 | +free_chg_vbatt_lt_3p1: |
7462 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350); |
7463 | +free_chg_vbatt_lt_3p9: |
7464 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350); |
7465 | +free_chg_fast_rdy: |
7466 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, wm8350); |
7467 | +free_chg_start: |
7468 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START, wm8350); |
7469 | +free_chg_end: |
7470 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END, wm8350); |
7471 | +free_chg_to: |
7472 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350); |
7473 | +free_chg_bat_fail: |
7474 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, wm8350); |
7475 | +free_chg_bat_cold: |
7476 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, wm8350); |
7477 | +free_chg_bat_hot: |
7478 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, wm8350); |
7479 | +err: |
7480 | + return ret; |
7481 | } |
7482 | |
7483 | static void free_charger_irq(struct wm8350 *wm8350) |
7484 | @@ -456,6 +524,7 @@ static void free_charger_irq(struct wm8350 *wm8350) |
7485 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350); |
7486 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END, wm8350); |
7487 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START, wm8350); |
7488 | + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, wm8350); |
7489 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350); |
7490 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350); |
7491 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350); |
7492 | diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c |
7493 | index be076a91e20e6..8cd59e8481631 100644 |
7494 | --- a/drivers/ptp/ptp_sysfs.c |
7495 | +++ b/drivers/ptp/ptp_sysfs.c |
7496 | @@ -13,7 +13,7 @@ static ssize_t clock_name_show(struct device *dev, |
7497 | struct device_attribute *attr, char *page) |
7498 | { |
7499 | struct ptp_clock *ptp = dev_get_drvdata(dev); |
7500 | - return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name); |
7501 | + return sysfs_emit(page, "%s\n", ptp->info->name); |
7502 | } |
7503 | static DEVICE_ATTR_RO(clock_name); |
7504 | |
7505 | @@ -227,7 +227,7 @@ static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr, |
7506 | |
7507 | mutex_unlock(&ptp->pincfg_mux); |
7508 | |
7509 | - return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan); |
7510 | + return sysfs_emit(page, "%u %u\n", func, chan); |
7511 | } |
7512 | |
7513 | static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr, |
7514 | diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c |
7515 | index 5ff11145c1a30..9b15b6a79082a 100644 |
7516 | --- a/drivers/pwm/pwm-lpc18xx-sct.c |
7517 | +++ b/drivers/pwm/pwm-lpc18xx-sct.c |
7518 | @@ -400,12 +400,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) |
7519 | lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_LIMIT, |
7520 | BIT(lpc18xx_pwm->period_event)); |
7521 | |
7522 | - ret = pwmchip_add(&lpc18xx_pwm->chip); |
7523 | - if (ret < 0) { |
7524 | - dev_err(&pdev->dev, "pwmchip_add failed: %d\n", ret); |
7525 | - goto disable_pwmclk; |
7526 | - } |
7527 | - |
7528 | for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) { |
7529 | struct lpc18xx_pwm_data *data; |
7530 | |
7531 | @@ -415,14 +409,12 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) |
7532 | GFP_KERNEL); |
7533 | if (!data) { |
7534 | ret = -ENOMEM; |
7535 | - goto remove_pwmchip; |
7536 | + goto disable_pwmclk; |
7537 | } |
7538 | |
7539 | pwm_set_chip_data(pwm, data); |
7540 | } |
7541 | |
7542 | - platform_set_drvdata(pdev, lpc18xx_pwm); |
7543 | - |
7544 | val = lpc18xx_pwm_readl(lpc18xx_pwm, LPC18XX_PWM_CTRL); |
7545 | val &= ~LPC18XX_PWM_BIDIR; |
7546 | val &= ~LPC18XX_PWM_CTRL_HALT; |
7547 | @@ -430,10 +422,16 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) |
7548 | val |= LPC18XX_PWM_PRE(0); |
7549 | lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CTRL, val); |
7550 | |
7551 | + ret = pwmchip_add(&lpc18xx_pwm->chip); |
7552 | + if (ret < 0) { |
7553 | + dev_err(&pdev->dev, "pwmchip_add failed: %d\n", ret); |
7554 | + goto disable_pwmclk; |
7555 | + } |
7556 | + |
7557 | + platform_set_drvdata(pdev, lpc18xx_pwm); |
7558 | + |
7559 | return 0; |
7560 | |
7561 | -remove_pwmchip: |
7562 | - pwmchip_remove(&lpc18xx_pwm->chip); |
7563 | disable_pwmclk: |
7564 | clk_disable_unprepare(lpc18xx_pwm->pwm_clk); |
7565 | return ret; |
7566 | diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c |
7567 | index e6601c28ab431..a4c82f5e2dae7 100644 |
7568 | --- a/drivers/regulator/qcom_smd-regulator.c |
7569 | +++ b/drivers/regulator/qcom_smd-regulator.c |
7570 | @@ -854,8 +854,10 @@ static int rpm_reg_probe(struct platform_device *pdev) |
7571 | |
7572 | for_each_available_child_of_node(dev->of_node, node) { |
7573 | vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); |
7574 | - if (!vreg) |
7575 | + if (!vreg) { |
7576 | + of_node_put(node); |
7577 | return -ENOMEM; |
7578 | + } |
7579 | |
7580 | ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data); |
7581 | |
7582 | diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c |
7583 | index 24e8b7e271773..6b131a490ebf8 100644 |
7584 | --- a/drivers/remoteproc/qcom_q6v5_adsp.c |
7585 | +++ b/drivers/remoteproc/qcom_q6v5_adsp.c |
7586 | @@ -389,6 +389,7 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp) |
7587 | } |
7588 | |
7589 | ret = of_address_to_resource(node, 0, &r); |
7590 | + of_node_put(node); |
7591 | if (ret) |
7592 | return ret; |
7593 | |
7594 | diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c |
7595 | index dc135754bb9c5..c72f1b3b60858 100644 |
7596 | --- a/drivers/remoteproc/qcom_wcnss.c |
7597 | +++ b/drivers/remoteproc/qcom_wcnss.c |
7598 | @@ -440,6 +440,7 @@ static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) |
7599 | } |
7600 | |
7601 | ret = of_address_to_resource(node, 0, &r); |
7602 | + of_node_put(node); |
7603 | if (ret) |
7604 | return ret; |
7605 | |
7606 | diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c |
7607 | index 5c1378d2fab3d..ba345a379e262 100644 |
7608 | --- a/drivers/rtc/interface.c |
7609 | +++ b/drivers/rtc/interface.c |
7610 | @@ -793,9 +793,13 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) |
7611 | struct timerqueue_node *next = timerqueue_getnext(&rtc->timerqueue); |
7612 | struct rtc_time tm; |
7613 | ktime_t now; |
7614 | + int err; |
7615 | + |
7616 | + err = __rtc_read_time(rtc, &tm); |
7617 | + if (err) |
7618 | + return err; |
7619 | |
7620 | timer->enabled = 1; |
7621 | - __rtc_read_time(rtc, &tm); |
7622 | now = rtc_tm_to_ktime(tm); |
7623 | |
7624 | /* Skip over expired timers */ |
7625 | @@ -809,7 +813,6 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) |
7626 | trace_rtc_timer_enqueue(timer); |
7627 | if (!next || ktime_before(timer->node.expires, next->expires)) { |
7628 | struct rtc_wkalrm alarm; |
7629 | - int err; |
7630 | |
7631 | alarm.time = rtc_ktime_to_tm(timer->node.expires); |
7632 | alarm.enabled = 1; |
7633 | diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c |
7634 | index 2018614f258f6..6eaa9321c0741 100644 |
7635 | --- a/drivers/rtc/rtc-wm8350.c |
7636 | +++ b/drivers/rtc/rtc-wm8350.c |
7637 | @@ -432,14 +432,21 @@ static int wm8350_rtc_probe(struct platform_device *pdev) |
7638 | return ret; |
7639 | } |
7640 | |
7641 | - wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, |
7642 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, |
7643 | wm8350_rtc_update_handler, 0, |
7644 | "RTC Seconds", wm8350); |
7645 | + if (ret) |
7646 | + return ret; |
7647 | + |
7648 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); |
7649 | |
7650 | - wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, |
7651 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, |
7652 | wm8350_rtc_alarm_handler, 0, |
7653 | "RTC Alarm", wm8350); |
7654 | + if (ret) { |
7655 | + wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC, wm8350); |
7656 | + return ret; |
7657 | + } |
7658 | |
7659 | return 0; |
7660 | } |
7661 | diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c |
7662 | index eb466c2e1839e..fdd9f1a5100c7 100644 |
7663 | --- a/drivers/scsi/aha152x.c |
7664 | +++ b/drivers/scsi/aha152x.c |
7665 | @@ -3368,13 +3368,11 @@ static int __init aha152x_setup(char *str) |
7666 | setup[setup_count].synchronous = ints[0] >= 6 ? ints[6] : 1; |
7667 | setup[setup_count].delay = ints[0] >= 7 ? ints[7] : DELAY_DEFAULT; |
7668 | setup[setup_count].ext_trans = ints[0] >= 8 ? ints[8] : 0; |
7669 | - if (ints[0] > 8) { /*}*/ |
7670 | + if (ints[0] > 8) |
7671 | printk(KERN_NOTICE "aha152x: usage: aha152x=<IOBASE>[,<IRQ>[,<SCSI ID>" |
7672 | "[,<RECONNECT>[,<PARITY>[,<SYNCHRONOUS>[,<DELAY>[,<EXT_TRANS>]]]]]]]\n"); |
7673 | - } else { |
7674 | + else |
7675 | setup_count++; |
7676 | - return 0; |
7677 | - } |
7678 | |
7679 | return 1; |
7680 | } |
7681 | diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c |
7682 | index fbfce02e5b935..c285f401ff7b5 100644 |
7683 | --- a/drivers/scsi/bfa/bfad_attr.c |
7684 | +++ b/drivers/scsi/bfa/bfad_attr.c |
7685 | @@ -711,7 +711,7 @@ bfad_im_serial_num_show(struct device *dev, struct device_attribute *attr, |
7686 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; |
7687 | |
7688 | bfa_get_adapter_serial_num(&bfad->bfa, serial_num); |
7689 | - return snprintf(buf, PAGE_SIZE, "%s\n", serial_num); |
7690 | + return sysfs_emit(buf, "%s\n", serial_num); |
7691 | } |
7692 | |
7693 | static ssize_t |
7694 | @@ -725,7 +725,7 @@ bfad_im_model_show(struct device *dev, struct device_attribute *attr, |
7695 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; |
7696 | |
7697 | bfa_get_adapter_model(&bfad->bfa, model); |
7698 | - return snprintf(buf, PAGE_SIZE, "%s\n", model); |
7699 | + return sysfs_emit(buf, "%s\n", model); |
7700 | } |
7701 | |
7702 | static ssize_t |
7703 | @@ -805,7 +805,7 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr, |
7704 | snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, |
7705 | "Invalid Model"); |
7706 | |
7707 | - return snprintf(buf, PAGE_SIZE, "%s\n", model_descr); |
7708 | + return sysfs_emit(buf, "%s\n", model_descr); |
7709 | } |
7710 | |
7711 | static ssize_t |
7712 | @@ -819,7 +819,7 @@ bfad_im_node_name_show(struct device *dev, struct device_attribute *attr, |
7713 | u64 nwwn; |
7714 | |
7715 | nwwn = bfa_fcs_lport_get_nwwn(port->fcs_port); |
7716 | - return snprintf(buf, PAGE_SIZE, "0x%llx\n", cpu_to_be64(nwwn)); |
7717 | + return sysfs_emit(buf, "0x%llx\n", cpu_to_be64(nwwn)); |
7718 | } |
7719 | |
7720 | static ssize_t |
7721 | @@ -836,7 +836,7 @@ bfad_im_symbolic_name_show(struct device *dev, struct device_attribute *attr, |
7722 | bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr); |
7723 | strlcpy(symname, port_attr.port_cfg.sym_name.symname, |
7724 | BFA_SYMNAME_MAXLEN); |
7725 | - return snprintf(buf, PAGE_SIZE, "%s\n", symname); |
7726 | + return sysfs_emit(buf, "%s\n", symname); |
7727 | } |
7728 | |
7729 | static ssize_t |
7730 | @@ -850,14 +850,14 @@ bfad_im_hw_version_show(struct device *dev, struct device_attribute *attr, |
7731 | char hw_ver[BFA_VERSION_LEN]; |
7732 | |
7733 | bfa_get_pci_chip_rev(&bfad->bfa, hw_ver); |
7734 | - return snprintf(buf, PAGE_SIZE, "%s\n", hw_ver); |
7735 | + return sysfs_emit(buf, "%s\n", hw_ver); |
7736 | } |
7737 | |
7738 | static ssize_t |
7739 | bfad_im_drv_version_show(struct device *dev, struct device_attribute *attr, |
7740 | char *buf) |
7741 | { |
7742 | - return snprintf(buf, PAGE_SIZE, "%s\n", BFAD_DRIVER_VERSION); |
7743 | + return sysfs_emit(buf, "%s\n", BFAD_DRIVER_VERSION); |
7744 | } |
7745 | |
7746 | static ssize_t |
7747 | @@ -871,7 +871,7 @@ bfad_im_optionrom_version_show(struct device *dev, |
7748 | char optrom_ver[BFA_VERSION_LEN]; |
7749 | |
7750 | bfa_get_adapter_optrom_ver(&bfad->bfa, optrom_ver); |
7751 | - return snprintf(buf, PAGE_SIZE, "%s\n", optrom_ver); |
7752 | + return sysfs_emit(buf, "%s\n", optrom_ver); |
7753 | } |
7754 | |
7755 | static ssize_t |
7756 | @@ -885,7 +885,7 @@ bfad_im_fw_version_show(struct device *dev, struct device_attribute *attr, |
7757 | char fw_ver[BFA_VERSION_LEN]; |
7758 | |
7759 | bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver); |
7760 | - return snprintf(buf, PAGE_SIZE, "%s\n", fw_ver); |
7761 | + return sysfs_emit(buf, "%s\n", fw_ver); |
7762 | } |
7763 | |
7764 | static ssize_t |
7765 | @@ -897,7 +897,7 @@ bfad_im_num_of_ports_show(struct device *dev, struct device_attribute *attr, |
7766 | (struct bfad_im_port_s *) shost->hostdata[0]; |
7767 | struct bfad_s *bfad = im_port->bfad; |
7768 | |
7769 | - return snprintf(buf, PAGE_SIZE, "%d\n", |
7770 | + return sysfs_emit(buf, "%d\n", |
7771 | bfa_get_nports(&bfad->bfa)); |
7772 | } |
7773 | |
7774 | @@ -905,7 +905,7 @@ static ssize_t |
7775 | bfad_im_drv_name_show(struct device *dev, struct device_attribute *attr, |
7776 | char *buf) |
7777 | { |
7778 | - return snprintf(buf, PAGE_SIZE, "%s\n", BFAD_DRIVER_NAME); |
7779 | + return sysfs_emit(buf, "%s\n", BFAD_DRIVER_NAME); |
7780 | } |
7781 | |
7782 | static ssize_t |
7783 | @@ -924,14 +924,14 @@ bfad_im_num_of_discovered_ports_show(struct device *dev, |
7784 | rports = kcalloc(nrports, sizeof(struct bfa_rport_qualifier_s), |
7785 | GFP_ATOMIC); |
7786 | if (rports == NULL) |
7787 | - return snprintf(buf, PAGE_SIZE, "Failed\n"); |
7788 | + return sysfs_emit(buf, "Failed\n"); |
7789 | |
7790 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
7791 | bfa_fcs_lport_get_rport_quals(port->fcs_port, rports, &nrports); |
7792 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
7793 | kfree(rports); |
7794 | |
7795 | - return snprintf(buf, PAGE_SIZE, "%d\n", nrports); |
7796 | + return sysfs_emit(buf, "%d\n", nrports); |
7797 | } |
7798 | |
7799 | static DEVICE_ATTR(serial_number, S_IRUGO, |
7800 | diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
7801 | index 13f314fa757e8..a86aae52d94f4 100644 |
7802 | --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
7803 | +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |
7804 | @@ -504,7 +504,7 @@ MODULE_PARM_DESC(intr_conv, "interrupt converge enable (0-1)"); |
7805 | |
7806 | /* permit overriding the host protection capabilities mask (EEDP/T10 PI) */ |
7807 | static int prot_mask; |
7808 | -module_param(prot_mask, int, 0); |
7809 | +module_param(prot_mask, int, 0444); |
7810 | MODULE_PARM_DESC(prot_mask, " host protection capabilities mask, def=0x0 "); |
7811 | |
7812 | static bool auto_affine_msi_experimental; |
7813 | diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c |
7814 | index e5b18e5d46dac..6e2a36eeb12a7 100644 |
7815 | --- a/drivers/scsi/libfc/fc_exch.c |
7816 | +++ b/drivers/scsi/libfc/fc_exch.c |
7817 | @@ -1697,6 +1697,7 @@ static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp) |
7818 | if (cancel_delayed_work_sync(&ep->timeout_work)) { |
7819 | FC_EXCH_DBG(ep, "Exchange timer canceled due to ABTS response\n"); |
7820 | fc_exch_release(ep); /* release from pending timer hold */ |
7821 | + return; |
7822 | } |
7823 | |
7824 | spin_lock_bh(&ep->ex_lock); |
7825 | diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c |
7826 | index 5d28bb7f2ca40..5c801705c4700 100644 |
7827 | --- a/drivers/scsi/libsas/sas_ata.c |
7828 | +++ b/drivers/scsi/libsas/sas_ata.c |
7829 | @@ -201,7 +201,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) |
7830 | task->total_xfer_len = qc->nbytes; |
7831 | task->num_scatter = qc->n_elem; |
7832 | task->data_dir = qc->dma_dir; |
7833 | - } else if (qc->tf.protocol == ATA_PROT_NODATA) { |
7834 | + } else if (!ata_is_data(qc->tf.protocol)) { |
7835 | task->data_dir = DMA_NONE; |
7836 | } else { |
7837 | for_each_sg(qc->sg, sg, qc->n_elem, si) |
7838 | diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c |
7839 | index 52405ce58ade8..c16d7fb0fdcbb 100644 |
7840 | --- a/drivers/scsi/mvsas/mv_init.c |
7841 | +++ b/drivers/scsi/mvsas/mv_init.c |
7842 | @@ -697,7 +697,7 @@ static ssize_t |
7843 | mvs_show_driver_version(struct device *cdev, |
7844 | struct device_attribute *attr, char *buffer) |
7845 | { |
7846 | - return snprintf(buffer, PAGE_SIZE, "%s\n", DRV_VERSION); |
7847 | + return sysfs_emit(buffer, "%s\n", DRV_VERSION); |
7848 | } |
7849 | |
7850 | static DEVICE_ATTR(driver_version, |
7851 | @@ -749,7 +749,7 @@ mvs_store_interrupt_coalescing(struct device *cdev, |
7852 | static ssize_t mvs_show_interrupt_coalescing(struct device *cdev, |
7853 | struct device_attribute *attr, char *buffer) |
7854 | { |
7855 | - return snprintf(buffer, PAGE_SIZE, "%d\n", interrupt_coalescing); |
7856 | + return sysfs_emit(buffer, "%d\n", interrupt_coalescing); |
7857 | } |
7858 | |
7859 | static DEVICE_ATTR(interrupt_coalescing, |
7860 | diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c |
7861 | index 68a8217032d0f..fec653b54307a 100644 |
7862 | --- a/drivers/scsi/pm8001/pm8001_hwi.c |
7863 | +++ b/drivers/scsi/pm8001/pm8001_hwi.c |
7864 | @@ -1750,6 +1750,7 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, |
7865 | ccb->device = pm8001_ha_dev; |
7866 | ccb->ccb_tag = ccb_tag; |
7867 | ccb->task = task; |
7868 | + ccb->n_elem = 0; |
7869 | |
7870 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
7871 | |
7872 | @@ -1812,6 +1813,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, |
7873 | ccb->device = pm8001_ha_dev; |
7874 | ccb->ccb_tag = ccb_tag; |
7875 | ccb->task = task; |
7876 | + ccb->n_elem = 0; |
7877 | pm8001_ha_dev->id |= NCQ_READ_LOG_FLAG; |
7878 | pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG; |
7879 | |
7880 | @@ -1828,7 +1830,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, |
7881 | |
7882 | sata_cmd.tag = cpu_to_le32(ccb_tag); |
7883 | sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); |
7884 | - sata_cmd.ncqtag_atap_dir_m |= ((0x1 << 7) | (0x5 << 9)); |
7885 | + sata_cmd.ncqtag_atap_dir_m = cpu_to_le32((0x1 << 7) | (0x5 << 9)); |
7886 | memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); |
7887 | |
7888 | res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 0); |
7889 | @@ -3773,12 +3775,11 @@ int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) |
7890 | mb(); |
7891 | |
7892 | if (pm8001_dev->id & NCQ_ABORT_ALL_FLAG) { |
7893 | - pm8001_tag_free(pm8001_ha, tag); |
7894 | sas_free_task(t); |
7895 | - /* clear the flag */ |
7896 | - pm8001_dev->id &= 0xBFFFFFFF; |
7897 | - } else |
7898 | + pm8001_dev->id &= ~NCQ_ABORT_ALL_FLAG; |
7899 | + } else { |
7900 | t->task_done(t); |
7901 | + } |
7902 | |
7903 | return 0; |
7904 | } |
7905 | @@ -4727,7 +4728,7 @@ int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha, |
7906 | memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); |
7907 | sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); |
7908 | if (pm8001_ha->chip_id != chip_8001) |
7909 | - sspTMCmd.ds_ads_m = 0x08; |
7910 | + sspTMCmd.ds_ads_m = cpu_to_le32(0x08); |
7911 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
7912 | ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd, 0); |
7913 | return ret; |
7914 | diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
7915 | index 161bf4760eac7..ce67965a504fa 100644 |
7916 | --- a/drivers/scsi/pm8001/pm80xx_hwi.c |
7917 | +++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
7918 | @@ -881,9 +881,11 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha) |
7919 | else |
7920 | page_code = THERMAL_PAGE_CODE_8H; |
7921 | |
7922 | - payload.cfg_pg[0] = (THERMAL_LOG_ENABLE << 9) | |
7923 | - (THERMAL_ENABLE << 8) | page_code; |
7924 | - payload.cfg_pg[1] = (LTEMPHIL << 24) | (RTEMPHIL << 8); |
7925 | + payload.cfg_pg[0] = |
7926 | + cpu_to_le32((THERMAL_LOG_ENABLE << 9) | |
7927 | + (THERMAL_ENABLE << 8) | page_code); |
7928 | + payload.cfg_pg[1] = |
7929 | + cpu_to_le32((LTEMPHIL << 24) | (RTEMPHIL << 8)); |
7930 | |
7931 | rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0); |
7932 | if (rc) |
7933 | @@ -1435,6 +1437,7 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha, |
7934 | ccb->device = pm8001_ha_dev; |
7935 | ccb->ccb_tag = ccb_tag; |
7936 | ccb->task = task; |
7937 | + ccb->n_elem = 0; |
7938 | |
7939 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
7940 | |
7941 | @@ -1516,7 +1519,7 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, |
7942 | |
7943 | sata_cmd.tag = cpu_to_le32(ccb_tag); |
7944 | sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); |
7945 | - sata_cmd.ncqtag_atap_dir_m_dad |= ((0x1 << 7) | (0x5 << 9)); |
7946 | + sata_cmd.ncqtag_atap_dir_m_dad = cpu_to_le32(((0x1 << 7) | (0x5 << 9))); |
7947 | memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); |
7948 | |
7949 | res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 0); |
7950 | diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c |
7951 | index 8f85ca0112961..59f5dc9876cc5 100644 |
7952 | --- a/drivers/scsi/qla2xxx/qla_attr.c |
7953 | +++ b/drivers/scsi/qla2xxx/qla_attr.c |
7954 | @@ -527,7 +527,7 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj, |
7955 | if (!capable(CAP_SYS_ADMIN)) |
7956 | return -EINVAL; |
7957 | |
7958 | - if (IS_NOCACHE_VPD_TYPE(ha)) |
7959 | + if (!IS_NOCACHE_VPD_TYPE(ha)) |
7960 | goto skip; |
7961 | |
7962 | faddr = ha->flt_region_vpd << 2; |
7963 | @@ -710,7 +710,7 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, |
7964 | ql_log(ql_log_info, vha, 0x706f, |
7965 | "Issuing MPI reset.\n"); |
7966 | |
7967 | - if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { |
7968 | + if (IS_QLA83XX(ha)) { |
7969 | uint32_t idc_control; |
7970 | |
7971 | qla83xx_idc_lock(vha, 0); |
7972 | @@ -1020,9 +1020,6 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool stop_beacon) |
7973 | continue; |
7974 | if (iter->type == 3 && !(IS_CNA_CAPABLE(ha))) |
7975 | continue; |
7976 | - if (iter->type == 0x27 && |
7977 | - (!IS_QLA27XX(ha) || !IS_QLA28XX(ha))) |
7978 | - continue; |
7979 | |
7980 | sysfs_remove_bin_file(&host->shost_gendev.kobj, |
7981 | iter->attr); |
7982 | diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h |
7983 | index 7c22f8eea3ead..caf28c5281aa5 100644 |
7984 | --- a/drivers/scsi/qla2xxx/qla_def.h |
7985 | +++ b/drivers/scsi/qla2xxx/qla_def.h |
7986 | @@ -2725,7 +2725,11 @@ struct ct_fdmiv2_hba_attributes { |
7987 | #define FDMI_PORT_SPEED_8GB 0x10 |
7988 | #define FDMI_PORT_SPEED_16GB 0x20 |
7989 | #define FDMI_PORT_SPEED_32GB 0x40 |
7990 | -#define FDMI_PORT_SPEED_64GB 0x80 |
7991 | +#define FDMI_PORT_SPEED_20GB 0x80 |
7992 | +#define FDMI_PORT_SPEED_40GB 0x100 |
7993 | +#define FDMI_PORT_SPEED_128GB 0x200 |
7994 | +#define FDMI_PORT_SPEED_64GB 0x400 |
7995 | +#define FDMI_PORT_SPEED_256GB 0x800 |
7996 | #define FDMI_PORT_SPEED_UNKNOWN 0x8000 |
7997 | |
7998 | #define FC_CLASS_2 0x04 |
7999 | @@ -4866,4 +4870,8 @@ struct sff_8247_a0 { |
8000 | #include "qla_gbl.h" |
8001 | #include "qla_dbg.h" |
8002 | #include "qla_inline.h" |
8003 | + |
8004 | +#define IS_SESSION_DELETED(_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \ |
8005 | + _fcport->disc_state == DSC_DELETED) |
8006 | + |
8007 | #endif |
8008 | diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c |
8009 | index d9b5ea77fde99..e9f03370afba3 100644 |
8010 | --- a/drivers/scsi/qla2xxx/qla_gs.c |
8011 | +++ b/drivers/scsi/qla2xxx/qla_gs.c |
8012 | @@ -675,8 +675,7 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8 type) |
8013 | return (QLA_SUCCESS); |
8014 | } |
8015 | |
8016 | - return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), |
8017 | - FC4_TYPE_FCP_SCSI); |
8018 | + return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), type); |
8019 | } |
8020 | |
8021 | static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id, |
8022 | @@ -726,7 +725,7 @@ static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id, |
8023 | /* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */ |
8024 | ct_req->req.rff_id.port_id = port_id_to_be_id(*d_id); |
8025 | ct_req->req.rff_id.fc4_feature = fc4feature; |
8026 | - ct_req->req.rff_id.fc4_type = fc4type; /* SCSI - FCP */ |
8027 | + ct_req->req.rff_id.fc4_type = fc4type; /* SCSI-FCP or FC-NVMe */ |
8028 | |
8029 | sp->u.iocb_cmd.u.ctarg.req_size = RFF_ID_REQ_SIZE; |
8030 | sp->u.iocb_cmd.u.ctarg.rsp_size = RFF_ID_RSP_SIZE; |
8031 | diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
8032 | index 37c1f27a76cf6..a6e24cef89a0b 100644 |
8033 | --- a/drivers/scsi/qla2xxx/qla_init.c |
8034 | +++ b/drivers/scsi/qla2xxx/qla_init.c |
8035 | @@ -572,6 +572,14 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport, |
8036 | struct srb_iocb *lio; |
8037 | int rval = QLA_FUNCTION_FAILED; |
8038 | |
8039 | + if (IS_SESSION_DELETED(fcport)) { |
8040 | + ql_log(ql_log_warn, vha, 0xffff, |
8041 | + "%s: %8phC is being delete - not sending command.\n", |
8042 | + __func__, fcport->port_name); |
8043 | + fcport->flags &= ~FCF_ASYNC_ACTIVE; |
8044 | + return rval; |
8045 | + } |
8046 | + |
8047 | if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) |
8048 | return rval; |
8049 | |
8050 | @@ -955,6 +963,9 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, |
8051 | set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
8052 | } |
8053 | break; |
8054 | + case ISP_CFG_NL: |
8055 | + qla24xx_fcport_handle_login(vha, fcport); |
8056 | + break; |
8057 | default: |
8058 | break; |
8059 | } |
8060 | @@ -1311,14 +1322,21 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) |
8061 | struct port_database_24xx *pd; |
8062 | struct qla_hw_data *ha = vha->hw; |
8063 | |
8064 | - if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) || |
8065 | - fcport->loop_id == FC_NO_LOOP_ID) { |
8066 | + if (IS_SESSION_DELETED(fcport)) { |
8067 | ql_log(ql_log_warn, vha, 0xffff, |
8068 | - "%s: %8phC - not sending command.\n", |
8069 | - __func__, fcport->port_name); |
8070 | + "%s: %8phC is being delete - not sending command.\n", |
8071 | + __func__, fcport->port_name); |
8072 | + fcport->flags &= ~FCF_ASYNC_ACTIVE; |
8073 | return rval; |
8074 | } |
8075 | |
8076 | + if (!vha->flags.online || fcport->flags & FCF_ASYNC_SENT) { |
8077 | + ql_log(ql_log_warn, vha, 0xffff, |
8078 | + "%s: %8phC online %d flags %x - not sending command.\n", |
8079 | + __func__, fcport->port_name, vha->flags.online, fcport->flags); |
8080 | + goto done; |
8081 | + } |
8082 | + |
8083 | sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); |
8084 | if (!sp) |
8085 | goto done; |
8086 | @@ -1477,6 +1495,11 @@ static void qla_chk_n2n_b4_login(struct scsi_qla_host *vha, fc_port_t *fcport) |
8087 | u8 login = 0; |
8088 | int rc; |
8089 | |
8090 | + ql_dbg(ql_dbg_disc, vha, 0x307b, |
8091 | + "%s %8phC DS %d LS %d lid %d retries=%d\n", |
8092 | + __func__, fcport->port_name, fcport->disc_state, |
8093 | + fcport->fw_login_state, fcport->loop_id, fcport->login_retry); |
8094 | + |
8095 | if (qla_tgt_mode_enabled(vha)) |
8096 | return; |
8097 | |
8098 | @@ -1534,7 +1557,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) |
8099 | fcport->conflict, fcport->last_rscn_gen, fcport->rscn_gen, |
8100 | fcport->login_gen, fcport->loop_id, fcport->scan_state); |
8101 | |
8102 | - if (fcport->scan_state != QLA_FCPORT_FOUND) |
8103 | + if (fcport->scan_state != QLA_FCPORT_FOUND || |
8104 | + fcport->disc_state == DSC_DELETE_PEND) |
8105 | return 0; |
8106 | |
8107 | if ((fcport->loop_id != FC_NO_LOOP_ID) && |
8108 | @@ -1555,7 +1579,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) |
8109 | if (vha->host->active_mode == MODE_TARGET) |
8110 | return 0; |
8111 | |
8112 | - if (fcport->flags & FCF_ASYNC_SENT) { |
8113 | + if (fcport->flags & (FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE)) { |
8114 | set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
8115 | return 0; |
8116 | } |
8117 | @@ -3223,6 +3247,14 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) |
8118 | struct rsp_que *rsp = ha->rsp_q_map[0]; |
8119 | struct qla2xxx_fw_dump *fw_dump; |
8120 | |
8121 | + if (ha->fw_dump) { |
8122 | + ql_dbg(ql_dbg_init, vha, 0x00bd, |
8123 | + "Firmware dump already allocated.\n"); |
8124 | + return; |
8125 | + } |
8126 | + |
8127 | + ha->fw_dumped = 0; |
8128 | + ha->fw_dump_cap_flags = 0; |
8129 | dump_size = fixed_size = mem_size = eft_size = fce_size = mq_size = 0; |
8130 | req_q_size = rsp_q_size = 0; |
8131 | |
8132 | @@ -3233,7 +3265,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) |
8133 | mem_size = (ha->fw_memory_size - 0x11000 + 1) * |
8134 | sizeof(uint16_t); |
8135 | } else if (IS_FWI2_CAPABLE(ha)) { |
8136 | - if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
8137 | + if (IS_QLA83XX(ha)) |
8138 | fixed_size = offsetof(struct qla83xx_fw_dump, ext_mem); |
8139 | else if (IS_QLA81XX(ha)) |
8140 | fixed_size = offsetof(struct qla81xx_fw_dump, ext_mem); |
8141 | @@ -3245,8 +3277,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) |
8142 | mem_size = (ha->fw_memory_size - 0x100000 + 1) * |
8143 | sizeof(uint32_t); |
8144 | if (ha->mqenable) { |
8145 | - if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha) && |
8146 | - !IS_QLA28XX(ha)) |
8147 | + if (!IS_QLA83XX(ha)) |
8148 | mq_size = sizeof(struct qla2xxx_mq_chain); |
8149 | /* |
8150 | * Allocate maximum buffer size for all queues - Q0. |
8151 | @@ -3743,8 +3774,7 @@ enable_82xx_npiv: |
8152 | ha->fw_major_version, ha->fw_minor_version, |
8153 | ha->fw_subminor_version); |
8154 | |
8155 | - if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || |
8156 | - IS_QLA28XX(ha)) { |
8157 | + if (IS_QLA83XX(ha)) { |
8158 | ha->flags.fac_supported = 0; |
8159 | rval = QLA_SUCCESS; |
8160 | } |
8161 | @@ -5217,6 +5247,13 @@ skip_login: |
8162 | memcpy(fcport->node_name, new_fcport->node_name, |
8163 | WWN_SIZE); |
8164 | fcport->scan_state = QLA_FCPORT_FOUND; |
8165 | + if (fcport->login_retry == 0) { |
8166 | + fcport->login_retry = vha->hw->login_retry_count; |
8167 | + ql_dbg(ql_dbg_disc, vha, 0x2135, |
8168 | + "Port login retry %8phN, lid 0x%04x retry cnt=%d.\n", |
8169 | + fcport->port_name, fcport->loop_id, |
8170 | + fcport->login_retry); |
8171 | + } |
8172 | found++; |
8173 | break; |
8174 | } |
8175 | @@ -5351,6 +5388,8 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport) |
8176 | if (atomic_read(&fcport->state) == FCS_ONLINE) |
8177 | return; |
8178 | |
8179 | + qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
8180 | + |
8181 | rport_ids.node_name = wwn_to_u64(fcport->node_name); |
8182 | rport_ids.port_name = wwn_to_u64(fcport->port_name); |
8183 | rport_ids.port_id = fcport->d_id.b.domain << 16 | |
8184 | @@ -5446,6 +5485,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) |
8185 | qla2x00_reg_remote_port(vha, fcport); |
8186 | break; |
8187 | case MODE_TARGET: |
8188 | + qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
8189 | if (!vha->vha_tgt.qla_tgt->tgt_stop && |
8190 | !vha->vha_tgt.qla_tgt->tgt_stopped) |
8191 | qlt_fc_port_added(vha, fcport); |
8192 | @@ -5460,8 +5500,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) |
8193 | break; |
8194 | } |
8195 | |
8196 | - qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
8197 | - |
8198 | if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { |
8199 | if (fcport->id_changed) { |
8200 | fcport->id_changed = 0; |
8201 | @@ -9001,7 +9039,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, |
8202 | qpair->rsp->req = qpair->req; |
8203 | qpair->rsp->qpair = qpair; |
8204 | /* init qpair to this cpu. Will adjust at run time. */ |
8205 | - qla_cpu_update(qpair, smp_processor_id()); |
8206 | + qla_cpu_update(qpair, raw_smp_processor_id()); |
8207 | |
8208 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { |
8209 | if (ha->fw_attributes & BIT_4) |
8210 | diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c |
8211 | index 936103604d02d..103288b0377e0 100644 |
8212 | --- a/drivers/scsi/qla2xxx/qla_iocb.c |
8213 | +++ b/drivers/scsi/qla2xxx/qla_iocb.c |
8214 | @@ -2859,6 +2859,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) |
8215 | set_bit(ISP_ABORT_NEEDED, |
8216 | &vha->dpc_flags); |
8217 | qla2xxx_wake_dpc(vha); |
8218 | + break; |
8219 | } |
8220 | /* fall through */ |
8221 | default: |
8222 | @@ -2868,9 +2869,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) |
8223 | fw_status[0], fw_status[1], fw_status[2]); |
8224 | |
8225 | fcport->flags &= ~FCF_ASYNC_SENT; |
8226 | - qla2x00_set_fcport_disc_state(fcport, |
8227 | - DSC_LOGIN_FAILED); |
8228 | - set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
8229 | + qlt_schedule_sess_for_deletion(fcport); |
8230 | break; |
8231 | } |
8232 | break; |
8233 | @@ -2882,8 +2881,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) |
8234 | fw_status[0], fw_status[1], fw_status[2]); |
8235 | |
8236 | sp->fcport->flags &= ~FCF_ASYNC_SENT; |
8237 | - qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_FAILED); |
8238 | - set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
8239 | + qlt_schedule_sess_for_deletion(fcport); |
8240 | break; |
8241 | } |
8242 | |
8243 | diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c |
8244 | index 3e9c5768815e5..d7cf7f9570874 100644 |
8245 | --- a/drivers/scsi/qla2xxx/qla_isr.c |
8246 | +++ b/drivers/scsi/qla2xxx/qla_isr.c |
8247 | @@ -1839,6 +1839,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk) |
8248 | iocb->u.tmf.data = QLA_FUNCTION_FAILED; |
8249 | } else if ((le16_to_cpu(sts->scsi_status) & |
8250 | SS_RESPONSE_INFO_LEN_VALID)) { |
8251 | + host_to_fcp_swap(sts->data, sizeof(sts->data)); |
8252 | if (le32_to_cpu(sts->rsp_data_len) < 4) { |
8253 | ql_log(ql_log_warn, fcport->vha, 0x503b, |
8254 | "Async-%s error - hdl=%x not enough response(%d).\n", |
8255 | diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
8256 | index 098388a12febc..29f2730fbf66a 100644 |
8257 | --- a/drivers/scsi/qla2xxx/qla_mbx.c |
8258 | +++ b/drivers/scsi/qla2xxx/qla_mbx.c |
8259 | @@ -10,6 +10,12 @@ |
8260 | #include <linux/delay.h> |
8261 | #include <linux/gfp.h> |
8262 | |
8263 | +#ifdef CONFIG_PPC |
8264 | +#define IS_PPCARCH true |
8265 | +#else |
8266 | +#define IS_PPCARCH false |
8267 | +#endif |
8268 | + |
8269 | static struct mb_cmd_name { |
8270 | uint16_t cmd; |
8271 | const char *str; |
8272 | @@ -731,6 +737,9 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr) |
8273 | vha->min_supported_speed = |
8274 | nv->min_supported_speed; |
8275 | } |
8276 | + |
8277 | + if (IS_PPCARCH) |
8278 | + mcp->mb[11] |= BIT_4; |
8279 | } |
8280 | |
8281 | if (ha->flags.exlogins_enabled) |
8282 | @@ -2897,8 +2906,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha) |
8283 | ha->orig_fw_iocb_count = mcp->mb[10]; |
8284 | if (ha->flags.npiv_supported) |
8285 | ha->max_npiv_vports = mcp->mb[11]; |
8286 | - if (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha) || |
8287 | - IS_QLA28XX(ha)) |
8288 | + if (IS_QLA81XX(ha) || IS_QLA83XX(ha)) |
8289 | ha->fw_max_fcf_count = mcp->mb[12]; |
8290 | } |
8291 | |
8292 | @@ -5391,7 +5399,7 @@ qla2x00_get_data_rate(scsi_qla_host_t *vha) |
8293 | mcp->out_mb = MBX_1|MBX_0; |
8294 | mcp->in_mb = MBX_2|MBX_1|MBX_0; |
8295 | if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
8296 | - mcp->in_mb |= MBX_3; |
8297 | + mcp->in_mb |= MBX_4|MBX_3; |
8298 | mcp->tov = MBX_TOV_SECONDS; |
8299 | mcp->flags = 0; |
8300 | rval = qla2x00_mailbox_command(vha, mcp); |
8301 | diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c |
8302 | index 97453c12b7358..a15af048cd820 100644 |
8303 | --- a/drivers/scsi/qla2xxx/qla_nvme.c |
8304 | +++ b/drivers/scsi/qla2xxx/qla_nvme.c |
8305 | @@ -36,6 +36,11 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) |
8306 | (fcport->nvme_flag & NVME_FLAG_REGISTERED)) |
8307 | return 0; |
8308 | |
8309 | + if (atomic_read(&fcport->state) == FCS_ONLINE) |
8310 | + return 0; |
8311 | + |
8312 | + qla2x00_set_fcport_state(fcport, FCS_ONLINE); |
8313 | + |
8314 | fcport->nvme_flag &= ~NVME_FLAG_RESETTING; |
8315 | |
8316 | memset(&req, 0, sizeof(struct nvme_fc_port_info)); |
8317 | @@ -152,6 +157,18 @@ out: |
8318 | qla2xxx_rel_qpair_sp(sp->qpair, sp); |
8319 | } |
8320 | |
8321 | +static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd) |
8322 | +{ |
8323 | + if (sp->flags & SRB_DMA_VALID) { |
8324 | + struct srb_iocb *nvme = &sp->u.iocb_cmd; |
8325 | + struct qla_hw_data *ha = sp->fcport->vha->hw; |
8326 | + |
8327 | + dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma, |
8328 | + fd->rqstlen, DMA_TO_DEVICE); |
8329 | + sp->flags &= ~SRB_DMA_VALID; |
8330 | + } |
8331 | +} |
8332 | + |
8333 | static void qla_nvme_release_ls_cmd_kref(struct kref *kref) |
8334 | { |
8335 | struct srb *sp = container_of(kref, struct srb, cmd_kref); |
8336 | @@ -168,6 +185,8 @@ static void qla_nvme_release_ls_cmd_kref(struct kref *kref) |
8337 | spin_unlock_irqrestore(&priv->cmd_lock, flags); |
8338 | |
8339 | fd = priv->fd; |
8340 | + |
8341 | + qla_nvme_ls_unmap(sp, fd); |
8342 | fd->done(fd, priv->comp_status); |
8343 | out: |
8344 | qla2x00_rel_sp(sp); |
8345 | @@ -314,6 +333,8 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, |
8346 | dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma, |
8347 | fd->rqstlen, DMA_TO_DEVICE); |
8348 | |
8349 | + sp->flags |= SRB_DMA_VALID; |
8350 | + |
8351 | rval = qla2x00_start_sp(sp); |
8352 | if (rval != QLA_SUCCESS) { |
8353 | ql_log(ql_log_warn, vha, 0x700e, |
8354 | @@ -321,6 +342,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, |
8355 | wake_up(&sp->nvme_ls_waitq); |
8356 | sp->priv = NULL; |
8357 | priv->sp = NULL; |
8358 | + qla_nvme_ls_unmap(sp, fd); |
8359 | qla2x00_rel_sp(sp); |
8360 | return rval; |
8361 | } |
8362 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
8363 | index c1d4c964b0dd4..a5dbaa3491f82 100644 |
8364 | --- a/drivers/scsi/qla2xxx/qla_os.c |
8365 | +++ b/drivers/scsi/qla2xxx/qla_os.c |
8366 | @@ -3627,8 +3627,7 @@ qla2x00_unmap_iobases(struct qla_hw_data *ha) |
8367 | if (ha->mqiobase) |
8368 | iounmap(ha->mqiobase); |
8369 | |
8370 | - if ((IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) && |
8371 | - ha->msixbase) |
8372 | + if (ha->msixbase) |
8373 | iounmap(ha->msixbase); |
8374 | } |
8375 | } |
8376 | @@ -5348,6 +5347,11 @@ void qla2x00_relogin(struct scsi_qla_host *vha) |
8377 | memset(&ea, 0, sizeof(ea)); |
8378 | ea.fcport = fcport; |
8379 | qla24xx_handle_relogin_event(vha, &ea); |
8380 | + } else if (vha->hw->current_topology == |
8381 | + ISP_CFG_NL && |
8382 | + IS_QLA2XXX_MIDTYPE(vha->hw)) { |
8383 | + (void)qla24xx_fcport_handle_login(vha, |
8384 | + fcport); |
8385 | } else if (vha->hw->current_topology == |
8386 | ISP_CFG_NL) { |
8387 | fcport->login_retry--; |
8388 | diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c |
8389 | index bbe90354f49b0..d306f3ca0f3bf 100644 |
8390 | --- a/drivers/scsi/qla2xxx/qla_sup.c |
8391 | +++ b/drivers/scsi/qla2xxx/qla_sup.c |
8392 | @@ -843,7 +843,7 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) |
8393 | ha->flt_region_nvram = start; |
8394 | break; |
8395 | case FLT_REG_IMG_PRI_27XX: |
8396 | - if (IS_QLA27XX(ha) && !IS_QLA28XX(ha)) |
8397 | + if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) |
8398 | ha->flt_region_img_status_pri = start; |
8399 | break; |
8400 | case FLT_REG_IMG_SEC_27XX: |
8401 | @@ -1355,7 +1355,7 @@ next: |
8402 | flash_data_addr(ha, faddr), cpu_to_le32(*dwptr)); |
8403 | if (ret) { |
8404 | ql_dbg(ql_dbg_user, vha, 0x7006, |
8405 | - "Failed slopw write %x (%x)\n", faddr, *dwptr); |
8406 | + "Failed slow write %x (%x)\n", faddr, *dwptr); |
8407 | break; |
8408 | } |
8409 | } |
8410 | diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
8411 | index 0111c543f0e64..df598c377161d 100644 |
8412 | --- a/drivers/scsi/qla2xxx/qla_target.c |
8413 | +++ b/drivers/scsi/qla2xxx/qla_target.c |
8414 | @@ -3251,6 +3251,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, |
8415 | "RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n", |
8416 | vha->flags.online, qla2x00_reset_active(vha), |
8417 | cmd->reset_count, qpair->chip_reset); |
8418 | + res = 0; |
8419 | goto out_unmap_unlock; |
8420 | } |
8421 | |
8422 | @@ -7083,8 +7084,7 @@ qlt_probe_one_stage1(struct scsi_qla_host *base_vha, struct qla_hw_data *ha) |
8423 | if (!QLA_TGT_MODE_ENABLED()) |
8424 | return; |
8425 | |
8426 | - if ((ql2xenablemsix == 0) || IS_QLA83XX(ha) || IS_QLA27XX(ha) || |
8427 | - IS_QLA28XX(ha)) { |
8428 | + if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { |
8429 | ISP_ATIO_Q_IN(base_vha) = &ha->mqiobase->isp25mq.atio_q_in; |
8430 | ISP_ATIO_Q_OUT(base_vha) = &ha->mqiobase->isp25mq.atio_q_out; |
8431 | } else { |
8432 | diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c |
8433 | index 27b9e2baab1a6..7acf9193a9e80 100644 |
8434 | --- a/drivers/scsi/zorro7xx.c |
8435 | +++ b/drivers/scsi/zorro7xx.c |
8436 | @@ -159,6 +159,8 @@ static void zorro7xx_remove_one(struct zorro_dev *z) |
8437 | scsi_remove_host(host); |
8438 | |
8439 | NCR_700_release(host); |
8440 | + if (host->base > 0x01000000) |
8441 | + iounmap(hostdata->base); |
8442 | kfree(hostdata); |
8443 | free_irq(host->irq, host); |
8444 | zorro_release_device(z); |
8445 | diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c |
8446 | index 45c5aa712edac..f16d6ec780644 100644 |
8447 | --- a/drivers/soc/qcom/qcom_aoss.c |
8448 | +++ b/drivers/soc/qcom/qcom_aoss.c |
8449 | @@ -544,7 +544,7 @@ static int qmp_probe(struct platform_device *pdev) |
8450 | } |
8451 | |
8452 | irq = platform_get_irq(pdev, 0); |
8453 | - ret = devm_request_irq(&pdev->dev, irq, qmp_intr, IRQF_ONESHOT, |
8454 | + ret = devm_request_irq(&pdev->dev, irq, qmp_intr, 0, |
8455 | "aoss-qmp", qmp); |
8456 | if (ret < 0) { |
8457 | dev_err(&pdev->dev, "failed to request interrupt\n"); |
8458 | diff --git a/drivers/soc/qcom/rpmpd.c b/drivers/soc/qcom/rpmpd.c |
8459 | index 3c1a55cf25d62..4715acfecff49 100644 |
8460 | --- a/drivers/soc/qcom/rpmpd.c |
8461 | +++ b/drivers/soc/qcom/rpmpd.c |
8462 | @@ -362,6 +362,9 @@ static int rpmpd_probe(struct platform_device *pdev) |
8463 | |
8464 | data->domains = devm_kcalloc(&pdev->dev, num, sizeof(*data->domains), |
8465 | GFP_KERNEL); |
8466 | + if (!data->domains) |
8467 | + return -ENOMEM; |
8468 | + |
8469 | data->num_domains = num; |
8470 | |
8471 | for (i = 0; i < num; i++) { |
8472 | diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c |
8473 | index e9ece45d7a333..ef3f95fefab58 100644 |
8474 | --- a/drivers/soc/ti/wkup_m3_ipc.c |
8475 | +++ b/drivers/soc/ti/wkup_m3_ipc.c |
8476 | @@ -447,9 +447,9 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) |
8477 | } |
8478 | |
8479 | irq = platform_get_irq(pdev, 0); |
8480 | - if (!irq) { |
8481 | + if (irq < 0) { |
8482 | dev_err(&pdev->dev, "no irq resource\n"); |
8483 | - return -ENXIO; |
8484 | + return irq; |
8485 | } |
8486 | |
8487 | ret = devm_request_irq(dev, irq, wkup_m3_txev_handler, |
8488 | diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c |
8489 | index 3755be04346a6..d933a6eda5fdc 100644 |
8490 | --- a/drivers/spi/spi-bcm-qspi.c |
8491 | +++ b/drivers/spi/spi-bcm-qspi.c |
8492 | @@ -960,7 +960,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem, |
8493 | addr = op->addr.val; |
8494 | len = op->data.nbytes; |
8495 | |
8496 | - if (bcm_qspi_bspi_ver_three(qspi) == true) { |
8497 | + if (has_bspi(qspi) && bcm_qspi_bspi_ver_three(qspi) == true) { |
8498 | /* |
8499 | * The address coming into this function is a raw flash offset. |
8500 | * But for BSPI <= V3, we need to convert it to a remapped BSPI |
8501 | @@ -979,7 +979,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem, |
8502 | len < 4) |
8503 | mspi_read = true; |
8504 | |
8505 | - if (mspi_read) |
8506 | + if (!has_bspi(qspi) || mspi_read) |
8507 | return bcm_qspi_mspi_exec_mem_op(spi, op); |
8508 | |
8509 | ret = bcm_qspi_bspi_set_mode(qspi, op, 0); |
8510 | diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c |
8511 | index eba706d5671e2..d0b5db88cd164 100644 |
8512 | --- a/drivers/spi/spi-mxic.c |
8513 | +++ b/drivers/spi/spi-mxic.c |
8514 | @@ -304,25 +304,21 @@ static int mxic_spi_data_xfer(struct mxic_spi *mxic, const void *txbuf, |
8515 | |
8516 | writel(data, mxic->regs + TXD(nbytes % 4)); |
8517 | |
8518 | + ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
8519 | + sts & INT_TX_EMPTY, 0, USEC_PER_SEC); |
8520 | + if (ret) |
8521 | + return ret; |
8522 | + |
8523 | + ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
8524 | + sts & INT_RX_NOT_EMPTY, 0, |
8525 | + USEC_PER_SEC); |
8526 | + if (ret) |
8527 | + return ret; |
8528 | + |
8529 | + data = readl(mxic->regs + RXD); |
8530 | if (rxbuf) { |
8531 | - ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
8532 | - sts & INT_TX_EMPTY, 0, |
8533 | - USEC_PER_SEC); |
8534 | - if (ret) |
8535 | - return ret; |
8536 | - |
8537 | - ret = readl_poll_timeout(mxic->regs + INT_STS, sts, |
8538 | - sts & INT_RX_NOT_EMPTY, 0, |
8539 | - USEC_PER_SEC); |
8540 | - if (ret) |
8541 | - return ret; |
8542 | - |
8543 | - data = readl(mxic->regs + RXD); |
8544 | data >>= (8 * (4 - nbytes)); |
8545 | memcpy(rxbuf + pos, &data, nbytes); |
8546 | - WARN_ON(readl(mxic->regs + INT_STS) & INT_RX_NOT_EMPTY); |
8547 | - } else { |
8548 | - readl(mxic->regs + RXD); |
8549 | } |
8550 | WARN_ON(readl(mxic->regs + INT_STS) & INT_RX_NOT_EMPTY); |
8551 | |
8552 | diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c |
8553 | index aafac128bb5f1..4eb979a096c78 100644 |
8554 | --- a/drivers/spi/spi-pxa2xx-pci.c |
8555 | +++ b/drivers/spi/spi-pxa2xx-pci.c |
8556 | @@ -74,14 +74,23 @@ static bool lpss_dma_filter(struct dma_chan *chan, void *param) |
8557 | return true; |
8558 | } |
8559 | |
8560 | +static void lpss_dma_put_device(void *dma_dev) |
8561 | +{ |
8562 | + pci_dev_put(dma_dev); |
8563 | +} |
8564 | + |
8565 | static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
8566 | { |
8567 | struct pci_dev *dma_dev; |
8568 | + int ret; |
8569 | |
8570 | c->num_chipselect = 1; |
8571 | c->max_clk_rate = 50000000; |
8572 | |
8573 | dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); |
8574 | + ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); |
8575 | + if (ret) |
8576 | + return ret; |
8577 | |
8578 | if (c->tx_param) { |
8579 | struct dw_dma_slave *slave = c->tx_param; |
8580 | @@ -105,8 +114,9 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
8581 | |
8582 | static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
8583 | { |
8584 | - struct pci_dev *dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); |
8585 | struct dw_dma_slave *tx, *rx; |
8586 | + struct pci_dev *dma_dev; |
8587 | + int ret; |
8588 | |
8589 | switch (PCI_FUNC(dev->devfn)) { |
8590 | case 0: |
8591 | @@ -131,6 +141,11 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c) |
8592 | return -ENODEV; |
8593 | } |
8594 | |
8595 | + dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); |
8596 | + ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); |
8597 | + if (ret) |
8598 | + return ret; |
8599 | + |
8600 | tx = c->tx_param; |
8601 | tx->dma_dev = &dma_dev->dev; |
8602 | |
8603 | diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
8604 | index 594905bf89aa8..3f7a64b2a5d06 100644 |
8605 | --- a/drivers/spi/spi-tegra114.c |
8606 | +++ b/drivers/spi/spi-tegra114.c |
8607 | @@ -1352,6 +1352,10 @@ static int tegra_spi_probe(struct platform_device *pdev) |
8608 | tspi->phys = r->start; |
8609 | |
8610 | spi_irq = platform_get_irq(pdev, 0); |
8611 | + if (spi_irq < 0) { |
8612 | + ret = spi_irq; |
8613 | + goto exit_free_master; |
8614 | + } |
8615 | tspi->irq = spi_irq; |
8616 | |
8617 | tspi->clk = devm_clk_get(&pdev->dev, "spi"); |
8618 | diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
8619 | index 9b59539c87359..e6b12f78c8f01 100644 |
8620 | --- a/drivers/spi/spi-tegra20-slink.c |
8621 | +++ b/drivers/spi/spi-tegra20-slink.c |
8622 | @@ -1011,14 +1011,8 @@ static int tegra_slink_probe(struct platform_device *pdev) |
8623 | struct resource *r; |
8624 | int ret, spi_irq; |
8625 | const struct tegra_slink_chip_data *cdata = NULL; |
8626 | - const struct of_device_id *match; |
8627 | |
8628 | - match = of_match_device(tegra_slink_of_match, &pdev->dev); |
8629 | - if (!match) { |
8630 | - dev_err(&pdev->dev, "Error: No device match found\n"); |
8631 | - return -ENODEV; |
8632 | - } |
8633 | - cdata = match->data; |
8634 | + cdata = of_device_get_match_data(&pdev->dev); |
8635 | |
8636 | master = spi_alloc_master(&pdev->dev, sizeof(*tspi)); |
8637 | if (!master) { |
8638 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
8639 | index ac05c9c864884..b18ae50db1f52 100644 |
8640 | --- a/drivers/spi/spi.c |
8641 | +++ b/drivers/spi/spi.c |
8642 | @@ -844,10 +844,10 @@ int spi_map_buf(struct spi_controller *ctlr, struct device *dev, |
8643 | int i, ret; |
8644 | |
8645 | if (vmalloced_buf || kmap_buf) { |
8646 | - desc_len = min_t(int, max_seg_size, PAGE_SIZE); |
8647 | + desc_len = min_t(unsigned long, max_seg_size, PAGE_SIZE); |
8648 | sgs = DIV_ROUND_UP(len + offset_in_page(buf), desc_len); |
8649 | } else if (virt_addr_valid(buf)) { |
8650 | - desc_len = min_t(int, max_seg_size, ctlr->max_dma_len); |
8651 | + desc_len = min_t(size_t, max_seg_size, ctlr->max_dma_len); |
8652 | sgs = DIV_ROUND_UP(len, desc_len); |
8653 | } else { |
8654 | return -EINVAL; |
8655 | diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c |
8656 | index 19a5f244dcae2..d8886c5c0d1f2 100644 |
8657 | --- a/drivers/staging/iio/adc/ad7280a.c |
8658 | +++ b/drivers/staging/iio/adc/ad7280a.c |
8659 | @@ -107,9 +107,9 @@ |
8660 | static unsigned int ad7280a_devaddr(unsigned int addr) |
8661 | { |
8662 | return ((addr & 0x1) << 4) | |
8663 | - ((addr & 0x2) << 3) | |
8664 | + ((addr & 0x2) << 2) | |
8665 | (addr & 0x4) | |
8666 | - ((addr & 0x8) >> 3) | |
8667 | + ((addr & 0x8) >> 2) | |
8668 | ((addr & 0x10) >> 4); |
8669 | } |
8670 | |
8671 | diff --git a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c |
8672 | index 8b76f1f13b062..e81a354b88720 100644 |
8673 | --- a/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c |
8674 | +++ b/drivers/staging/media/hantro/hantro_h1_jpeg_enc.c |
8675 | @@ -23,7 +23,7 @@ static void hantro_h1_set_src_img_ctrl(struct hantro_dev *vpu, |
8676 | |
8677 | reg = H1_REG_IN_IMG_CTRL_ROW_LEN(pix_fmt->width) |
8678 | | H1_REG_IN_IMG_CTRL_OVRFLR_D4(0) |
8679 | - | H1_REG_IN_IMG_CTRL_OVRFLB_D4(0) |
8680 | + | H1_REG_IN_IMG_CTRL_OVRFLB(0) |
8681 | | H1_REG_IN_IMG_CTRL_FMT(ctx->vpu_src_fmt->enc_fmt); |
8682 | vepu_write_relaxed(vpu, reg, H1_REG_IN_IMG_CTRL); |
8683 | } |
8684 | diff --git a/drivers/staging/media/hantro/hantro_h1_regs.h b/drivers/staging/media/hantro/hantro_h1_regs.h |
8685 | index d6e9825bb5c7b..30e7e7b920b55 100644 |
8686 | --- a/drivers/staging/media/hantro/hantro_h1_regs.h |
8687 | +++ b/drivers/staging/media/hantro/hantro_h1_regs.h |
8688 | @@ -47,7 +47,7 @@ |
8689 | #define H1_REG_IN_IMG_CTRL 0x03c |
8690 | #define H1_REG_IN_IMG_CTRL_ROW_LEN(x) ((x) << 12) |
8691 | #define H1_REG_IN_IMG_CTRL_OVRFLR_D4(x) ((x) << 10) |
8692 | -#define H1_REG_IN_IMG_CTRL_OVRFLB_D4(x) ((x) << 6) |
8693 | +#define H1_REG_IN_IMG_CTRL_OVRFLB(x) ((x) << 6) |
8694 | #define H1_REG_IN_IMG_CTRL_FMT(x) ((x) << 2) |
8695 | #define H1_REG_ENC_CTRL0 0x040 |
8696 | #define H1_REG_ENC_CTRL0_INIT_QP(x) ((x) << 26) |
8697 | diff --git a/drivers/staging/mt7621-dts/gbpc1.dts b/drivers/staging/mt7621-dts/gbpc1.dts |
8698 | index 1fb560ff059c8..1713283e60d4e 100644 |
8699 | --- a/drivers/staging/mt7621-dts/gbpc1.dts |
8700 | +++ b/drivers/staging/mt7621-dts/gbpc1.dts |
8701 | @@ -11,7 +11,8 @@ |
8702 | |
8703 | memory@0 { |
8704 | device_type = "memory"; |
8705 | - reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; |
8706 | + reg = <0x00000000 0x1c000000>, |
8707 | + <0x20000000 0x04000000>; |
8708 | }; |
8709 | |
8710 | chosen { |
8711 | @@ -37,24 +38,16 @@ |
8712 | gpio-leds { |
8713 | compatible = "gpio-leds"; |
8714 | |
8715 | - system { |
8716 | - label = "gb-pc1:green:system"; |
8717 | + power { |
8718 | + label = "green:power"; |
8719 | gpios = <&gpio 6 GPIO_ACTIVE_LOW>; |
8720 | + linux,default-trigger = "default-on"; |
8721 | }; |
8722 | |
8723 | - status { |
8724 | - label = "gb-pc1:green:status"; |
8725 | + system { |
8726 | + label = "green:system"; |
8727 | gpios = <&gpio 8 GPIO_ACTIVE_LOW>; |
8728 | - }; |
8729 | - |
8730 | - lan1 { |
8731 | - label = "gb-pc1:green:lan1"; |
8732 | - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; |
8733 | - }; |
8734 | - |
8735 | - lan2 { |
8736 | - label = "gb-pc1:green:lan2"; |
8737 | - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; |
8738 | + linux,default-trigger = "disk-activity"; |
8739 | }; |
8740 | }; |
8741 | }; |
8742 | @@ -94,9 +87,8 @@ |
8743 | |
8744 | partition@50000 { |
8745 | label = "firmware"; |
8746 | - reg = <0x50000 0x1FB0000>; |
8747 | + reg = <0x50000 0x1fb0000>; |
8748 | }; |
8749 | - |
8750 | }; |
8751 | }; |
8752 | |
8753 | @@ -118,9 +110,12 @@ |
8754 | }; |
8755 | |
8756 | &pinctrl { |
8757 | - state_default: pinctrl0 { |
8758 | - default_gpio: gpio { |
8759 | - groups = "wdt", "rgmii2", "uart3"; |
8760 | + pinctrl-names = "default"; |
8761 | + pinctrl-0 = <&state_default>; |
8762 | + |
8763 | + state_default: state-default { |
8764 | + gpio-pinmux { |
8765 | + groups = "rgmii2", "uart3", "wdt"; |
8766 | function = "gpio"; |
8767 | }; |
8768 | }; |
8769 | @@ -129,12 +124,13 @@ |
8770 | &switch0 { |
8771 | ports { |
8772 | port@0 { |
8773 | + status = "okay"; |
8774 | label = "ethblack"; |
8775 | - status = "ok"; |
8776 | }; |
8777 | + |
8778 | port@4 { |
8779 | + status = "okay"; |
8780 | label = "ethblue"; |
8781 | - status = "ok"; |
8782 | }; |
8783 | }; |
8784 | }; |
8785 | diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
8786 | index a31163547fbaa..3a1a28a79d463 100644 |
8787 | --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
8788 | +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
8789 | @@ -49,7 +49,7 @@ struct int3400_thermal_priv { |
8790 | struct art *arts; |
8791 | int trt_count; |
8792 | struct trt *trts; |
8793 | - u8 uuid_bitmap; |
8794 | + u32 uuid_bitmap; |
8795 | int rel_misc_dev_res; |
8796 | int current_uuid_index; |
8797 | }; |
8798 | diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c |
8799 | index 2af1e5751bd63..796fbff623f6e 100644 |
8800 | --- a/drivers/tty/hvc/hvc_iucv.c |
8801 | +++ b/drivers/tty/hvc/hvc_iucv.c |
8802 | @@ -1470,7 +1470,9 @@ out_error: |
8803 | */ |
8804 | static int __init hvc_iucv_config(char *val) |
8805 | { |
8806 | - return kstrtoul(val, 10, &hvc_iucv_devices); |
8807 | + if (kstrtoul(val, 10, &hvc_iucv_devices)) |
8808 | + pr_warn("hvc_iucv= invalid parameter value '%s'\n", val); |
8809 | + return 1; |
8810 | } |
8811 | |
8812 | |
8813 | diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c |
8814 | index 9d00ff5ef9611..085dc8dd1327b 100644 |
8815 | --- a/drivers/tty/mxser.c |
8816 | +++ b/drivers/tty/mxser.c |
8817 | @@ -861,6 +861,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
8818 | struct mxser_port *info = container_of(port, struct mxser_port, port); |
8819 | unsigned long page; |
8820 | unsigned long flags; |
8821 | + int ret; |
8822 | |
8823 | page = __get_free_page(GFP_KERNEL); |
8824 | if (!page) |
8825 | @@ -870,9 +871,9 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
8826 | |
8827 | if (!info->ioaddr || !info->type) { |
8828 | set_bit(TTY_IO_ERROR, &tty->flags); |
8829 | - free_page(page); |
8830 | spin_unlock_irqrestore(&info->slock, flags); |
8831 | - return 0; |
8832 | + ret = 0; |
8833 | + goto err_free_xmit; |
8834 | } |
8835 | info->port.xmit_buf = (unsigned char *) page; |
8836 | |
8837 | @@ -898,8 +899,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
8838 | if (capable(CAP_SYS_ADMIN)) { |
8839 | set_bit(TTY_IO_ERROR, &tty->flags); |
8840 | return 0; |
8841 | - } else |
8842 | - return -ENODEV; |
8843 | + } |
8844 | + |
8845 | + ret = -ENODEV; |
8846 | + goto err_free_xmit; |
8847 | } |
8848 | |
8849 | /* |
8850 | @@ -944,6 +947,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) |
8851 | spin_unlock_irqrestore(&info->slock, flags); |
8852 | |
8853 | return 0; |
8854 | +err_free_xmit: |
8855 | + free_page(page); |
8856 | + info->port.xmit_buf = NULL; |
8857 | + return ret; |
8858 | } |
8859 | |
8860 | /* |
8861 | diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c |
8862 | index efa0515139f8e..e6c1791609ddf 100644 |
8863 | --- a/drivers/tty/serial/8250/8250_mid.c |
8864 | +++ b/drivers/tty/serial/8250/8250_mid.c |
8865 | @@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p) |
8866 | return 0; |
8867 | } |
8868 | |
8869 | +static void pnw_exit(struct mid8250 *mid) |
8870 | +{ |
8871 | + pci_dev_put(mid->dma_dev); |
8872 | +} |
8873 | + |
8874 | static int tng_handle_irq(struct uart_port *p) |
8875 | { |
8876 | struct mid8250 *mid = p->private_data; |
8877 | @@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p) |
8878 | return 0; |
8879 | } |
8880 | |
8881 | +static void tng_exit(struct mid8250 *mid) |
8882 | +{ |
8883 | + pci_dev_put(mid->dma_dev); |
8884 | +} |
8885 | + |
8886 | static int dnv_handle_irq(struct uart_port *p) |
8887 | { |
8888 | struct mid8250 *mid = p->private_data; |
8889 | @@ -330,9 +340,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
8890 | |
8891 | pci_set_drvdata(pdev, mid); |
8892 | return 0; |
8893 | + |
8894 | err: |
8895 | - if (mid->board->exit) |
8896 | - mid->board->exit(mid); |
8897 | + mid->board->exit(mid); |
8898 | return ret; |
8899 | } |
8900 | |
8901 | @@ -342,8 +352,7 @@ static void mid8250_remove(struct pci_dev *pdev) |
8902 | |
8903 | serial8250_unregister_port(mid->line); |
8904 | |
8905 | - if (mid->board->exit) |
8906 | - mid->board->exit(mid); |
8907 | + mid->board->exit(mid); |
8908 | } |
8909 | |
8910 | static const struct mid8250_board pnw_board = { |
8911 | @@ -351,6 +360,7 @@ static const struct mid8250_board pnw_board = { |
8912 | .freq = 50000000, |
8913 | .base_baud = 115200, |
8914 | .setup = pnw_setup, |
8915 | + .exit = pnw_exit, |
8916 | }; |
8917 | |
8918 | static const struct mid8250_board tng_board = { |
8919 | @@ -358,6 +368,7 @@ static const struct mid8250_board tng_board = { |
8920 | .freq = 38400000, |
8921 | .base_baud = 1843200, |
8922 | .setup = tng_setup, |
8923 | + .exit = tng_exit, |
8924 | }; |
8925 | |
8926 | static const struct mid8250_board dnv_board = { |
8927 | diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
8928 | index 777ef1a9591c0..87567515591e1 100644 |
8929 | --- a/drivers/tty/serial/8250/8250_port.c |
8930 | +++ b/drivers/tty/serial/8250/8250_port.c |
8931 | @@ -1545,6 +1545,18 @@ static inline void start_tx_rs485(struct uart_port *port) |
8932 | if (!(up->port.rs485.flags & SER_RS485_RX_DURING_TX)) |
8933 | serial8250_stop_rx(&up->port); |
8934 | |
8935 | + /* |
8936 | + * While serial8250_em485_handle_stop_tx() is a noop if |
8937 | + * em485->active_timer != &em485->stop_tx_timer, it might happen that |
8938 | + * the timer is still armed and triggers only after the current bunch of |
8939 | + * chars is send and em485->active_timer == &em485->stop_tx_timer again. |
8940 | + * So cancel the timer. There is still a theoretical race condition if |
8941 | + * the timer is already running and only comes around to check for |
8942 | + * em485->active_timer when &em485->stop_tx_timer is armed again. |
8943 | + */ |
8944 | + if (em485->active_timer == &em485->stop_tx_timer) |
8945 | + hrtimer_try_to_cancel(&em485->stop_tx_timer); |
8946 | + |
8947 | em485->active_timer = NULL; |
8948 | |
8949 | mcr = serial8250_in_MCR(up); |
8950 | diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c |
8951 | index f5608ad68ae1a..6d4792ec9e5fa 100644 |
8952 | --- a/drivers/tty/serial/kgdboc.c |
8953 | +++ b/drivers/tty/serial/kgdboc.c |
8954 | @@ -391,16 +391,16 @@ static int kgdboc_option_setup(char *opt) |
8955 | { |
8956 | if (!opt) { |
8957 | pr_err("config string not provided\n"); |
8958 | - return -EINVAL; |
8959 | + return 1; |
8960 | } |
8961 | |
8962 | if (strlen(opt) >= MAX_CONFIG_LEN) { |
8963 | pr_err("config string too long\n"); |
8964 | - return -ENOSPC; |
8965 | + return 1; |
8966 | } |
8967 | strcpy(config, opt); |
8968 | |
8969 | - return 0; |
8970 | + return 1; |
8971 | } |
8972 | |
8973 | __setup("kgdboc=", kgdboc_option_setup); |
8974 | diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c |
8975 | index c7683beb3412a..6040d5a6139ab 100644 |
8976 | --- a/drivers/tty/serial/samsung.c |
8977 | +++ b/drivers/tty/serial/samsung.c |
8978 | @@ -761,11 +761,8 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id) |
8979 | goto out; |
8980 | } |
8981 | |
8982 | - if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) { |
8983 | - spin_unlock(&port->lock); |
8984 | + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
8985 | uart_write_wakeup(port); |
8986 | - spin_lock(&port->lock); |
8987 | - } |
8988 | |
8989 | if (uart_circ_empty(xmit)) |
8990 | s3c24xx_serial_stop_tx(port); |
8991 | diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c |
8992 | index e8acad49a53a8..81ee1cd794f7d 100644 |
8993 | --- a/drivers/usb/dwc3/dwc3-omap.c |
8994 | +++ b/drivers/usb/dwc3/dwc3-omap.c |
8995 | @@ -242,7 +242,7 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, |
8996 | break; |
8997 | |
8998 | case OMAP_DWC3_ID_FLOAT: |
8999 | - if (omap->vbus_reg) |
9000 | + if (omap->vbus_reg && regulator_is_enabled(omap->vbus_reg)) |
9001 | regulator_disable(omap->vbus_reg); |
9002 | val = dwc3_omap_read_utmi_ctrl(omap); |
9003 | val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG; |
9004 | diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c |
9005 | index 774ccaa5aceea..1962140a59f20 100644 |
9006 | --- a/drivers/usb/host/ehci-pci.c |
9007 | +++ b/drivers/usb/host/ehci-pci.c |
9008 | @@ -21,6 +21,9 @@ static const char hcd_name[] = "ehci-pci"; |
9009 | /* defined here to avoid adding to pci_ids.h for single instance use */ |
9010 | #define PCI_DEVICE_ID_INTEL_CE4100_USB 0x2e70 |
9011 | |
9012 | +#define PCI_VENDOR_ID_ASPEED 0x1a03 |
9013 | +#define PCI_DEVICE_ID_ASPEED_EHCI 0x2603 |
9014 | + |
9015 | /*-------------------------------------------------------------------------*/ |
9016 | #define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 |
9017 | static inline bool is_intel_quark_x1000(struct pci_dev *pdev) |
9018 | @@ -223,6 +226,12 @@ static int ehci_pci_setup(struct usb_hcd *hcd) |
9019 | ehci->has_synopsys_hc_bug = 1; |
9020 | } |
9021 | break; |
9022 | + case PCI_VENDOR_ID_ASPEED: |
9023 | + if (pdev->device == PCI_DEVICE_ID_ASPEED_EHCI) { |
9024 | + ehci_info(ehci, "applying Aspeed HC workaround\n"); |
9025 | + ehci->is_aspeed = 1; |
9026 | + } |
9027 | + break; |
9028 | } |
9029 | |
9030 | /* optional debug port, normally in the first BAR */ |
9031 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
9032 | index 48832f7f2fc3c..db65e1ad00deb 100644 |
9033 | --- a/drivers/usb/host/xhci-hub.c |
9034 | +++ b/drivers/usb/host/xhci-hub.c |
9035 | @@ -674,7 +674,7 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci) |
9036 | } |
9037 | pm_runtime_allow(xhci_to_hcd(xhci)->self.controller); |
9038 | xhci->test_mode = 0; |
9039 | - return xhci_reset(xhci); |
9040 | + return xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
9041 | } |
9042 | |
9043 | void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port, |
9044 | @@ -1000,6 +1000,9 @@ static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status, |
9045 | if (link_state == XDEV_U2) |
9046 | *status |= USB_PORT_STAT_L1; |
9047 | if (link_state == XDEV_U0) { |
9048 | + if (bus_state->resume_done[portnum]) |
9049 | + usb_hcd_end_port_resume(&port->rhub->hcd->self, |
9050 | + portnum); |
9051 | bus_state->resume_done[portnum] = 0; |
9052 | clear_bit(portnum, &bus_state->resuming_ports); |
9053 | if (bus_state->suspended_ports & (1 << portnum)) { |
9054 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
9055 | index 160caef09c5ea..ef23a69c6553a 100644 |
9056 | --- a/drivers/usb/host/xhci-mem.c |
9057 | +++ b/drivers/usb/host/xhci-mem.c |
9058 | @@ -2583,7 +2583,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
9059 | |
9060 | fail: |
9061 | xhci_halt(xhci); |
9062 | - xhci_reset(xhci); |
9063 | + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
9064 | xhci_mem_cleanup(xhci); |
9065 | return -ENOMEM; |
9066 | } |
9067 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
9068 | index 8f029d44e9c9e..476dc6abd5a21 100644 |
9069 | --- a/drivers/usb/host/xhci.c |
9070 | +++ b/drivers/usb/host/xhci.c |
9071 | @@ -66,7 +66,7 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) |
9072 | * handshake done). There are two failure modes: "usec" have passed (major |
9073 | * hardware flakeout), or the register reads as all-ones (hardware removed). |
9074 | */ |
9075 | -int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) |
9076 | +int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us) |
9077 | { |
9078 | u32 result; |
9079 | int ret; |
9080 | @@ -74,7 +74,7 @@ int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) |
9081 | ret = readl_poll_timeout_atomic(ptr, result, |
9082 | (result & mask) == done || |
9083 | result == U32_MAX, |
9084 | - 1, usec); |
9085 | + 1, timeout_us); |
9086 | if (result == U32_MAX) /* card removed */ |
9087 | return -ENODEV; |
9088 | |
9089 | @@ -163,7 +163,7 @@ int xhci_start(struct xhci_hcd *xhci) |
9090 | * Transactions will be terminated immediately, and operational registers |
9091 | * will be set to their defaults. |
9092 | */ |
9093 | -int xhci_reset(struct xhci_hcd *xhci) |
9094 | +int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us) |
9095 | { |
9096 | u32 command; |
9097 | u32 state; |
9098 | @@ -196,8 +196,7 @@ int xhci_reset(struct xhci_hcd *xhci) |
9099 | if (xhci->quirks & XHCI_INTEL_HOST) |
9100 | udelay(1000); |
9101 | |
9102 | - ret = xhci_handshake(&xhci->op_regs->command, |
9103 | - CMD_RESET, 0, 10 * 1000 * 1000); |
9104 | + ret = xhci_handshake(&xhci->op_regs->command, CMD_RESET, 0, timeout_us); |
9105 | if (ret) |
9106 | return ret; |
9107 | |
9108 | @@ -210,8 +209,7 @@ int xhci_reset(struct xhci_hcd *xhci) |
9109 | * xHCI cannot write to any doorbells or operational registers other |
9110 | * than status until the "Controller Not Ready" flag is cleared. |
9111 | */ |
9112 | - ret = xhci_handshake(&xhci->op_regs->status, |
9113 | - STS_CNR, 0, 10 * 1000 * 1000); |
9114 | + ret = xhci_handshake(&xhci->op_regs->status, STS_CNR, 0, timeout_us); |
9115 | |
9116 | xhci->usb2_rhub.bus_state.port_c_suspend = 0; |
9117 | xhci->usb2_rhub.bus_state.suspended_ports = 0; |
9118 | @@ -732,7 +730,7 @@ static void xhci_stop(struct usb_hcd *hcd) |
9119 | xhci->xhc_state |= XHCI_STATE_HALTED; |
9120 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
9121 | xhci_halt(xhci); |
9122 | - xhci_reset(xhci); |
9123 | + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
9124 | spin_unlock_irq(&xhci->lock); |
9125 | |
9126 | xhci_cleanup_msix(xhci); |
9127 | @@ -785,7 +783,7 @@ void xhci_shutdown(struct usb_hcd *hcd) |
9128 | xhci_halt(xhci); |
9129 | /* Workaround for spurious wakeups at shutdown with HSW */ |
9130 | if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
9131 | - xhci_reset(xhci); |
9132 | + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); |
9133 | spin_unlock_irq(&xhci->lock); |
9134 | |
9135 | xhci_cleanup_msix(xhci); |
9136 | @@ -1170,7 +1168,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
9137 | xhci_dbg(xhci, "Stop HCD\n"); |
9138 | xhci_halt(xhci); |
9139 | xhci_zero_64b_regs(xhci); |
9140 | - retval = xhci_reset(xhci); |
9141 | + retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC); |
9142 | spin_unlock_irq(&xhci->lock); |
9143 | if (retval) |
9144 | return retval; |
9145 | @@ -5272,7 +5270,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) |
9146 | |
9147 | xhci_dbg(xhci, "Resetting HCD\n"); |
9148 | /* Reset the internal HC memory state and registers. */ |
9149 | - retval = xhci_reset(xhci); |
9150 | + retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC); |
9151 | if (retval) |
9152 | return retval; |
9153 | xhci_dbg(xhci, "Reset complete\n"); |
9154 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
9155 | index 02df309e44093..4b05d767e08f7 100644 |
9156 | --- a/drivers/usb/host/xhci.h |
9157 | +++ b/drivers/usb/host/xhci.h |
9158 | @@ -229,6 +229,9 @@ struct xhci_op_regs { |
9159 | #define CMD_ETE (1 << 14) |
9160 | /* bits 15:31 are reserved (and should be preserved on writes). */ |
9161 | |
9162 | +#define XHCI_RESET_LONG_USEC (10 * 1000 * 1000) |
9163 | +#define XHCI_RESET_SHORT_USEC (250 * 1000) |
9164 | + |
9165 | /* IMAN - Interrupt Management Register */ |
9166 | #define IMAN_IE (1 << 1) |
9167 | #define IMAN_IP (1 << 0) |
9168 | @@ -2061,11 +2064,11 @@ void xhci_free_container_ctx(struct xhci_hcd *xhci, |
9169 | |
9170 | /* xHCI host controller glue */ |
9171 | typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); |
9172 | -int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec); |
9173 | +int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us); |
9174 | void xhci_quiesce(struct xhci_hcd *xhci); |
9175 | int xhci_halt(struct xhci_hcd *xhci); |
9176 | int xhci_start(struct xhci_hcd *xhci); |
9177 | -int xhci_reset(struct xhci_hcd *xhci); |
9178 | +int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us); |
9179 | int xhci_run(struct usb_hcd *hcd); |
9180 | int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); |
9181 | void xhci_shutdown(struct usb_hcd *hcd); |
9182 | @@ -2449,6 +2452,8 @@ static inline const char *xhci_decode_ctrl_ctx(unsigned long drop, |
9183 | unsigned int bit; |
9184 | int ret = 0; |
9185 | |
9186 | + str[0] = '\0'; |
9187 | + |
9188 | if (drop) { |
9189 | ret = sprintf(str, "Drop:"); |
9190 | for_each_set_bit(bit, &drop, 32) |
9191 | diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig |
9192 | index 67279c6bce338..31ad8682ad9b8 100644 |
9193 | --- a/drivers/usb/serial/Kconfig |
9194 | +++ b/drivers/usb/serial/Kconfig |
9195 | @@ -66,6 +66,7 @@ config USB_SERIAL_SIMPLE |
9196 | - Libtransistor USB console |
9197 | - a number of Motorola phones |
9198 | - Motorola Tetra devices |
9199 | + - Nokia mobile phones |
9200 | - Novatel Wireless GPS receivers |
9201 | - Siemens USB/MPI adapter. |
9202 | - ViVOtech ViVOpay USB device. |
9203 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c |
9204 | index 9600cee957697..2a91219dee7e6 100644 |
9205 | --- a/drivers/usb/serial/pl2303.c |
9206 | +++ b/drivers/usb/serial/pl2303.c |
9207 | @@ -110,6 +110,7 @@ static const struct usb_device_id id_table[] = { |
9208 | { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530GC_PRODUCT_ID) }, |
9209 | { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, |
9210 | { USB_DEVICE(AT_VENDOR_ID, AT_VTKIT3_PRODUCT_ID) }, |
9211 | + { USB_DEVICE(IBM_VENDOR_ID, IBM_PRODUCT_ID) }, |
9212 | { } /* Terminating entry */ |
9213 | }; |
9214 | |
9215 | diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h |
9216 | index 3e5442573fe4e..15f746e977a71 100644 |
9217 | --- a/drivers/usb/serial/pl2303.h |
9218 | +++ b/drivers/usb/serial/pl2303.h |
9219 | @@ -29,6 +29,9 @@ |
9220 | #define ATEN_PRODUCT_UC232B 0x2022 |
9221 | #define ATEN_PRODUCT_ID2 0x2118 |
9222 | |
9223 | +#define IBM_VENDOR_ID 0x04b3 |
9224 | +#define IBM_PRODUCT_ID 0x4016 |
9225 | + |
9226 | #define IODATA_VENDOR_ID 0x04bb |
9227 | #define IODATA_PRODUCT_ID 0x0a03 |
9228 | #define IODATA_PRODUCT_ID_RSAQ5 0x0a0e |
9229 | diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c |
9230 | index bd23a7cb1be2b..4c6747889a194 100644 |
9231 | --- a/drivers/usb/serial/usb-serial-simple.c |
9232 | +++ b/drivers/usb/serial/usb-serial-simple.c |
9233 | @@ -91,6 +91,11 @@ DEVICE(moto_modem, MOTO_IDS); |
9234 | { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ |
9235 | DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); |
9236 | |
9237 | +/* Nokia mobile phone driver */ |
9238 | +#define NOKIA_IDS() \ |
9239 | + { USB_DEVICE(0x0421, 0x069a) } /* Nokia 130 (RM-1035) */ |
9240 | +DEVICE(nokia, NOKIA_IDS); |
9241 | + |
9242 | /* Novatel Wireless GPS driver */ |
9243 | #define NOVATEL_IDS() \ |
9244 | { USB_DEVICE(0x09d7, 0x0100) } /* NovAtel FlexPack GPS */ |
9245 | @@ -123,6 +128,7 @@ static struct usb_serial_driver * const serial_drivers[] = { |
9246 | &vivopay_device, |
9247 | &moto_modem_device, |
9248 | &motorola_tetra_device, |
9249 | + &nokia_device, |
9250 | &novatel_gps_device, |
9251 | &hp4x_device, |
9252 | &suunto_device, |
9253 | @@ -140,6 +146,7 @@ static const struct usb_device_id id_table[] = { |
9254 | VIVOPAY_IDS(), |
9255 | MOTO_IDS(), |
9256 | MOTOROLA_TETRA_IDS(), |
9257 | + NOKIA_IDS(), |
9258 | NOVATEL_IDS(), |
9259 | HP4X_IDS(), |
9260 | SUUNTO_IDS(), |
9261 | diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c |
9262 | index 8b1b730654218..9c984f3c7248a 100644 |
9263 | --- a/drivers/usb/storage/ene_ub6250.c |
9264 | +++ b/drivers/usb/storage/ene_ub6250.c |
9265 | @@ -237,36 +237,33 @@ static struct us_unusual_dev ene_ub6250_unusual_dev_list[] = { |
9266 | #define memstick_logaddr(logadr1, logadr0) ((((u16)(logadr1)) << 8) | (logadr0)) |
9267 | |
9268 | |
9269 | -struct SD_STATUS { |
9270 | - u8 Insert:1; |
9271 | - u8 Ready:1; |
9272 | - u8 MediaChange:1; |
9273 | - u8 IsMMC:1; |
9274 | - u8 HiCapacity:1; |
9275 | - u8 HiSpeed:1; |
9276 | - u8 WtP:1; |
9277 | - u8 Reserved:1; |
9278 | -}; |
9279 | - |
9280 | -struct MS_STATUS { |
9281 | - u8 Insert:1; |
9282 | - u8 Ready:1; |
9283 | - u8 MediaChange:1; |
9284 | - u8 IsMSPro:1; |
9285 | - u8 IsMSPHG:1; |
9286 | - u8 Reserved1:1; |
9287 | - u8 WtP:1; |
9288 | - u8 Reserved2:1; |
9289 | -}; |
9290 | - |
9291 | -struct SM_STATUS { |
9292 | - u8 Insert:1; |
9293 | - u8 Ready:1; |
9294 | - u8 MediaChange:1; |
9295 | - u8 Reserved:3; |
9296 | - u8 WtP:1; |
9297 | - u8 IsMS:1; |
9298 | -}; |
9299 | +/* SD_STATUS bits */ |
9300 | +#define SD_Insert BIT(0) |
9301 | +#define SD_Ready BIT(1) |
9302 | +#define SD_MediaChange BIT(2) |
9303 | +#define SD_IsMMC BIT(3) |
9304 | +#define SD_HiCapacity BIT(4) |
9305 | +#define SD_HiSpeed BIT(5) |
9306 | +#define SD_WtP BIT(6) |
9307 | + /* Bit 7 reserved */ |
9308 | + |
9309 | +/* MS_STATUS bits */ |
9310 | +#define MS_Insert BIT(0) |
9311 | +#define MS_Ready BIT(1) |
9312 | +#define MS_MediaChange BIT(2) |
9313 | +#define MS_IsMSPro BIT(3) |
9314 | +#define MS_IsMSPHG BIT(4) |
9315 | + /* Bit 5 reserved */ |
9316 | +#define MS_WtP BIT(6) |
9317 | + /* Bit 7 reserved */ |
9318 | + |
9319 | +/* SM_STATUS bits */ |
9320 | +#define SM_Insert BIT(0) |
9321 | +#define SM_Ready BIT(1) |
9322 | +#define SM_MediaChange BIT(2) |
9323 | + /* Bits 3-5 reserved */ |
9324 | +#define SM_WtP BIT(6) |
9325 | +#define SM_IsMS BIT(7) |
9326 | |
9327 | struct ms_bootblock_cis { |
9328 | u8 bCistplDEVICE[6]; /* 0 */ |
9329 | @@ -437,9 +434,9 @@ struct ene_ub6250_info { |
9330 | u8 *bbuf; |
9331 | |
9332 | /* for 6250 code */ |
9333 | - struct SD_STATUS SD_Status; |
9334 | - struct MS_STATUS MS_Status; |
9335 | - struct SM_STATUS SM_Status; |
9336 | + u8 SD_Status; |
9337 | + u8 MS_Status; |
9338 | + u8 SM_Status; |
9339 | |
9340 | /* ----- SD Control Data ---------------- */ |
9341 | /*SD_REGISTER SD_Regs; */ |
9342 | @@ -602,7 +599,7 @@ static int sd_scsi_test_unit_ready(struct us_data *us, struct scsi_cmnd *srb) |
9343 | { |
9344 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
9345 | |
9346 | - if (info->SD_Status.Insert && info->SD_Status.Ready) |
9347 | + if ((info->SD_Status & SD_Insert) && (info->SD_Status & SD_Ready)) |
9348 | return USB_STOR_TRANSPORT_GOOD; |
9349 | else { |
9350 | ene_sd_init(us); |
9351 | @@ -622,7 +619,7 @@ static int sd_scsi_mode_sense(struct us_data *us, struct scsi_cmnd *srb) |
9352 | 0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, |
9353 | 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00 }; |
9354 | |
9355 | - if (info->SD_Status.WtP) |
9356 | + if (info->SD_Status & SD_WtP) |
9357 | usb_stor_set_xfer_buf(mediaWP, 12, srb); |
9358 | else |
9359 | usb_stor_set_xfer_buf(mediaNoWP, 12, srb); |
9360 | @@ -641,9 +638,9 @@ static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) |
9361 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
9362 | |
9363 | usb_stor_dbg(us, "sd_scsi_read_capacity\n"); |
9364 | - if (info->SD_Status.HiCapacity) { |
9365 | + if (info->SD_Status & SD_HiCapacity) { |
9366 | bl_len = 0x200; |
9367 | - if (info->SD_Status.IsMMC) |
9368 | + if (info->SD_Status & SD_IsMMC) |
9369 | bl_num = info->HC_C_SIZE-1; |
9370 | else |
9371 | bl_num = (info->HC_C_SIZE + 1) * 1024 - 1; |
9372 | @@ -693,7 +690,7 @@ static int sd_scsi_read(struct us_data *us, struct scsi_cmnd *srb) |
9373 | return USB_STOR_TRANSPORT_ERROR; |
9374 | } |
9375 | |
9376 | - if (info->SD_Status.HiCapacity) |
9377 | + if (info->SD_Status & SD_HiCapacity) |
9378 | bnByte = bn; |
9379 | |
9380 | /* set up the command wrapper */ |
9381 | @@ -733,7 +730,7 @@ static int sd_scsi_write(struct us_data *us, struct scsi_cmnd *srb) |
9382 | return USB_STOR_TRANSPORT_ERROR; |
9383 | } |
9384 | |
9385 | - if (info->SD_Status.HiCapacity) |
9386 | + if (info->SD_Status & SD_HiCapacity) |
9387 | bnByte = bn; |
9388 | |
9389 | /* set up the command wrapper */ |
9390 | @@ -1455,7 +1452,7 @@ static int ms_scsi_test_unit_ready(struct us_data *us, struct scsi_cmnd *srb) |
9391 | struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); |
9392 | |
9393 | /* pr_info("MS_SCSI_Test_Unit_Ready\n"); */ |
9394 | - if (info->MS_Status.Insert && info->MS_Status.Ready) { |
9395 | + if ((info->MS_Status & MS_Insert) && (info->MS_Status & MS_Ready)) { |
9396 | return USB_STOR_TRANSPORT_GOOD; |
9397 | } else { |
9398 | ene_ms_init(us); |
9399 | @@ -1475,7 +1472,7 @@ static int ms_scsi_mode_sense(struct us_data *us, struct scsi_cmnd *srb) |
9400 | 0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, |
9401 | 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00 }; |
9402 | |
9403 | - if (info->MS_Status.WtP) |
9404 | + if (info->MS_Status & MS_WtP) |
9405 | usb_stor_set_xfer_buf(mediaWP, 12, srb); |
9406 | else |
9407 | usb_stor_set_xfer_buf(mediaNoWP, 12, srb); |
9408 | @@ -1494,7 +1491,7 @@ static int ms_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) |
9409 | |
9410 | usb_stor_dbg(us, "ms_scsi_read_capacity\n"); |
9411 | bl_len = 0x200; |
9412 | - if (info->MS_Status.IsMSPro) |
9413 | + if (info->MS_Status & MS_IsMSPro) |
9414 | bl_num = info->MSP_TotalBlock - 1; |
9415 | else |
9416 | bl_num = info->MS_Lib.NumberOfLogBlock * info->MS_Lib.blockSize * 2 - 1; |
9417 | @@ -1649,7 +1646,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb) |
9418 | if (bn > info->bl_num) |
9419 | return USB_STOR_TRANSPORT_ERROR; |
9420 | |
9421 | - if (info->MS_Status.IsMSPro) { |
9422 | + if (info->MS_Status & MS_IsMSPro) { |
9423 | result = ene_load_bincode(us, MSP_RW_PATTERN); |
9424 | if (result != USB_STOR_XFER_GOOD) { |
9425 | usb_stor_dbg(us, "Load MPS RW pattern Fail !!\n"); |
9426 | @@ -1750,7 +1747,7 @@ static int ms_scsi_write(struct us_data *us, struct scsi_cmnd *srb) |
9427 | if (bn > info->bl_num) |
9428 | return USB_STOR_TRANSPORT_ERROR; |
9429 | |
9430 | - if (info->MS_Status.IsMSPro) { |
9431 | + if (info->MS_Status & MS_IsMSPro) { |
9432 | result = ene_load_bincode(us, MSP_RW_PATTERN); |
9433 | if (result != USB_STOR_XFER_GOOD) { |
9434 | pr_info("Load MSP RW pattern Fail !!\n"); |
9435 | @@ -1858,12 +1855,12 @@ static int ene_get_card_status(struct us_data *us, u8 *buf) |
9436 | |
9437 | tmpreg = (u16) reg4b; |
9438 | reg4b = *(u32 *)(&buf[0x14]); |
9439 | - if (info->SD_Status.HiCapacity && !info->SD_Status.IsMMC) |
9440 | + if ((info->SD_Status & SD_HiCapacity) && !(info->SD_Status & SD_IsMMC)) |
9441 | info->HC_C_SIZE = (reg4b >> 8) & 0x3fffff; |
9442 | |
9443 | info->SD_C_SIZE = ((tmpreg & 0x03) << 10) | (u16)(reg4b >> 22); |
9444 | info->SD_C_SIZE_MULT = (u8)(reg4b >> 7) & 0x07; |
9445 | - if (info->SD_Status.HiCapacity && info->SD_Status.IsMMC) |
9446 | + if ((info->SD_Status & SD_HiCapacity) && (info->SD_Status & SD_IsMMC)) |
9447 | info->HC_C_SIZE = *(u32 *)(&buf[0x100]); |
9448 | |
9449 | if (info->SD_READ_BL_LEN > SD_BLOCK_LEN) { |
9450 | @@ -2075,6 +2072,7 @@ static int ene_ms_init(struct us_data *us) |
9451 | u16 MSP_BlockSize, MSP_UserAreaBlocks; |
9452 | struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; |
9453 | u8 *bbuf = info->bbuf; |
9454 | + unsigned int s; |
9455 | |
9456 | printk(KERN_INFO "transport --- ENE_MSInit\n"); |
9457 | |
9458 | @@ -2099,15 +2097,16 @@ static int ene_ms_init(struct us_data *us) |
9459 | return USB_STOR_TRANSPORT_ERROR; |
9460 | } |
9461 | /* the same part to test ENE */ |
9462 | - info->MS_Status = *(struct MS_STATUS *) bbuf; |
9463 | - |
9464 | - if (info->MS_Status.Insert && info->MS_Status.Ready) { |
9465 | - printk(KERN_INFO "Insert = %x\n", info->MS_Status.Insert); |
9466 | - printk(KERN_INFO "Ready = %x\n", info->MS_Status.Ready); |
9467 | - printk(KERN_INFO "IsMSPro = %x\n", info->MS_Status.IsMSPro); |
9468 | - printk(KERN_INFO "IsMSPHG = %x\n", info->MS_Status.IsMSPHG); |
9469 | - printk(KERN_INFO "WtP= %x\n", info->MS_Status.WtP); |
9470 | - if (info->MS_Status.IsMSPro) { |
9471 | + info->MS_Status = bbuf[0]; |
9472 | + |
9473 | + s = info->MS_Status; |
9474 | + if ((s & MS_Insert) && (s & MS_Ready)) { |
9475 | + printk(KERN_INFO "Insert = %x\n", !!(s & MS_Insert)); |
9476 | + printk(KERN_INFO "Ready = %x\n", !!(s & MS_Ready)); |
9477 | + printk(KERN_INFO "IsMSPro = %x\n", !!(s & MS_IsMSPro)); |
9478 | + printk(KERN_INFO "IsMSPHG = %x\n", !!(s & MS_IsMSPHG)); |
9479 | + printk(KERN_INFO "WtP= %x\n", !!(s & MS_WtP)); |
9480 | + if (s & MS_IsMSPro) { |
9481 | MSP_BlockSize = (bbuf[6] << 8) | bbuf[7]; |
9482 | MSP_UserAreaBlocks = (bbuf[10] << 8) | bbuf[11]; |
9483 | info->MSP_TotalBlock = MSP_BlockSize * MSP_UserAreaBlocks; |
9484 | @@ -2168,17 +2167,17 @@ static int ene_sd_init(struct us_data *us) |
9485 | return USB_STOR_TRANSPORT_ERROR; |
9486 | } |
9487 | |
9488 | - info->SD_Status = *(struct SD_STATUS *) bbuf; |
9489 | - if (info->SD_Status.Insert && info->SD_Status.Ready) { |
9490 | - struct SD_STATUS *s = &info->SD_Status; |
9491 | + info->SD_Status = bbuf[0]; |
9492 | + if ((info->SD_Status & SD_Insert) && (info->SD_Status & SD_Ready)) { |
9493 | + unsigned int s = info->SD_Status; |
9494 | |
9495 | ene_get_card_status(us, bbuf); |
9496 | - usb_stor_dbg(us, "Insert = %x\n", s->Insert); |
9497 | - usb_stor_dbg(us, "Ready = %x\n", s->Ready); |
9498 | - usb_stor_dbg(us, "IsMMC = %x\n", s->IsMMC); |
9499 | - usb_stor_dbg(us, "HiCapacity = %x\n", s->HiCapacity); |
9500 | - usb_stor_dbg(us, "HiSpeed = %x\n", s->HiSpeed); |
9501 | - usb_stor_dbg(us, "WtP = %x\n", s->WtP); |
9502 | + usb_stor_dbg(us, "Insert = %x\n", !!(s & SD_Insert)); |
9503 | + usb_stor_dbg(us, "Ready = %x\n", !!(s & SD_Ready)); |
9504 | + usb_stor_dbg(us, "IsMMC = %x\n", !!(s & SD_IsMMC)); |
9505 | + usb_stor_dbg(us, "HiCapacity = %x\n", !!(s & SD_HiCapacity)); |
9506 | + usb_stor_dbg(us, "HiSpeed = %x\n", !!(s & SD_HiSpeed)); |
9507 | + usb_stor_dbg(us, "WtP = %x\n", !!(s & SD_WtP)); |
9508 | } else { |
9509 | usb_stor_dbg(us, "SD Card Not Ready --- %x\n", bbuf[0]); |
9510 | return USB_STOR_TRANSPORT_ERROR; |
9511 | @@ -2200,14 +2199,14 @@ static int ene_init(struct us_data *us) |
9512 | |
9513 | misc_reg03 = bbuf[0]; |
9514 | if (misc_reg03 & 0x01) { |
9515 | - if (!info->SD_Status.Ready) { |
9516 | + if (!(info->SD_Status & SD_Ready)) { |
9517 | result = ene_sd_init(us); |
9518 | if (result != USB_STOR_XFER_GOOD) |
9519 | return USB_STOR_TRANSPORT_ERROR; |
9520 | } |
9521 | } |
9522 | if (misc_reg03 & 0x02) { |
9523 | - if (!info->MS_Status.Ready) { |
9524 | + if (!(info->MS_Status & MS_Ready)) { |
9525 | result = ene_ms_init(us); |
9526 | if (result != USB_STOR_XFER_GOOD) |
9527 | return USB_STOR_TRANSPORT_ERROR; |
9528 | @@ -2306,14 +2305,14 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us) |
9529 | |
9530 | /*US_DEBUG(usb_stor_show_command(us, srb)); */ |
9531 | scsi_set_resid(srb, 0); |
9532 | - if (unlikely(!(info->SD_Status.Ready || info->MS_Status.Ready))) |
9533 | + if (unlikely(!(info->SD_Status & SD_Ready) || (info->MS_Status & MS_Ready))) |
9534 | result = ene_init(us); |
9535 | if (result == USB_STOR_XFER_GOOD) { |
9536 | result = USB_STOR_TRANSPORT_ERROR; |
9537 | - if (info->SD_Status.Ready) |
9538 | + if (info->SD_Status & SD_Ready) |
9539 | result = sd_scsi_irp(us, srb); |
9540 | |
9541 | - if (info->MS_Status.Ready) |
9542 | + if (info->MS_Status & MS_Ready) |
9543 | result = ms_scsi_irp(us, srb); |
9544 | } |
9545 | return result; |
9546 | @@ -2377,7 +2376,6 @@ static int ene_ub6250_probe(struct usb_interface *intf, |
9547 | |
9548 | static int ene_ub6250_resume(struct usb_interface *iface) |
9549 | { |
9550 | - u8 tmp = 0; |
9551 | struct us_data *us = usb_get_intfdata(iface); |
9552 | struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); |
9553 | |
9554 | @@ -2389,17 +2387,16 @@ static int ene_ub6250_resume(struct usb_interface *iface) |
9555 | mutex_unlock(&us->dev_mutex); |
9556 | |
9557 | info->Power_IsResum = true; |
9558 | - /*info->SD_Status.Ready = 0; */ |
9559 | - info->SD_Status = *(struct SD_STATUS *)&tmp; |
9560 | - info->MS_Status = *(struct MS_STATUS *)&tmp; |
9561 | - info->SM_Status = *(struct SM_STATUS *)&tmp; |
9562 | + /* info->SD_Status &= ~SD_Ready; */ |
9563 | + info->SD_Status = 0; |
9564 | + info->MS_Status = 0; |
9565 | + info->SM_Status = 0; |
9566 | |
9567 | return 0; |
9568 | } |
9569 | |
9570 | static int ene_ub6250_reset_resume(struct usb_interface *iface) |
9571 | { |
9572 | - u8 tmp = 0; |
9573 | struct us_data *us = usb_get_intfdata(iface); |
9574 | struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); |
9575 | |
9576 | @@ -2411,10 +2408,10 @@ static int ene_ub6250_reset_resume(struct usb_interface *iface) |
9577 | * the device |
9578 | */ |
9579 | info->Power_IsResum = true; |
9580 | - /*info->SD_Status.Ready = 0; */ |
9581 | - info->SD_Status = *(struct SD_STATUS *)&tmp; |
9582 | - info->MS_Status = *(struct MS_STATUS *)&tmp; |
9583 | - info->SM_Status = *(struct SM_STATUS *)&tmp; |
9584 | + /* info->SD_Status &= ~SD_Ready; */ |
9585 | + info->SD_Status = 0; |
9586 | + info->MS_Status = 0; |
9587 | + info->SM_Status = 0; |
9588 | |
9589 | return 0; |
9590 | } |
9591 | diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c |
9592 | index 3789698d9d3c6..0c423916d7bfa 100644 |
9593 | --- a/drivers/usb/storage/realtek_cr.c |
9594 | +++ b/drivers/usb/storage/realtek_cr.c |
9595 | @@ -365,7 +365,7 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) |
9596 | |
9597 | buf = kmalloc(len, GFP_NOIO); |
9598 | if (buf == NULL) |
9599 | - return USB_STOR_TRANSPORT_ERROR; |
9600 | + return -ENOMEM; |
9601 | |
9602 | usb_stor_dbg(us, "addr = 0x%x, len = %d\n", addr, len); |
9603 | |
9604 | diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c |
9605 | index cec9173aac6f5..1058aba8d5734 100644 |
9606 | --- a/drivers/vhost/net.c |
9607 | +++ b/drivers/vhost/net.c |
9608 | @@ -472,6 +472,7 @@ static void vhost_tx_batch(struct vhost_net *net, |
9609 | goto signal_used; |
9610 | |
9611 | msghdr->msg_control = &ctl; |
9612 | + msghdr->msg_controllen = sizeof(ctl); |
9613 | err = sock->ops->sendmsg(sock, msghdr, 0); |
9614 | if (unlikely(err < 0)) { |
9615 | vq_err(&nvq->vq, "Fail to batch sending packets\n"); |
9616 | diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c |
9617 | index 51f5d1c56fd9c..c1ee817d7dcc5 100644 |
9618 | --- a/drivers/video/fbdev/atafb.c |
9619 | +++ b/drivers/video/fbdev/atafb.c |
9620 | @@ -1692,9 +1692,9 @@ static int falcon_setcolreg(unsigned int regno, unsigned int red, |
9621 | ((blue & 0xfc00) >> 8)); |
9622 | if (regno < 16) { |
9623 | shifter_tt.color_reg[regno] = |
9624 | - (((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) | |
9625 | - (((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) | |
9626 | - ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); |
9627 | + ((((red & 0xe000) >> 13) | ((red & 0x1000) >> 12)) << 8) | |
9628 | + ((((green & 0xe000) >> 13) | ((green & 0x1000) >> 12)) << 4) | |
9629 | + ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); |
9630 | ((u32 *)info->pseudo_palette)[regno] = ((red & 0xf800) | |
9631 | ((green & 0xfc00) >> 5) | |
9632 | ((blue & 0xf800) >> 11)); |
9633 | @@ -1980,9 +1980,9 @@ static int stste_setcolreg(unsigned int regno, unsigned int red, |
9634 | green >>= 12; |
9635 | if (ATARIHW_PRESENT(EXTD_SHIFTER)) |
9636 | shifter_tt.color_reg[regno] = |
9637 | - (((red & 0xe) >> 1) | ((red & 1) << 3) << 8) | |
9638 | - (((green & 0xe) >> 1) | ((green & 1) << 3) << 4) | |
9639 | - ((blue & 0xe) >> 1) | ((blue & 1) << 3); |
9640 | + ((((red & 0xe) >> 1) | ((red & 1) << 3)) << 8) | |
9641 | + ((((green & 0xe) >> 1) | ((green & 1) << 3)) << 4) | |
9642 | + ((blue & 0xe) >> 1) | ((blue & 1) << 3); |
9643 | else |
9644 | shifter_tt.color_reg[regno] = |
9645 | ((red & 0xe) << 7) | |
9646 | diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c |
9647 | index cf2bfff2efbf1..b91919861075b 100644 |
9648 | --- a/drivers/video/fbdev/atmel_lcdfb.c |
9649 | +++ b/drivers/video/fbdev/atmel_lcdfb.c |
9650 | @@ -1062,15 +1062,16 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) |
9651 | |
9652 | INIT_LIST_HEAD(&info->modelist); |
9653 | |
9654 | - if (pdev->dev.of_node) { |
9655 | - ret = atmel_lcdfb_of_init(sinfo); |
9656 | - if (ret) |
9657 | - goto free_info; |
9658 | - } else { |
9659 | + if (!pdev->dev.of_node) { |
9660 | dev_err(dev, "cannot get default configuration\n"); |
9661 | goto free_info; |
9662 | } |
9663 | |
9664 | + ret = atmel_lcdfb_of_init(sinfo); |
9665 | + if (ret) |
9666 | + goto free_info; |
9667 | + |
9668 | + ret = -ENODEV; |
9669 | if (!sinfo->config) |
9670 | goto free_info; |
9671 | |
9672 | diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c |
9673 | index e4ce5667b1251..1b0a58f96af25 100644 |
9674 | --- a/drivers/video/fbdev/cirrusfb.c |
9675 | +++ b/drivers/video/fbdev/cirrusfb.c |
9676 | @@ -470,7 +470,7 @@ static int cirrusfb_check_mclk(struct fb_info *info, long freq) |
9677 | return 0; |
9678 | } |
9679 | |
9680 | -static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, |
9681 | +static int cirrusfb_check_pixclock(struct fb_var_screeninfo *var, |
9682 | struct fb_info *info) |
9683 | { |
9684 | long freq; |
9685 | @@ -479,9 +479,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, |
9686 | unsigned maxclockidx = var->bits_per_pixel >> 3; |
9687 | |
9688 | /* convert from ps to kHz */ |
9689 | - freq = PICOS2KHZ(var->pixclock); |
9690 | - |
9691 | - dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq); |
9692 | + freq = PICOS2KHZ(var->pixclock ? : 1); |
9693 | |
9694 | maxclock = cirrusfb_board_info[cinfo->btype].maxclock[maxclockidx]; |
9695 | cinfo->multiplexing = 0; |
9696 | @@ -489,11 +487,13 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var, |
9697 | /* If the frequency is greater than we can support, we might be able |
9698 | * to use multiplexing for the video mode */ |
9699 | if (freq > maxclock) { |
9700 | - dev_err(info->device, |
9701 | - "Frequency greater than maxclock (%ld kHz)\n", |
9702 | - maxclock); |
9703 | - return -EINVAL; |
9704 | + var->pixclock = KHZ2PICOS(maxclock); |
9705 | + |
9706 | + while ((freq = PICOS2KHZ(var->pixclock)) > maxclock) |
9707 | + var->pixclock++; |
9708 | } |
9709 | + dev_dbg(info->device, "desired pixclock: %ld kHz\n", freq); |
9710 | + |
9711 | /* |
9712 | * Additional constraint: 8bpp uses DAC clock doubling to allow maximum |
9713 | * pixel clock |
9714 | diff --git a/drivers/video/fbdev/core/fbcvt.c b/drivers/video/fbdev/core/fbcvt.c |
9715 | index 55d2bd0ce5c02..64843464c6613 100644 |
9716 | --- a/drivers/video/fbdev/core/fbcvt.c |
9717 | +++ b/drivers/video/fbdev/core/fbcvt.c |
9718 | @@ -214,9 +214,11 @@ static u32 fb_cvt_aspect_ratio(struct fb_cvt_data *cvt) |
9719 | static void fb_cvt_print_name(struct fb_cvt_data *cvt) |
9720 | { |
9721 | u32 pixcount, pixcount_mod; |
9722 | - int cnt = 255, offset = 0, read = 0; |
9723 | - u8 *buf = kzalloc(256, GFP_KERNEL); |
9724 | + int size = 256; |
9725 | + int off = 0; |
9726 | + u8 *buf; |
9727 | |
9728 | + buf = kzalloc(size, GFP_KERNEL); |
9729 | if (!buf) |
9730 | return; |
9731 | |
9732 | @@ -224,43 +226,30 @@ static void fb_cvt_print_name(struct fb_cvt_data *cvt) |
9733 | pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000; |
9734 | pixcount_mod /= 1000; |
9735 | |
9736 | - read = snprintf(buf+offset, cnt, "fbcvt: %dx%d@%d: CVT Name - ", |
9737 | - cvt->xres, cvt->yres, cvt->refresh); |
9738 | - offset += read; |
9739 | - cnt -= read; |
9740 | + off += scnprintf(buf + off, size - off, "fbcvt: %dx%d@%d: CVT Name - ", |
9741 | + cvt->xres, cvt->yres, cvt->refresh); |
9742 | |
9743 | - if (cvt->status) |
9744 | - snprintf(buf+offset, cnt, "Not a CVT standard - %d.%03d Mega " |
9745 | - "Pixel Image\n", pixcount, pixcount_mod); |
9746 | - else { |
9747 | - if (pixcount) { |
9748 | - read = snprintf(buf+offset, cnt, "%d", pixcount); |
9749 | - cnt -= read; |
9750 | - offset += read; |
9751 | - } |
9752 | + if (cvt->status) { |
9753 | + off += scnprintf(buf + off, size - off, |
9754 | + "Not a CVT standard - %d.%03d Mega Pixel Image\n", |
9755 | + pixcount, pixcount_mod); |
9756 | + } else { |
9757 | + if (pixcount) |
9758 | + off += scnprintf(buf + off, size - off, "%d", pixcount); |
9759 | |
9760 | - read = snprintf(buf+offset, cnt, ".%03dM", pixcount_mod); |
9761 | - cnt -= read; |
9762 | - offset += read; |
9763 | + off += scnprintf(buf + off, size - off, ".%03dM", pixcount_mod); |
9764 | |
9765 | if (cvt->aspect_ratio == 0) |
9766 | - read = snprintf(buf+offset, cnt, "3"); |
9767 | + off += scnprintf(buf + off, size - off, "3"); |
9768 | else if (cvt->aspect_ratio == 3) |
9769 | - read = snprintf(buf+offset, cnt, "4"); |
9770 | + off += scnprintf(buf + off, size - off, "4"); |
9771 | else if (cvt->aspect_ratio == 1 || cvt->aspect_ratio == 4) |
9772 | - read = snprintf(buf+offset, cnt, "9"); |
9773 | + off += scnprintf(buf + off, size - off, "9"); |
9774 | else if (cvt->aspect_ratio == 2) |
9775 | - read = snprintf(buf+offset, cnt, "A"); |
9776 | - else |
9777 | - read = 0; |
9778 | - cnt -= read; |
9779 | - offset += read; |
9780 | - |
9781 | - if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK) { |
9782 | - read = snprintf(buf+offset, cnt, "-R"); |
9783 | - cnt -= read; |
9784 | - offset += read; |
9785 | - } |
9786 | + off += scnprintf(buf + off, size - off, "A"); |
9787 | + |
9788 | + if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK) |
9789 | + off += scnprintf(buf + off, size - off, "-R"); |
9790 | } |
9791 | |
9792 | printk(KERN_INFO "%s\n", buf); |
9793 | diff --git a/drivers/video/fbdev/nvidia/nv_i2c.c b/drivers/video/fbdev/nvidia/nv_i2c.c |
9794 | index d7994a1732459..0b48965a6420c 100644 |
9795 | --- a/drivers/video/fbdev/nvidia/nv_i2c.c |
9796 | +++ b/drivers/video/fbdev/nvidia/nv_i2c.c |
9797 | @@ -86,7 +86,7 @@ static int nvidia_setup_i2c_bus(struct nvidia_i2c_chan *chan, const char *name, |
9798 | { |
9799 | int rc; |
9800 | |
9801 | - strcpy(chan->adapter.name, name); |
9802 | + strscpy(chan->adapter.name, name, sizeof(chan->adapter.name)); |
9803 | chan->adapter.owner = THIS_MODULE; |
9804 | chan->adapter.class = i2c_class; |
9805 | chan->adapter.algo_data = &chan->algo; |
9806 | diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c |
9807 | index b4a1aefff7661..777f6d66c28c3 100644 |
9808 | --- a/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c |
9809 | +++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c |
9810 | @@ -251,6 +251,7 @@ static int dvic_probe_of(struct platform_device *pdev) |
9811 | adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); |
9812 | if (adapter_node) { |
9813 | adapter = of_get_i2c_adapter_by_node(adapter_node); |
9814 | + of_node_put(adapter_node); |
9815 | if (adapter == NULL) { |
9816 | dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n"); |
9817 | omap_dss_put_device(ddata->in); |
9818 | diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c |
9819 | index 4b0793abdd84b..a2c7c5cb15234 100644 |
9820 | --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c |
9821 | +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c |
9822 | @@ -409,7 +409,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev, |
9823 | if (r) |
9824 | return r; |
9825 | |
9826 | - return snprintf(buf, PAGE_SIZE, "%d\n", errors); |
9827 | + return sysfs_emit(buf, "%d\n", errors); |
9828 | } |
9829 | |
9830 | static ssize_t dsicm_hw_revision_show(struct device *dev, |
9831 | @@ -439,7 +439,7 @@ static ssize_t dsicm_hw_revision_show(struct device *dev, |
9832 | if (r) |
9833 | return r; |
9834 | |
9835 | - return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3); |
9836 | + return sysfs_emit(buf, "%02x.%02x.%02x\n", id1, id2, id3); |
9837 | } |
9838 | |
9839 | static ssize_t dsicm_store_ulps(struct device *dev, |
9840 | @@ -487,7 +487,7 @@ static ssize_t dsicm_show_ulps(struct device *dev, |
9841 | t = ddata->ulps_enabled; |
9842 | mutex_unlock(&ddata->lock); |
9843 | |
9844 | - return snprintf(buf, PAGE_SIZE, "%u\n", t); |
9845 | + return sysfs_emit(buf, "%u\n", t); |
9846 | } |
9847 | |
9848 | static ssize_t dsicm_store_ulps_timeout(struct device *dev, |
9849 | @@ -532,7 +532,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev, |
9850 | t = ddata->ulps_timeout; |
9851 | mutex_unlock(&ddata->lock); |
9852 | |
9853 | - return snprintf(buf, PAGE_SIZE, "%u\n", t); |
9854 | + return sysfs_emit(buf, "%u\n", t); |
9855 | } |
9856 | |
9857 | static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL); |
9858 | diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c |
9859 | index 1293515e4b169..0cbc5b9183f89 100644 |
9860 | --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c |
9861 | +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c |
9862 | @@ -476,7 +476,7 @@ static ssize_t show_cabc_available_modes(struct device *dev, |
9863 | int i; |
9864 | |
9865 | if (!ddata->has_cabc) |
9866 | - return snprintf(buf, PAGE_SIZE, "%s\n", cabc_modes[0]); |
9867 | + return sysfs_emit(buf, "%s\n", cabc_modes[0]); |
9868 | |
9869 | for (i = 0, len = 0; |
9870 | len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++) |
9871 | diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c |
9872 | index bb85b21f07248..9f6ef9e04d9ce 100644 |
9873 | --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c |
9874 | +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c |
9875 | @@ -169,7 +169,7 @@ static ssize_t tpo_td043_vmirror_show(struct device *dev, |
9876 | { |
9877 | struct panel_drv_data *ddata = dev_get_drvdata(dev); |
9878 | |
9879 | - return snprintf(buf, PAGE_SIZE, "%d\n", ddata->vmirror); |
9880 | + return sysfs_emit(buf, "%d\n", ddata->vmirror); |
9881 | } |
9882 | |
9883 | static ssize_t tpo_td043_vmirror_store(struct device *dev, |
9884 | @@ -199,7 +199,7 @@ static ssize_t tpo_td043_mode_show(struct device *dev, |
9885 | { |
9886 | struct panel_drv_data *ddata = dev_get_drvdata(dev); |
9887 | |
9888 | - return snprintf(buf, PAGE_SIZE, "%d\n", ddata->mode); |
9889 | + return sysfs_emit(buf, "%d\n", ddata->mode); |
9890 | } |
9891 | |
9892 | static ssize_t tpo_td043_mode_store(struct device *dev, |
9893 | diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c |
9894 | index 2466814145779..83d05600360dd 100644 |
9895 | --- a/drivers/video/fbdev/sm712fb.c |
9896 | +++ b/drivers/video/fbdev/sm712fb.c |
9897 | @@ -1047,7 +1047,7 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, |
9898 | if (count + p > total_size) |
9899 | count = total_size - p; |
9900 | |
9901 | - buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); |
9902 | + buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); |
9903 | if (!buffer) |
9904 | return -ENOMEM; |
9905 | |
9906 | @@ -1059,25 +1059,14 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, |
9907 | while (count) { |
9908 | c = (count > PAGE_SIZE) ? PAGE_SIZE : count; |
9909 | dst = buffer; |
9910 | - for (i = c >> 2; i--;) { |
9911 | - *dst = fb_readl(src++); |
9912 | - *dst = big_swap(*dst); |
9913 | + for (i = (c + 3) >> 2; i--;) { |
9914 | + u32 val; |
9915 | + |
9916 | + val = fb_readl(src); |
9917 | + *dst = big_swap(val); |
9918 | + src++; |
9919 | dst++; |
9920 | } |
9921 | - if (c & 3) { |
9922 | - u8 *dst8 = (u8 *)dst; |
9923 | - u8 __iomem *src8 = (u8 __iomem *)src; |
9924 | - |
9925 | - for (i = c & 3; i--;) { |
9926 | - if (i & 1) { |
9927 | - *dst8++ = fb_readb(++src8); |
9928 | - } else { |
9929 | - *dst8++ = fb_readb(--src8); |
9930 | - src8 += 2; |
9931 | - } |
9932 | - } |
9933 | - src = (u32 __iomem *)src8; |
9934 | - } |
9935 | |
9936 | if (copy_to_user(buf, buffer, c)) { |
9937 | err = -EFAULT; |
9938 | @@ -1130,7 +1119,7 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, |
9939 | count = total_size - p; |
9940 | } |
9941 | |
9942 | - buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); |
9943 | + buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); |
9944 | if (!buffer) |
9945 | return -ENOMEM; |
9946 | |
9947 | @@ -1148,24 +1137,11 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf, |
9948 | break; |
9949 | } |
9950 | |
9951 | - for (i = c >> 2; i--;) { |
9952 | - fb_writel(big_swap(*src), dst++); |
9953 | + for (i = (c + 3) >> 2; i--;) { |
9954 | + fb_writel(big_swap(*src), dst); |
9955 | + dst++; |
9956 | src++; |
9957 | } |
9958 | - if (c & 3) { |
9959 | - u8 *src8 = (u8 *)src; |
9960 | - u8 __iomem *dst8 = (u8 __iomem *)dst; |
9961 | - |
9962 | - for (i = c & 3; i--;) { |
9963 | - if (i & 1) { |
9964 | - fb_writeb(*src8++, ++dst8); |
9965 | - } else { |
9966 | - fb_writeb(*src8++, --dst8); |
9967 | - dst8 += 2; |
9968 | - } |
9969 | - } |
9970 | - dst = (u32 __iomem *)dst8; |
9971 | - } |
9972 | |
9973 | *ppos += c; |
9974 | buf += c; |
9975 | diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c |
9976 | index 0e0f5bbfc5efc..ad60f739c6a19 100644 |
9977 | --- a/drivers/video/fbdev/smscufx.c |
9978 | +++ b/drivers/video/fbdev/smscufx.c |
9979 | @@ -1657,6 +1657,7 @@ static int ufx_usb_probe(struct usb_interface *interface, |
9980 | info->par = dev; |
9981 | info->pseudo_palette = dev->pseudo_palette; |
9982 | info->fbops = &ufx_ops; |
9983 | + INIT_LIST_HEAD(&info->modelist); |
9984 | |
9985 | retval = fb_alloc_cmap(&info->cmap, 256, 0); |
9986 | if (retval < 0) { |
9987 | @@ -1667,8 +1668,6 @@ static int ufx_usb_probe(struct usb_interface *interface, |
9988 | INIT_DELAYED_WORK(&dev->free_framebuffer_work, |
9989 | ufx_free_framebuffer_work); |
9990 | |
9991 | - INIT_LIST_HEAD(&info->modelist); |
9992 | - |
9993 | retval = ufx_reg_read(dev, 0x3000, &id_rev); |
9994 | check_warn_goto_error(retval, "error %d reading 0x3000 register from device", retval); |
9995 | dev_dbg(dev->gdev, "ID_REV register value 0x%08x", id_rev); |
9996 | diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c |
9997 | index ecbfbbf1c1a79..e269b1391e146 100644 |
9998 | --- a/drivers/video/fbdev/udlfb.c |
9999 | +++ b/drivers/video/fbdev/udlfb.c |
10000 | @@ -1427,7 +1427,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev, |
10001 | struct device_attribute *a, char *buf) { |
10002 | struct fb_info *fb_info = dev_get_drvdata(fbdev); |
10003 | struct dlfb_data *dlfb = fb_info->par; |
10004 | - return snprintf(buf, PAGE_SIZE, "%u\n", |
10005 | + return sysfs_emit(buf, "%u\n", |
10006 | atomic_read(&dlfb->bytes_rendered)); |
10007 | } |
10008 | |
10009 | @@ -1435,7 +1435,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev, |
10010 | struct device_attribute *a, char *buf) { |
10011 | struct fb_info *fb_info = dev_get_drvdata(fbdev); |
10012 | struct dlfb_data *dlfb = fb_info->par; |
10013 | - return snprintf(buf, PAGE_SIZE, "%u\n", |
10014 | + return sysfs_emit(buf, "%u\n", |
10015 | atomic_read(&dlfb->bytes_identical)); |
10016 | } |
10017 | |
10018 | @@ -1443,7 +1443,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev, |
10019 | struct device_attribute *a, char *buf) { |
10020 | struct fb_info *fb_info = dev_get_drvdata(fbdev); |
10021 | struct dlfb_data *dlfb = fb_info->par; |
10022 | - return snprintf(buf, PAGE_SIZE, "%u\n", |
10023 | + return sysfs_emit(buf, "%u\n", |
10024 | atomic_read(&dlfb->bytes_sent)); |
10025 | } |
10026 | |
10027 | @@ -1451,7 +1451,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev, |
10028 | struct device_attribute *a, char *buf) { |
10029 | struct fb_info *fb_info = dev_get_drvdata(fbdev); |
10030 | struct dlfb_data *dlfb = fb_info->par; |
10031 | - return snprintf(buf, PAGE_SIZE, "%u\n", |
10032 | + return sysfs_emit(buf, "%u\n", |
10033 | atomic_read(&dlfb->cpu_kcycles_used)); |
10034 | } |
10035 | |
10036 | diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c |
10037 | index e30f9427b3355..52ec80bbfe5ea 100644 |
10038 | --- a/drivers/video/fbdev/w100fb.c |
10039 | +++ b/drivers/video/fbdev/w100fb.c |
10040 | @@ -770,12 +770,18 @@ out: |
10041 | fb_dealloc_cmap(&info->cmap); |
10042 | kfree(info->pseudo_palette); |
10043 | } |
10044 | - if (remapped_fbuf != NULL) |
10045 | + if (remapped_fbuf != NULL) { |
10046 | iounmap(remapped_fbuf); |
10047 | - if (remapped_regs != NULL) |
10048 | + remapped_fbuf = NULL; |
10049 | + } |
10050 | + if (remapped_regs != NULL) { |
10051 | iounmap(remapped_regs); |
10052 | - if (remapped_base != NULL) |
10053 | + remapped_regs = NULL; |
10054 | + } |
10055 | + if (remapped_base != NULL) { |
10056 | iounmap(remapped_base); |
10057 | + remapped_base = NULL; |
10058 | + } |
10059 | if (info) |
10060 | framebuffer_release(info); |
10061 | return err; |
10062 | @@ -795,8 +801,11 @@ static int w100fb_remove(struct platform_device *pdev) |
10063 | fb_dealloc_cmap(&info->cmap); |
10064 | |
10065 | iounmap(remapped_base); |
10066 | + remapped_base = NULL; |
10067 | iounmap(remapped_regs); |
10068 | + remapped_regs = NULL; |
10069 | iounmap(remapped_fbuf); |
10070 | + remapped_fbuf = NULL; |
10071 | |
10072 | framebuffer_release(info); |
10073 | |
10074 | diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c |
10075 | index e028e00927991..cf1e01f0dede3 100644 |
10076 | --- a/drivers/w1/slaves/w1_therm.c |
10077 | +++ b/drivers/w1/slaves/w1_therm.c |
10078 | @@ -679,16 +679,20 @@ static ssize_t w1_seq_show(struct device *device, |
10079 | if (sl->reg_num.id == reg_num->id) |
10080 | seq = i; |
10081 | |
10082 | + if (w1_reset_bus(sl->master)) |
10083 | + goto error; |
10084 | + |
10085 | + /* Put the device into chain DONE state */ |
10086 | + w1_write_8(sl->master, W1_MATCH_ROM); |
10087 | + w1_write_block(sl->master, (u8 *)&rn, 8); |
10088 | w1_write_8(sl->master, W1_42_CHAIN); |
10089 | w1_write_8(sl->master, W1_42_CHAIN_DONE); |
10090 | w1_write_8(sl->master, W1_42_CHAIN_DONE_INV); |
10091 | - w1_read_block(sl->master, &ack, sizeof(ack)); |
10092 | |
10093 | /* check for acknowledgment */ |
10094 | ack = w1_read_8(sl->master); |
10095 | if (ack != W1_42_SUCCESS_CONFIRM_BYTE) |
10096 | goto error; |
10097 | - |
10098 | } |
10099 | |
10100 | /* Exit from CHAIN state */ |
10101 | diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h |
10102 | index fcf1807cc8dd7..c8def2bdf2474 100644 |
10103 | --- a/fs/btrfs/extent_io.h |
10104 | +++ b/fs/btrfs/extent_io.h |
10105 | @@ -202,7 +202,7 @@ struct extent_buffer { |
10106 | */ |
10107 | struct extent_changeset { |
10108 | /* How many bytes are set/cleared in this operation */ |
10109 | - unsigned int bytes_changed; |
10110 | + u64 bytes_changed; |
10111 | |
10112 | /* Changed ranges */ |
10113 | struct ulist range_changed; |
10114 | diff --git a/fs/ext2/super.c b/fs/ext2/super.c |
10115 | index 065cd2d1bdc68..db403c01d4d5c 100644 |
10116 | --- a/fs/ext2/super.c |
10117 | +++ b/fs/ext2/super.c |
10118 | @@ -770,8 +770,12 @@ static loff_t ext2_max_size(int bits) |
10119 | res += 1LL << (bits-2); |
10120 | res += 1LL << (2*(bits-2)); |
10121 | res += 1LL << (3*(bits-2)); |
10122 | + /* Compute how many metadata blocks are needed */ |
10123 | + meta_blocks = 1; |
10124 | + meta_blocks += 1 + ppb; |
10125 | + meta_blocks += 1 + ppb + ppb * ppb; |
10126 | /* Does block tree limit file size? */ |
10127 | - if (res < upper_limit) |
10128 | + if (res + meta_blocks <= upper_limit) |
10129 | goto check_lfs; |
10130 | |
10131 | res = upper_limit; |
10132 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
10133 | index dcbd8ac8d4711..0d62f05f89256 100644 |
10134 | --- a/fs/ext4/inode.c |
10135 | +++ b/fs/ext4/inode.c |
10136 | @@ -2161,6 +2161,15 @@ static int ext4_writepage(struct page *page, |
10137 | else |
10138 | len = PAGE_SIZE; |
10139 | |
10140 | + /* Should never happen but for bugs in other kernel subsystems */ |
10141 | + if (!page_has_buffers(page)) { |
10142 | + ext4_warning_inode(inode, |
10143 | + "page %lu does not have buffers attached", page->index); |
10144 | + ClearPageDirty(page); |
10145 | + unlock_page(page); |
10146 | + return 0; |
10147 | + } |
10148 | + |
10149 | page_bufs = page_buffers(page); |
10150 | /* |
10151 | * We cannot do block allocation or other extent handling in this |
10152 | @@ -2710,6 +2719,22 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) |
10153 | wait_on_page_writeback(page); |
10154 | BUG_ON(PageWriteback(page)); |
10155 | |
10156 | + /* |
10157 | + * Should never happen but for buggy code in |
10158 | + * other subsystems that call |
10159 | + * set_page_dirty() without properly warning |
10160 | + * the file system first. See [1] for more |
10161 | + * information. |
10162 | + * |
10163 | + * [1] https://lore.kernel.org/linux-mm/20180103100430.GE4911@quack2.suse.cz |
10164 | + */ |
10165 | + if (!page_has_buffers(page)) { |
10166 | + ext4_warning_inode(mpd->inode, "page %lu does not have buffers attached", page->index); |
10167 | + ClearPageDirty(page); |
10168 | + unlock_page(page); |
10169 | + continue; |
10170 | + } |
10171 | + |
10172 | if (mpd->map.m_len == 0) |
10173 | mpd->first_page = page->index; |
10174 | mpd->next_page = page->index + 1; |
10175 | diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c |
10176 | index 03dce3980d90a..54f0d2c4c7d87 100644 |
10177 | --- a/fs/f2fs/checkpoint.c |
10178 | +++ b/fs/f2fs/checkpoint.c |
10179 | @@ -848,6 +848,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, |
10180 | struct page *cp_page_1 = NULL, *cp_page_2 = NULL; |
10181 | struct f2fs_checkpoint *cp_block = NULL; |
10182 | unsigned long long cur_version = 0, pre_version = 0; |
10183 | + unsigned int cp_blocks; |
10184 | int err; |
10185 | |
10186 | err = get_checkpoint_version(sbi, cp_addr, &cp_block, |
10187 | @@ -855,15 +856,16 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, |
10188 | if (err) |
10189 | return NULL; |
10190 | |
10191 | - if (le32_to_cpu(cp_block->cp_pack_total_block_count) > |
10192 | - sbi->blocks_per_seg) { |
10193 | + cp_blocks = le32_to_cpu(cp_block->cp_pack_total_block_count); |
10194 | + |
10195 | + if (cp_blocks > sbi->blocks_per_seg || cp_blocks <= F2FS_CP_PACKS) { |
10196 | f2fs_warn(sbi, "invalid cp_pack_total_block_count:%u", |
10197 | le32_to_cpu(cp_block->cp_pack_total_block_count)); |
10198 | goto invalid_cp; |
10199 | } |
10200 | pre_version = *version; |
10201 | |
10202 | - cp_addr += le32_to_cpu(cp_block->cp_pack_total_block_count) - 1; |
10203 | + cp_addr += cp_blocks - 1; |
10204 | err = get_checkpoint_version(sbi, cp_addr, &cp_block, |
10205 | &cp_page_2, version); |
10206 | if (err) |
10207 | diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
10208 | index 1679f9c0b63b3..773028921c481 100644 |
10209 | --- a/fs/f2fs/data.c |
10210 | +++ b/fs/f2fs/data.c |
10211 | @@ -2467,8 +2467,12 @@ static int __f2fs_write_data_pages(struct address_space *mapping, |
10212 | /* to avoid spliting IOs due to mixed WB_SYNC_ALL and WB_SYNC_NONE */ |
10213 | if (wbc->sync_mode == WB_SYNC_ALL) |
10214 | atomic_inc(&sbi->wb_sync_req[DATA]); |
10215 | - else if (atomic_read(&sbi->wb_sync_req[DATA])) |
10216 | + else if (atomic_read(&sbi->wb_sync_req[DATA])) { |
10217 | + /* to avoid potential deadlock */ |
10218 | + if (current->plug) |
10219 | + blk_finish_plug(current->plug); |
10220 | goto skip_write; |
10221 | + } |
10222 | |
10223 | if (__should_serialize_io(inode, wbc)) { |
10224 | mutex_lock(&sbi->writepages); |
10225 | diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
10226 | index 16abb017e497f..68d5c73c5ed1f 100644 |
10227 | --- a/fs/f2fs/gc.c |
10228 | +++ b/fs/f2fs/gc.c |
10229 | @@ -633,8 +633,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, |
10230 | set_sbi_flag(sbi, SBI_NEED_FSCK); |
10231 | } |
10232 | |
10233 | - if (f2fs_check_nid_range(sbi, dni->ino)) |
10234 | + if (f2fs_check_nid_range(sbi, dni->ino)) { |
10235 | + f2fs_put_page(node_page, 1); |
10236 | return false; |
10237 | + } |
10238 | |
10239 | *nofs = ofs_of_node(node_page); |
10240 | source_blkaddr = datablock_addr(NULL, node_page, ofs_in_node); |
10241 | diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c |
10242 | index 2383d52b1f424..264c19e177797 100644 |
10243 | --- a/fs/f2fs/inode.c |
10244 | +++ b/fs/f2fs/inode.c |
10245 | @@ -777,6 +777,7 @@ void f2fs_handle_failed_inode(struct inode *inode) |
10246 | err = f2fs_get_node_info(sbi, inode->i_ino, &ni); |
10247 | if (err) { |
10248 | set_sbi_flag(sbi, SBI_NEED_FSCK); |
10249 | + set_inode_flag(inode, FI_FREE_NID); |
10250 | f2fs_warn(sbi, "May loss orphan inode, run fsck to fix."); |
10251 | goto out; |
10252 | } |
10253 | diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c |
10254 | index 0cd1d51dde06d..3dc7cc3d6ac69 100644 |
10255 | --- a/fs/f2fs/node.c |
10256 | +++ b/fs/f2fs/node.c |
10257 | @@ -1995,8 +1995,12 @@ static int f2fs_write_node_pages(struct address_space *mapping, |
10258 | |
10259 | if (wbc->sync_mode == WB_SYNC_ALL) |
10260 | atomic_inc(&sbi->wb_sync_req[NODE]); |
10261 | - else if (atomic_read(&sbi->wb_sync_req[NODE])) |
10262 | + else if (atomic_read(&sbi->wb_sync_req[NODE])) { |
10263 | + /* to avoid potential deadlock */ |
10264 | + if (current->plug) |
10265 | + blk_finish_plug(current->plug); |
10266 | goto skip_write; |
10267 | + } |
10268 | |
10269 | trace_f2fs_writepages(mapping->host, wbc, NODE); |
10270 | |
10271 | diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c |
10272 | index a6c9c9fdf21d1..6bd8a944902ef 100644 |
10273 | --- a/fs/f2fs/super.c |
10274 | +++ b/fs/f2fs/super.c |
10275 | @@ -2066,7 +2066,7 @@ int f2fs_quota_sync(struct super_block *sb, int type) |
10276 | struct f2fs_sb_info *sbi = F2FS_SB(sb); |
10277 | struct quota_info *dqopt = sb_dqopt(sb); |
10278 | int cnt; |
10279 | - int ret; |
10280 | + int ret = 0; |
10281 | |
10282 | /* |
10283 | * Now when everything is written we can discard the pagecache so |
10284 | @@ -2077,8 +2077,8 @@ int f2fs_quota_sync(struct super_block *sb, int type) |
10285 | if (type != -1 && cnt != type) |
10286 | continue; |
10287 | |
10288 | - if (!sb_has_quota_active(sb, type)) |
10289 | - return 0; |
10290 | + if (!sb_has_quota_active(sb, cnt)) |
10291 | + continue; |
10292 | |
10293 | inode_lock(dqopt->files[cnt]); |
10294 | |
10295 | diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c |
10296 | index c056ed5c6df30..d7ec0ac87fc03 100644 |
10297 | --- a/fs/gfs2/rgrp.c |
10298 | +++ b/fs/gfs2/rgrp.c |
10299 | @@ -1429,7 +1429,8 @@ int gfs2_fitrim(struct file *filp, void __user *argp) |
10300 | |
10301 | start = r.start >> bs_shift; |
10302 | end = start + (r.len >> bs_shift); |
10303 | - minlen = max_t(u64, r.minlen, |
10304 | + minlen = max_t(u64, r.minlen, sdp->sd_sb.sb_bsize); |
10305 | + minlen = max_t(u64, minlen, |
10306 | q->limits.discard_granularity) >> bs_shift; |
10307 | |
10308 | if (end <= start || minlen > sdp->sd_max_rg_data) |
10309 | diff --git a/fs/io_uring.c b/fs/io_uring.c |
10310 | index 478df7e10767a..e73969fa96bcb 100644 |
10311 | --- a/fs/io_uring.c |
10312 | +++ b/fs/io_uring.c |
10313 | @@ -438,6 +438,22 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) |
10314 | return ctx; |
10315 | } |
10316 | |
10317 | +static void io_req_put_fs(struct io_kiocb *req) |
10318 | +{ |
10319 | + struct fs_struct *fs = req->fs; |
10320 | + |
10321 | + if (!fs) |
10322 | + return; |
10323 | + |
10324 | + spin_lock(&req->fs->lock); |
10325 | + if (--fs->users) |
10326 | + fs = NULL; |
10327 | + spin_unlock(&req->fs->lock); |
10328 | + if (fs) |
10329 | + free_fs_struct(fs); |
10330 | + req->fs = NULL; |
10331 | +} |
10332 | + |
10333 | static inline bool __io_sequence_defer(struct io_ring_ctx *ctx, |
10334 | struct io_kiocb *req) |
10335 | { |
10336 | @@ -695,6 +711,7 @@ static void io_free_req_many(struct io_ring_ctx *ctx, void **reqs, int *nr) |
10337 | |
10338 | static void __io_free_req(struct io_kiocb *req) |
10339 | { |
10340 | + io_req_put_fs(req); |
10341 | if (req->file && !(req->flags & REQ_F_FIXED_FILE)) |
10342 | fput(req->file); |
10343 | percpu_ref_put(&req->ctx->refs); |
10344 | @@ -1701,16 +1718,7 @@ static int io_send_recvmsg(struct io_kiocb *req, const struct io_uring_sqe *sqe, |
10345 | ret = -EINTR; |
10346 | } |
10347 | |
10348 | - if (req->fs) { |
10349 | - struct fs_struct *fs = req->fs; |
10350 | - |
10351 | - spin_lock(&req->fs->lock); |
10352 | - if (--fs->users) |
10353 | - fs = NULL; |
10354 | - spin_unlock(&req->fs->lock); |
10355 | - if (fs) |
10356 | - free_fs_struct(fs); |
10357 | - } |
10358 | + io_req_put_fs(req); |
10359 | io_cqring_add_event(req->ctx, sqe->user_data, ret); |
10360 | io_put_req(req); |
10361 | return 0; |
10362 | diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c |
10363 | index b288c8ae1236b..837cd55fd4c5e 100644 |
10364 | --- a/fs/jffs2/build.c |
10365 | +++ b/fs/jffs2/build.c |
10366 | @@ -415,13 +415,15 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) |
10367 | jffs2_free_ino_caches(c); |
10368 | jffs2_free_raw_node_refs(c); |
10369 | ret = -EIO; |
10370 | - goto out_free; |
10371 | + goto out_sum_exit; |
10372 | } |
10373 | |
10374 | jffs2_calc_trigger_levels(c); |
10375 | |
10376 | return 0; |
10377 | |
10378 | + out_sum_exit: |
10379 | + jffs2_sum_exit(c); |
10380 | out_free: |
10381 | kvfree(c->blocks); |
10382 | |
10383 | diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c |
10384 | index ab8cdd9e93259..ad1eba809e7e1 100644 |
10385 | --- a/fs/jffs2/fs.c |
10386 | +++ b/fs/jffs2/fs.c |
10387 | @@ -602,8 +602,8 @@ out_root: |
10388 | jffs2_free_ino_caches(c); |
10389 | jffs2_free_raw_node_refs(c); |
10390 | kvfree(c->blocks); |
10391 | - out_inohash: |
10392 | jffs2_clear_xattr_subsystem(c); |
10393 | + out_inohash: |
10394 | kfree(c->inocache_list); |
10395 | out_wbuf: |
10396 | jffs2_flash_cleanup(c); |
10397 | diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c |
10398 | index 0b1a7f68b7122..f73904c08b39c 100644 |
10399 | --- a/fs/jffs2/scan.c |
10400 | +++ b/fs/jffs2/scan.c |
10401 | @@ -136,7 +136,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) |
10402 | if (!s) { |
10403 | JFFS2_WARNING("Can't allocate memory for summary\n"); |
10404 | ret = -ENOMEM; |
10405 | - goto out; |
10406 | + goto out_buf; |
10407 | } |
10408 | } |
10409 | |
10410 | @@ -274,13 +274,15 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) |
10411 | } |
10412 | ret = 0; |
10413 | out: |
10414 | + jffs2_sum_reset_collected(s); |
10415 | + kfree(s); |
10416 | + out_buf: |
10417 | if (buf_size) |
10418 | kfree(flashbuf); |
10419 | #ifndef __ECOS |
10420 | else |
10421 | mtd_unpoint(c->mtd, 0, c->mtd->size); |
10422 | #endif |
10423 | - kfree(s); |
10424 | return ret; |
10425 | } |
10426 | |
10427 | diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c |
10428 | index d862cfc3d3a83..62c4a5450cda2 100644 |
10429 | --- a/fs/jfs/inode.c |
10430 | +++ b/fs/jfs/inode.c |
10431 | @@ -146,12 +146,13 @@ void jfs_evict_inode(struct inode *inode) |
10432 | dquot_initialize(inode); |
10433 | |
10434 | if (JFS_IP(inode)->fileset == FILESYSTEM_I) { |
10435 | + struct inode *ipimap = JFS_SBI(inode->i_sb)->ipimap; |
10436 | truncate_inode_pages_final(&inode->i_data); |
10437 | |
10438 | if (test_cflag(COMMIT_Freewmap, inode)) |
10439 | jfs_free_zero_link(inode); |
10440 | |
10441 | - if (JFS_SBI(inode->i_sb)->ipimap) |
10442 | + if (ipimap && JFS_IP(ipimap)->i_imap) |
10443 | diFree(inode); |
10444 | |
10445 | /* |
10446 | diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c |
10447 | index 6fe82ce8663ef..79f3440e204b6 100644 |
10448 | --- a/fs/jfs/jfs_dmap.c |
10449 | +++ b/fs/jfs/jfs_dmap.c |
10450 | @@ -148,6 +148,7 @@ static const s8 budtab[256] = { |
10451 | * 0 - success |
10452 | * -ENOMEM - insufficient memory |
10453 | * -EIO - i/o error |
10454 | + * -EINVAL - wrong bmap data |
10455 | */ |
10456 | int dbMount(struct inode *ipbmap) |
10457 | { |
10458 | @@ -179,6 +180,12 @@ int dbMount(struct inode *ipbmap) |
10459 | bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree); |
10460 | bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage); |
10461 | bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag); |
10462 | + if (!bmp->db_numag) { |
10463 | + release_metapage(mp); |
10464 | + kfree(bmp); |
10465 | + return -EINVAL; |
10466 | + } |
10467 | + |
10468 | bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel); |
10469 | bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag); |
10470 | bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref); |
10471 | diff --git a/fs/minix/inode.c b/fs/minix/inode.c |
10472 | index 7b09a9158e401..3fffc709afd43 100644 |
10473 | --- a/fs/minix/inode.c |
10474 | +++ b/fs/minix/inode.c |
10475 | @@ -447,7 +447,8 @@ static const struct address_space_operations minix_aops = { |
10476 | .writepage = minix_writepage, |
10477 | .write_begin = minix_write_begin, |
10478 | .write_end = generic_write_end, |
10479 | - .bmap = minix_bmap |
10480 | + .bmap = minix_bmap, |
10481 | + .direct_IO = noop_direct_IO |
10482 | }; |
10483 | |
10484 | static const struct inode_operations minix_symlink_inode_operations = { |
10485 | diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c |
10486 | index b8a7b223b5b18..31922657e836e 100644 |
10487 | --- a/fs/nfs/callback_proc.c |
10488 | +++ b/fs/nfs/callback_proc.c |
10489 | @@ -364,12 +364,11 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp, |
10490 | struct cb_process_state *cps) |
10491 | { |
10492 | struct cb_devicenotifyargs *args = argp; |
10493 | + const struct pnfs_layoutdriver_type *ld = NULL; |
10494 | uint32_t i; |
10495 | __be32 res = 0; |
10496 | - struct nfs_client *clp = cps->clp; |
10497 | - struct nfs_server *server = NULL; |
10498 | |
10499 | - if (!clp) { |
10500 | + if (!cps->clp) { |
10501 | res = cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION); |
10502 | goto out; |
10503 | } |
10504 | @@ -377,23 +376,15 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp, |
10505 | for (i = 0; i < args->ndevs; i++) { |
10506 | struct cb_devicenotifyitem *dev = &args->devs[i]; |
10507 | |
10508 | - if (!server || |
10509 | - server->pnfs_curr_ld->id != dev->cbd_layout_type) { |
10510 | - rcu_read_lock(); |
10511 | - list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) |
10512 | - if (server->pnfs_curr_ld && |
10513 | - server->pnfs_curr_ld->id == dev->cbd_layout_type) { |
10514 | - rcu_read_unlock(); |
10515 | - goto found; |
10516 | - } |
10517 | - rcu_read_unlock(); |
10518 | - continue; |
10519 | + if (!ld || ld->id != dev->cbd_layout_type) { |
10520 | + pnfs_put_layoutdriver(ld); |
10521 | + ld = pnfs_find_layoutdriver(dev->cbd_layout_type); |
10522 | + if (!ld) |
10523 | + continue; |
10524 | } |
10525 | - |
10526 | - found: |
10527 | - nfs4_delete_deviceid(server->pnfs_curr_ld, clp, &dev->cbd_dev_id); |
10528 | + nfs4_delete_deviceid(ld, cps->clp, &dev->cbd_dev_id); |
10529 | } |
10530 | - |
10531 | + pnfs_put_layoutdriver(ld); |
10532 | out: |
10533 | kfree(args->devs); |
10534 | return res; |
10535 | diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c |
10536 | index 90b5511c4c440..04d27f0ed39ac 100644 |
10537 | --- a/fs/nfs/callback_xdr.c |
10538 | +++ b/fs/nfs/callback_xdr.c |
10539 | @@ -271,10 +271,6 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, |
10540 | n = ntohl(*p++); |
10541 | if (n == 0) |
10542 | goto out; |
10543 | - if (n > ULONG_MAX / sizeof(*args->devs)) { |
10544 | - status = htonl(NFS4ERR_BADXDR); |
10545 | - goto out; |
10546 | - } |
10547 | |
10548 | args->devs = kmalloc_array(n, sizeof(*args->devs), GFP_KERNEL); |
10549 | if (!args->devs) { |
10550 | diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c |
10551 | index 6b0bf4ebd8124..0682037f972be 100644 |
10552 | --- a/fs/nfs/direct.c |
10553 | +++ b/fs/nfs/direct.c |
10554 | @@ -272,8 +272,8 @@ ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
10555 | VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE); |
10556 | |
10557 | if (iov_iter_rw(iter) == READ) |
10558 | - return nfs_file_direct_read(iocb, iter); |
10559 | - return nfs_file_direct_write(iocb, iter); |
10560 | + return nfs_file_direct_read(iocb, iter, true); |
10561 | + return nfs_file_direct_write(iocb, iter, true); |
10562 | } |
10563 | |
10564 | static void nfs_direct_release_pages(struct page **pages, unsigned int npages) |
10565 | @@ -524,6 +524,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, |
10566 | * nfs_file_direct_read - file direct read operation for NFS files |
10567 | * @iocb: target I/O control block |
10568 | * @iter: vector of user buffers into which to read data |
10569 | + * @swap: flag indicating this is swap IO, not O_DIRECT IO |
10570 | * |
10571 | * We use this function for direct reads instead of calling |
10572 | * generic_file_aio_read() in order to avoid gfar's check to see if |
10573 | @@ -539,7 +540,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, |
10574 | * client must read the updated atime from the server back into its |
10575 | * cache. |
10576 | */ |
10577 | -ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter) |
10578 | +ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, |
10579 | + bool swap) |
10580 | { |
10581 | struct file *file = iocb->ki_filp; |
10582 | struct address_space *mapping = file->f_mapping; |
10583 | @@ -581,12 +583,14 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter) |
10584 | if (iter_is_iovec(iter)) |
10585 | dreq->flags = NFS_ODIRECT_SHOULD_DIRTY; |
10586 | |
10587 | - nfs_start_io_direct(inode); |
10588 | + if (!swap) |
10589 | + nfs_start_io_direct(inode); |
10590 | |
10591 | NFS_I(inode)->read_io += count; |
10592 | requested = nfs_direct_read_schedule_iovec(dreq, iter, iocb->ki_pos); |
10593 | |
10594 | - nfs_end_io_direct(inode); |
10595 | + if (!swap) |
10596 | + nfs_end_io_direct(inode); |
10597 | |
10598 | if (requested > 0) { |
10599 | result = nfs_direct_wait(dreq); |
10600 | @@ -851,7 +855,7 @@ static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = { |
10601 | */ |
10602 | static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, |
10603 | struct iov_iter *iter, |
10604 | - loff_t pos) |
10605 | + loff_t pos, int ioflags) |
10606 | { |
10607 | struct nfs_pageio_descriptor desc; |
10608 | struct inode *inode = dreq->inode; |
10609 | @@ -859,7 +863,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, |
10610 | size_t requested_bytes = 0; |
10611 | size_t wsize = max_t(size_t, NFS_SERVER(inode)->wsize, PAGE_SIZE); |
10612 | |
10613 | - nfs_pageio_init_write(&desc, inode, FLUSH_COND_STABLE, false, |
10614 | + nfs_pageio_init_write(&desc, inode, ioflags, false, |
10615 | &nfs_direct_write_completion_ops); |
10616 | desc.pg_dreq = dreq; |
10617 | get_dreq(dreq); |
10618 | @@ -937,6 +941,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, |
10619 | * nfs_file_direct_write - file direct write operation for NFS files |
10620 | * @iocb: target I/O control block |
10621 | * @iter: vector of user buffers from which to write data |
10622 | + * @swap: flag indicating this is swap IO, not O_DIRECT IO |
10623 | * |
10624 | * We use this function for direct writes instead of calling |
10625 | * generic_file_aio_write() in order to avoid taking the inode |
10626 | @@ -953,7 +958,8 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, |
10627 | * Note that O_APPEND is not supported for NFS direct writes, as there |
10628 | * is no atomic O_APPEND write facility in the NFS protocol. |
10629 | */ |
10630 | -ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) |
10631 | +ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter, |
10632 | + bool swap) |
10633 | { |
10634 | ssize_t result = -EINVAL, requested; |
10635 | size_t count; |
10636 | @@ -967,7 +973,11 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) |
10637 | dfprintk(FILE, "NFS: direct write(%pD2, %zd@%Ld)\n", |
10638 | file, iov_iter_count(iter), (long long) iocb->ki_pos); |
10639 | |
10640 | - result = generic_write_checks(iocb, iter); |
10641 | + if (swap) |
10642 | + /* bypass generic checks */ |
10643 | + result = iov_iter_count(iter); |
10644 | + else |
10645 | + result = generic_write_checks(iocb, iter); |
10646 | if (result <= 0) |
10647 | return result; |
10648 | count = result; |
10649 | @@ -997,16 +1007,22 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) |
10650 | if (!is_sync_kiocb(iocb)) |
10651 | dreq->iocb = iocb; |
10652 | |
10653 | - nfs_start_io_direct(inode); |
10654 | + if (swap) { |
10655 | + requested = nfs_direct_write_schedule_iovec(dreq, iter, pos, |
10656 | + FLUSH_STABLE); |
10657 | + } else { |
10658 | + nfs_start_io_direct(inode); |
10659 | |
10660 | - requested = nfs_direct_write_schedule_iovec(dreq, iter, pos); |
10661 | + requested = nfs_direct_write_schedule_iovec(dreq, iter, pos, |
10662 | + FLUSH_COND_STABLE); |
10663 | |
10664 | - if (mapping->nrpages) { |
10665 | - invalidate_inode_pages2_range(mapping, |
10666 | - pos >> PAGE_SHIFT, end); |
10667 | - } |
10668 | + if (mapping->nrpages) { |
10669 | + invalidate_inode_pages2_range(mapping, |
10670 | + pos >> PAGE_SHIFT, end); |
10671 | + } |
10672 | |
10673 | - nfs_end_io_direct(inode); |
10674 | + nfs_end_io_direct(inode); |
10675 | + } |
10676 | |
10677 | if (requested > 0) { |
10678 | result = nfs_direct_wait(dreq); |
10679 | diff --git a/fs/nfs/file.c b/fs/nfs/file.c |
10680 | index 387a2cfa7e172..73415970af381 100644 |
10681 | --- a/fs/nfs/file.c |
10682 | +++ b/fs/nfs/file.c |
10683 | @@ -161,7 +161,7 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to) |
10684 | ssize_t result; |
10685 | |
10686 | if (iocb->ki_flags & IOCB_DIRECT) |
10687 | - return nfs_file_direct_read(iocb, to); |
10688 | + return nfs_file_direct_read(iocb, to, false); |
10689 | |
10690 | dprintk("NFS: read(%pD2, %zu@%lu)\n", |
10691 | iocb->ki_filp, |
10692 | @@ -609,7 +609,7 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) |
10693 | return result; |
10694 | |
10695 | if (iocb->ki_flags & IOCB_DIRECT) |
10696 | - return nfs_file_direct_write(iocb, from); |
10697 | + return nfs_file_direct_write(iocb, from, false); |
10698 | |
10699 | dprintk("NFS: write(%pD2, %zu@%Ld)\n", |
10700 | file, iov_iter_count(from), (long long) iocb->ki_pos); |
10701 | diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c |
10702 | index 887f9136a9db3..af557dc2cfe1d 100644 |
10703 | --- a/fs/nfs/nfs2xdr.c |
10704 | +++ b/fs/nfs/nfs2xdr.c |
10705 | @@ -953,7 +953,7 @@ int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
10706 | |
10707 | error = decode_filename_inline(xdr, &entry->name, &entry->len); |
10708 | if (unlikely(error)) |
10709 | - return error; |
10710 | + return -EAGAIN; |
10711 | |
10712 | /* |
10713 | * The type (size and byte order) of nfscookie isn't defined in |
10714 | diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c |
10715 | index 23d75cddbb2ee..84369d51353a5 100644 |
10716 | --- a/fs/nfs/nfs3xdr.c |
10717 | +++ b/fs/nfs/nfs3xdr.c |
10718 | @@ -1968,7 +1968,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
10719 | bool plus) |
10720 | { |
10721 | struct user_namespace *userns = rpc_userns(entry->server->client); |
10722 | - struct nfs_entry old = *entry; |
10723 | __be32 *p; |
10724 | int error; |
10725 | u64 new_cookie; |
10726 | @@ -1988,15 +1987,15 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
10727 | |
10728 | error = decode_fileid3(xdr, &entry->ino); |
10729 | if (unlikely(error)) |
10730 | - return error; |
10731 | + return -EAGAIN; |
10732 | |
10733 | error = decode_inline_filename3(xdr, &entry->name, &entry->len); |
10734 | if (unlikely(error)) |
10735 | - return error; |
10736 | + return -EAGAIN; |
10737 | |
10738 | error = decode_cookie3(xdr, &new_cookie); |
10739 | if (unlikely(error)) |
10740 | - return error; |
10741 | + return -EAGAIN; |
10742 | |
10743 | entry->d_type = DT_UNKNOWN; |
10744 | |
10745 | @@ -2004,7 +2003,7 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
10746 | entry->fattr->valid = 0; |
10747 | error = decode_post_op_attr(xdr, entry->fattr, userns); |
10748 | if (unlikely(error)) |
10749 | - return error; |
10750 | + return -EAGAIN; |
10751 | if (entry->fattr->valid & NFS_ATTR_FATTR_V3) |
10752 | entry->d_type = nfs_umode_to_dtype(entry->fattr->mode); |
10753 | |
10754 | @@ -2019,11 +2018,8 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
10755 | return -EAGAIN; |
10756 | if (*p != xdr_zero) { |
10757 | error = decode_nfs_fh3(xdr, entry->fh); |
10758 | - if (unlikely(error)) { |
10759 | - if (error == -E2BIG) |
10760 | - goto out_truncated; |
10761 | - return error; |
10762 | - } |
10763 | + if (unlikely(error)) |
10764 | + return -EAGAIN; |
10765 | } else |
10766 | zero_nfs_fh3(entry->fh); |
10767 | } |
10768 | @@ -2032,11 +2028,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, |
10769 | entry->cookie = new_cookie; |
10770 | |
10771 | return 0; |
10772 | - |
10773 | -out_truncated: |
10774 | - dprintk("NFS: directory entry contains invalid file handle\n"); |
10775 | - *entry = old; |
10776 | - return -EAGAIN; |
10777 | } |
10778 | |
10779 | /* |
10780 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
10781 | index fb3d1532f11dd..76baf7b441f3c 100644 |
10782 | --- a/fs/nfs/nfs4proc.c |
10783 | +++ b/fs/nfs/nfs4proc.c |
10784 | @@ -7918,6 +7918,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) |
10785 | case -NFS4ERR_DEADSESSION: |
10786 | nfs4_schedule_session_recovery(clp->cl_session, |
10787 | task->tk_status); |
10788 | + return; |
10789 | } |
10790 | if (args->dir == NFS4_CDFC4_FORE_OR_BOTH && |
10791 | res->dir != NFS4_CDFS4_BOTH) { |
10792 | diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c |
10793 | index aa2caba38a014..1d2b81a233bbb 100644 |
10794 | --- a/fs/nfs/nfs4state.c |
10795 | +++ b/fs/nfs/nfs4state.c |
10796 | @@ -49,6 +49,7 @@ |
10797 | #include <linux/workqueue.h> |
10798 | #include <linux/bitops.h> |
10799 | #include <linux/jiffies.h> |
10800 | +#include <linux/sched/mm.h> |
10801 | |
10802 | #include <linux/sunrpc/clnt.h> |
10803 | |
10804 | @@ -2504,9 +2505,17 @@ static int nfs4_bind_conn_to_session(struct nfs_client *clp) |
10805 | |
10806 | static void nfs4_state_manager(struct nfs_client *clp) |
10807 | { |
10808 | + unsigned int memflags; |
10809 | int status = 0; |
10810 | const char *section = "", *section_sep = ""; |
10811 | |
10812 | + /* |
10813 | + * State recovery can deadlock if the direct reclaim code tries |
10814 | + * start NFS writeback. So ensure memory allocations are all |
10815 | + * GFP_NOFS. |
10816 | + */ |
10817 | + memflags = memalloc_nofs_save(); |
10818 | + |
10819 | /* Ensure exclusive access to NFSv4 state */ |
10820 | do { |
10821 | clear_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state); |
10822 | @@ -2600,6 +2609,7 @@ static void nfs4_state_manager(struct nfs_client *clp) |
10823 | clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); |
10824 | } |
10825 | |
10826 | + memalloc_nofs_restore(memflags); |
10827 | nfs4_end_drain_session(clp); |
10828 | nfs4_clear_state_manager_bit(clp); |
10829 | |
10830 | @@ -2616,6 +2626,7 @@ static void nfs4_state_manager(struct nfs_client *clp) |
10831 | return; |
10832 | if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) |
10833 | return; |
10834 | + memflags = memalloc_nofs_save(); |
10835 | } while (refcount_read(&clp->cl_count) > 1 && !signalled()); |
10836 | goto out_drain; |
10837 | |
10838 | @@ -2627,6 +2638,7 @@ out_error: |
10839 | clp->cl_hostname, -status); |
10840 | ssleep(1); |
10841 | out_drain: |
10842 | + memalloc_nofs_restore(memflags); |
10843 | nfs4_end_drain_session(clp); |
10844 | nfs4_clear_state_manager_bit(clp); |
10845 | } |
10846 | diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c |
10847 | index 1b512df1003f9..0471b6e0da16f 100644 |
10848 | --- a/fs/nfs/pnfs.c |
10849 | +++ b/fs/nfs/pnfs.c |
10850 | @@ -92,6 +92,17 @@ find_pnfs_driver(u32 id) |
10851 | return local; |
10852 | } |
10853 | |
10854 | +const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id) |
10855 | +{ |
10856 | + return find_pnfs_driver(id); |
10857 | +} |
10858 | + |
10859 | +void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld) |
10860 | +{ |
10861 | + if (ld) |
10862 | + module_put(ld->owner); |
10863 | +} |
10864 | + |
10865 | void |
10866 | unset_pnfs_layoutdriver(struct nfs_server *nfss) |
10867 | { |
10868 | diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h |
10869 | index 3d55edd6b25ad..68339680bb7d1 100644 |
10870 | --- a/fs/nfs/pnfs.h |
10871 | +++ b/fs/nfs/pnfs.h |
10872 | @@ -226,6 +226,8 @@ struct pnfs_devicelist { |
10873 | |
10874 | extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *); |
10875 | extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *); |
10876 | +extern const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver(u32 id); |
10877 | +extern void pnfs_put_layoutdriver(const struct pnfs_layoutdriver_type *ld); |
10878 | |
10879 | /* nfs4proc.c */ |
10880 | extern size_t max_response_pages(struct nfs_server *server); |
10881 | diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c |
10882 | index 754c763374dd5..4aca93e11af77 100644 |
10883 | --- a/fs/nfsd/nfsproc.c |
10884 | +++ b/fs/nfsd/nfsproc.c |
10885 | @@ -230,7 +230,7 @@ nfsd_proc_write(struct svc_rqst *rqstp) |
10886 | unsigned long cnt = argp->len; |
10887 | unsigned int nvecs; |
10888 | |
10889 | - dprintk("nfsd: WRITE %s %d bytes at %d\n", |
10890 | + dprintk("nfsd: WRITE %s %u bytes at %d\n", |
10891 | SVCFH_fmt(&argp->fh), |
10892 | argp->len, argp->offset); |
10893 | |
10894 | diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h |
10895 | index ea7cca3a64b76..6251d8754c82b 100644 |
10896 | --- a/fs/nfsd/xdr.h |
10897 | +++ b/fs/nfsd/xdr.h |
10898 | @@ -33,7 +33,7 @@ struct nfsd_readargs { |
10899 | struct nfsd_writeargs { |
10900 | svc_fh fh; |
10901 | __u32 offset; |
10902 | - int len; |
10903 | + __u32 len; |
10904 | struct kvec first; |
10905 | }; |
10906 | |
10907 | diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c |
10908 | index ea18e4a2a691d..cf222c9225d6d 100644 |
10909 | --- a/fs/ntfs/inode.c |
10910 | +++ b/fs/ntfs/inode.c |
10911 | @@ -1881,6 +1881,10 @@ int ntfs_read_inode_mount(struct inode *vi) |
10912 | } |
10913 | /* Now allocate memory for the attribute list. */ |
10914 | ni->attr_list_size = (u32)ntfs_attr_size(a); |
10915 | + if (!ni->attr_list_size) { |
10916 | + ntfs_error(sb, "Attr_list_size is zero"); |
10917 | + goto put_err_out; |
10918 | + } |
10919 | ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size); |
10920 | if (!ni->attr_list) { |
10921 | ntfs_error(sb, "Not enough memory to allocate buffer " |
10922 | diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c |
10923 | index eeb93f009b282..83a173feb6989 100644 |
10924 | --- a/fs/ubifs/dir.c |
10925 | +++ b/fs/ubifs/dir.c |
10926 | @@ -361,15 +361,18 @@ static int do_tmpfile(struct inode *dir, struct dentry *dentry, |
10927 | { |
10928 | struct inode *inode; |
10929 | struct ubifs_info *c = dir->i_sb->s_fs_info; |
10930 | - struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1}; |
10931 | + struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, |
10932 | + .dirtied_ino = 1}; |
10933 | struct ubifs_budget_req ino_req = { .dirtied_ino = 1 }; |
10934 | struct ubifs_inode *ui, *dir_ui = ubifs_inode(dir); |
10935 | int err, instantiated = 0; |
10936 | struct fscrypt_name nm; |
10937 | |
10938 | /* |
10939 | - * Budget request settings: new dirty inode, new direntry, |
10940 | - * budget for dirtied inode will be released via writeback. |
10941 | + * Budget request settings: new inode, new direntry, changing the |
10942 | + * parent directory inode. |
10943 | + * Allocate budget separately for new dirtied inode, the budget will |
10944 | + * be released via writeback. |
10945 | */ |
10946 | |
10947 | dbg_gen("dent '%pd', mode %#hx in dir ino %lu", |
10948 | @@ -439,6 +442,8 @@ out_inode: |
10949 | make_bad_inode(inode); |
10950 | if (!instantiated) |
10951 | iput(inode); |
10952 | + else if (whiteout) |
10953 | + iput(*whiteout); |
10954 | out_budg: |
10955 | ubifs_release_budget(c, &req); |
10956 | if (!instantiated) |
10957 | @@ -955,7 +960,8 @@ static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
10958 | struct ubifs_inode *dir_ui = ubifs_inode(dir); |
10959 | struct ubifs_info *c = dir->i_sb->s_fs_info; |
10960 | int err, sz_change; |
10961 | - struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1 }; |
10962 | + struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, |
10963 | + .dirtied_ino = 1}; |
10964 | struct fscrypt_name nm; |
10965 | |
10966 | /* |
10967 | @@ -1330,6 +1336,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, |
10968 | |
10969 | if (flags & RENAME_WHITEOUT) { |
10970 | union ubifs_dev_desc *dev = NULL; |
10971 | + struct ubifs_budget_req wht_req; |
10972 | |
10973 | dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS); |
10974 | if (!dev) { |
10975 | @@ -1351,6 +1358,23 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, |
10976 | whiteout_ui->data = dev; |
10977 | whiteout_ui->data_len = ubifs_encode_dev(dev, MKDEV(0, 0)); |
10978 | ubifs_assert(c, !whiteout_ui->dirty); |
10979 | + |
10980 | + memset(&wht_req, 0, sizeof(struct ubifs_budget_req)); |
10981 | + wht_req.dirtied_ino = 1; |
10982 | + wht_req.dirtied_ino_d = ALIGN(whiteout_ui->data_len, 8); |
10983 | + /* |
10984 | + * To avoid deadlock between space budget (holds ui_mutex and |
10985 | + * waits wb work) and writeback work(waits ui_mutex), do space |
10986 | + * budget before ubifs inodes locked. |
10987 | + */ |
10988 | + err = ubifs_budget_space(c, &wht_req); |
10989 | + if (err) { |
10990 | + iput(whiteout); |
10991 | + goto out_release; |
10992 | + } |
10993 | + |
10994 | + /* Add the old_dentry size to the old_dir size. */ |
10995 | + old_sz -= CALC_DENT_SIZE(fname_len(&old_nm)); |
10996 | } |
10997 | |
10998 | lock_4_inodes(old_dir, new_dir, new_inode, whiteout); |
10999 | @@ -1425,18 +1449,6 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, |
11000 | } |
11001 | |
11002 | if (whiteout) { |
11003 | - struct ubifs_budget_req wht_req = { .dirtied_ino = 1, |
11004 | - .dirtied_ino_d = \ |
11005 | - ALIGN(ubifs_inode(whiteout)->data_len, 8) }; |
11006 | - |
11007 | - err = ubifs_budget_space(c, &wht_req); |
11008 | - if (err) { |
11009 | - kfree(whiteout_ui->data); |
11010 | - whiteout_ui->data_len = 0; |
11011 | - iput(whiteout); |
11012 | - goto out_release; |
11013 | - } |
11014 | - |
11015 | inc_nlink(whiteout); |
11016 | mark_inode_dirty(whiteout); |
11017 | |
11018 | diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c |
11019 | index eae9cf5a57b05..89b671ad0f9aa 100644 |
11020 | --- a/fs/ubifs/io.c |
11021 | +++ b/fs/ubifs/io.c |
11022 | @@ -846,16 +846,42 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) |
11023 | */ |
11024 | n = aligned_len >> c->max_write_shift; |
11025 | if (n) { |
11026 | - n <<= c->max_write_shift; |
11027 | + int m = n - 1; |
11028 | + |
11029 | dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, |
11030 | wbuf->offs); |
11031 | - err = ubifs_leb_write(c, wbuf->lnum, buf + written, |
11032 | - wbuf->offs, n); |
11033 | + |
11034 | + if (m) { |
11035 | + /* '(n-1)<<c->max_write_shift < len' is always true. */ |
11036 | + m <<= c->max_write_shift; |
11037 | + err = ubifs_leb_write(c, wbuf->lnum, buf + written, |
11038 | + wbuf->offs, m); |
11039 | + if (err) |
11040 | + goto out; |
11041 | + wbuf->offs += m; |
11042 | + aligned_len -= m; |
11043 | + len -= m; |
11044 | + written += m; |
11045 | + } |
11046 | + |
11047 | + /* |
11048 | + * The non-written len of buf may be less than 'n' because |
11049 | + * parameter 'len' is not 8 bytes aligned, so here we read |
11050 | + * min(len, n) bytes from buf. |
11051 | + */ |
11052 | + n = 1 << c->max_write_shift; |
11053 | + memcpy(wbuf->buf, buf + written, min(len, n)); |
11054 | + if (n > len) { |
11055 | + ubifs_assert(c, n - len < 8); |
11056 | + ubifs_pad(c, wbuf->buf + len, n - len); |
11057 | + } |
11058 | + |
11059 | + err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, n); |
11060 | if (err) |
11061 | goto out; |
11062 | wbuf->offs += n; |
11063 | aligned_len -= n; |
11064 | - len -= n; |
11065 | + len -= min(len, n); |
11066 | written += n; |
11067 | } |
11068 | |
11069 | diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c |
11070 | index eeb1be2598881..2923d5a6a7c0b 100644 |
11071 | --- a/fs/ubifs/ioctl.c |
11072 | +++ b/fs/ubifs/ioctl.c |
11073 | @@ -101,7 +101,7 @@ static int setflags(struct inode *inode, int flags) |
11074 | struct ubifs_inode *ui = ubifs_inode(inode); |
11075 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
11076 | struct ubifs_budget_req req = { .dirtied_ino = 1, |
11077 | - .dirtied_ino_d = ui->data_len }; |
11078 | + .dirtied_ino_d = ALIGN(ui->data_len, 8) }; |
11079 | |
11080 | err = ubifs_budget_space(c, &req); |
11081 | if (err) |
11082 | diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h |
11083 | index bed9e43f94260..46139c0f510fa 100644 |
11084 | --- a/include/linux/blk-cgroup.h |
11085 | +++ b/include/linux/blk-cgroup.h |
11086 | @@ -22,6 +22,7 @@ |
11087 | #include <linux/atomic.h> |
11088 | #include <linux/kthread.h> |
11089 | #include <linux/fs.h> |
11090 | +#include <linux/blkdev.h> |
11091 | |
11092 | /* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */ |
11093 | #define BLKG_STAT_CPU_BATCH (INT_MAX / 2) |
11094 | @@ -768,6 +769,21 @@ static inline void blkcg_use_delay(struct blkcg_gq *blkg) |
11095 | atomic_inc(&blkg->blkcg->css.cgroup->congestion_count); |
11096 | } |
11097 | |
11098 | +/** |
11099 | + * blk_cgroup_mergeable - Determine whether to allow or disallow merges |
11100 | + * @rq: request to merge into |
11101 | + * @bio: bio to merge |
11102 | + * |
11103 | + * @bio and @rq should belong to the same cgroup and their issue_as_root should |
11104 | + * match. The latter is necessary as we don't want to throttle e.g. a metadata |
11105 | + * update because it happens to be next to a regular IO. |
11106 | + */ |
11107 | +static inline bool blk_cgroup_mergeable(struct request *rq, struct bio *bio) |
11108 | +{ |
11109 | + return rq->bio->bi_blkg == bio->bi_blkg && |
11110 | + bio_issue_as_root_blkg(rq->bio) == bio_issue_as_root_blkg(bio); |
11111 | +} |
11112 | + |
11113 | static inline int blkcg_unuse_delay(struct blkcg_gq *blkg) |
11114 | { |
11115 | int old = atomic_read(&blkg->use_delay); |
11116 | @@ -868,6 +884,7 @@ static inline bool blkcg_punt_bio_submit(struct bio *bio) { return false; } |
11117 | static inline void blkcg_bio_issue_init(struct bio *bio) { } |
11118 | static inline bool blkcg_bio_issue_check(struct request_queue *q, |
11119 | struct bio *bio) { return true; } |
11120 | +static inline bool blk_cgroup_mergeable(struct request *rq, struct bio *bio) { return true; } |
11121 | |
11122 | #define blk_queue_for_each_rl(rl, q) \ |
11123 | for ((rl) = &(q)->root_rl; (rl); (rl) = NULL) |
11124 | diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h |
11125 | index d5338b9ee5502..8cc766743270f 100644 |
11126 | --- a/include/linux/blkdev.h |
11127 | +++ b/include/linux/blkdev.h |
11128 | @@ -59,6 +59,14 @@ struct blk_stat_callback; |
11129 | */ |
11130 | #define BLKCG_MAX_POLS 5 |
11131 | |
11132 | +static inline int blk_validate_block_size(unsigned int bsize) |
11133 | +{ |
11134 | + if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize)) |
11135 | + return -EINVAL; |
11136 | + |
11137 | + return 0; |
11138 | +} |
11139 | + |
11140 | typedef void (rq_end_io_fn)(struct request *, blk_status_t); |
11141 | |
11142 | /* |
11143 | diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h |
11144 | index 4d450672b7d66..da90f20e11c1c 100644 |
11145 | --- a/include/linux/dma-mapping.h |
11146 | +++ b/include/linux/dma-mapping.h |
11147 | @@ -70,6 +70,14 @@ |
11148 | */ |
11149 | #define DMA_ATTR_PRIVILEGED (1UL << 9) |
11150 | |
11151 | +/* |
11152 | + * This is a hint to the DMA-mapping subsystem that the device is expected |
11153 | + * to overwrite the entire mapped size, thus the caller does not require any |
11154 | + * of the previous buffer contents to be preserved. This allows |
11155 | + * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers. |
11156 | + */ |
11157 | +#define DMA_ATTR_OVERWRITE (1UL << 10) |
11158 | + |
11159 | /* |
11160 | * A dma_addr_t can hold any valid DMA or bus address for the platform. |
11161 | * It can be given to a device to use as a DMA source or target. A CPU cannot |
11162 | diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h |
11163 | index bbe297bbbca52..d5c507311efb1 100644 |
11164 | --- a/include/linux/ipv6.h |
11165 | +++ b/include/linux/ipv6.h |
11166 | @@ -50,7 +50,7 @@ struct ipv6_devconf { |
11167 | __s32 use_optimistic; |
11168 | #endif |
11169 | #ifdef CONFIG_IPV6_MROUTE |
11170 | - __s32 mc_forwarding; |
11171 | + atomic_t mc_forwarding; |
11172 | #endif |
11173 | __s32 disable_ipv6; |
11174 | __s32 drop_unicast_in_l2_multicast; |
11175 | diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h |
11176 | index bc8a70a7c5a13..e4f9df955040f 100644 |
11177 | --- a/include/linux/mmzone.h |
11178 | +++ b/include/linux/mmzone.h |
11179 | @@ -1250,13 +1250,16 @@ static inline unsigned long *section_to_usemap(struct mem_section *ms) |
11180 | |
11181 | static inline struct mem_section *__nr_to_section(unsigned long nr) |
11182 | { |
11183 | + unsigned long root = SECTION_NR_TO_ROOT(nr); |
11184 | + |
11185 | + if (unlikely(root >= NR_SECTION_ROOTS)) |
11186 | + return NULL; |
11187 | + |
11188 | #ifdef CONFIG_SPARSEMEM_EXTREME |
11189 | - if (!mem_section) |
11190 | + if (!mem_section || !mem_section[root]) |
11191 | return NULL; |
11192 | #endif |
11193 | - if (!mem_section[SECTION_NR_TO_ROOT(nr)]) |
11194 | - return NULL; |
11195 | - return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; |
11196 | + return &mem_section[root][nr & SECTION_ROOT_MASK]; |
11197 | } |
11198 | extern unsigned long __section_nr(struct mem_section *ms); |
11199 | extern size_t mem_section_usage_size(void); |
11200 | diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
11201 | index 288a586782563..c70b79dba1dc1 100644 |
11202 | --- a/include/linux/netdevice.h |
11203 | +++ b/include/linux/netdevice.h |
11204 | @@ -3777,7 +3777,8 @@ void netdev_run_todo(void); |
11205 | */ |
11206 | static inline void dev_put(struct net_device *dev) |
11207 | { |
11208 | - this_cpu_dec(*dev->pcpu_refcnt); |
11209 | + if (dev) |
11210 | + this_cpu_dec(*dev->pcpu_refcnt); |
11211 | } |
11212 | |
11213 | /** |
11214 | @@ -3788,7 +3789,8 @@ static inline void dev_put(struct net_device *dev) |
11215 | */ |
11216 | static inline void dev_hold(struct net_device *dev) |
11217 | { |
11218 | - this_cpu_inc(*dev->pcpu_refcnt); |
11219 | + if (dev) |
11220 | + this_cpu_inc(*dev->pcpu_refcnt); |
11221 | } |
11222 | |
11223 | /* Carrier loss detection, dial on demand. The functions netif_carrier_on |
11224 | diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h |
11225 | index 978ef674f0388..49cf5c855cbe5 100644 |
11226 | --- a/include/linux/nfs_fs.h |
11227 | +++ b/include/linux/nfs_fs.h |
11228 | @@ -480,10 +480,10 @@ static inline const struct cred *nfs_file_cred(struct file *file) |
11229 | * linux/fs/nfs/direct.c |
11230 | */ |
11231 | extern ssize_t nfs_direct_IO(struct kiocb *, struct iov_iter *); |
11232 | -extern ssize_t nfs_file_direct_read(struct kiocb *iocb, |
11233 | - struct iov_iter *iter); |
11234 | -extern ssize_t nfs_file_direct_write(struct kiocb *iocb, |
11235 | - struct iov_iter *iter); |
11236 | +ssize_t nfs_file_direct_read(struct kiocb *iocb, |
11237 | + struct iov_iter *iter, bool swap); |
11238 | +ssize_t nfs_file_direct_write(struct kiocb *iocb, |
11239 | + struct iov_iter *iter, bool swap); |
11240 | |
11241 | /* |
11242 | * linux/fs/nfs/dir.c |
11243 | diff --git a/include/linux/pci.h b/include/linux/pci.h |
11244 | index bc35b15efadd0..fc343d123127b 100644 |
11245 | --- a/include/linux/pci.h |
11246 | +++ b/include/linux/pci.h |
11247 | @@ -604,6 +604,7 @@ struct pci_bus { |
11248 | struct bin_attribute *legacy_io; /* Legacy I/O for this bus */ |
11249 | struct bin_attribute *legacy_mem; /* Legacy mem */ |
11250 | unsigned int is_added:1; |
11251 | + unsigned int unsafe_warn:1; /* warned about RW1C config write */ |
11252 | }; |
11253 | |
11254 | #define to_pci_bus(n) container_of(n, struct pci_bus, dev) |
11255 | diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h |
11256 | index a8d68c5a4ca61..fb0a6d6c91e48 100644 |
11257 | --- a/include/linux/sunrpc/xdr.h |
11258 | +++ b/include/linux/sunrpc/xdr.h |
11259 | @@ -536,6 +536,8 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr, |
11260 | |
11261 | if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0)) |
11262 | return -EBADMSG; |
11263 | + if (len > SIZE_MAX / sizeof(*p)) |
11264 | + return -EBADMSG; |
11265 | p = xdr_inline_decode(xdr, len * sizeof(*p)); |
11266 | if (unlikely(!p)) |
11267 | return -EBADMSG; |
11268 | diff --git a/include/net/arp.h b/include/net/arp.h |
11269 | index 4950191f6b2bf..4a23a97195f33 100644 |
11270 | --- a/include/net/arp.h |
11271 | +++ b/include/net/arp.h |
11272 | @@ -71,6 +71,7 @@ void arp_send(int type, int ptype, __be32 dest_ip, |
11273 | const unsigned char *src_hw, const unsigned char *th); |
11274 | int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir); |
11275 | void arp_ifdown(struct net_device *dev); |
11276 | +int arp_invalidate(struct net_device *dev, __be32 ip, bool force); |
11277 | |
11278 | struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, |
11279 | struct net_device *dev, __be32 src_ip, |
11280 | diff --git a/include/net/udp.h b/include/net/udp.h |
11281 | index d9d39cc20a847..9787a42f7ed3e 100644 |
11282 | --- a/include/net/udp.h |
11283 | +++ b/include/net/udp.h |
11284 | @@ -459,6 +459,7 @@ void udp_init(void); |
11285 | |
11286 | DECLARE_STATIC_KEY_FALSE(udp_encap_needed_key); |
11287 | void udp_encap_enable(void); |
11288 | +void udp_encap_disable(void); |
11289 | #if IS_ENABLED(CONFIG_IPV6) |
11290 | DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); |
11291 | void udpv6_encap_enable(void); |
11292 | diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h |
11293 | index 4b1f95e083070..27bf9f4dd1d45 100644 |
11294 | --- a/include/net/udp_tunnel.h |
11295 | +++ b/include/net/udp_tunnel.h |
11296 | @@ -178,9 +178,8 @@ static inline void udp_tunnel_encap_enable(struct socket *sock) |
11297 | #if IS_ENABLED(CONFIG_IPV6) |
11298 | if (sock->sk->sk_family == PF_INET6) |
11299 | ipv6_stub->udpv6_encap_enable(); |
11300 | - else |
11301 | #endif |
11302 | - udp_encap_enable(); |
11303 | + udp_encap_enable(); |
11304 | } |
11305 | |
11306 | #endif |
11307 | diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h |
11308 | index 63038eb23560b..cb0631098f918 100644 |
11309 | --- a/include/uapi/linux/bpf.h |
11310 | +++ b/include/uapi/linux/bpf.h |
11311 | @@ -1294,8 +1294,8 @@ union bpf_attr { |
11312 | * Return |
11313 | * The return value depends on the result of the test, and can be: |
11314 | * |
11315 | - * * 0, if current task belongs to the cgroup2. |
11316 | - * * 1, if current task does not belong to the cgroup2. |
11317 | + * * 1, if current task belongs to the cgroup2. |
11318 | + * * 0, if current task does not belong to the cgroup2. |
11319 | * * A negative error code, if an error occurred. |
11320 | * |
11321 | * int bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) |
11322 | @@ -3068,7 +3068,8 @@ struct bpf_sock { |
11323 | __u32 src_ip4; |
11324 | __u32 src_ip6[4]; |
11325 | __u32 src_port; /* host byte order */ |
11326 | - __u32 dst_port; /* network byte order */ |
11327 | + __be16 dst_port; /* network byte order */ |
11328 | + __u16 :16; /* zero padding */ |
11329 | __u32 dst_ip4; |
11330 | __u32 dst_ip6[4]; |
11331 | __u32 state; |
11332 | diff --git a/init/main.c b/init/main.c |
11333 | index e6a1fb14f3085..d292daabd9a22 100644 |
11334 | --- a/init/main.c |
11335 | +++ b/init/main.c |
11336 | @@ -831,7 +831,7 @@ static int __init initcall_blacklist(char *str) |
11337 | } |
11338 | } while (str_entry); |
11339 | |
11340 | - return 0; |
11341 | + return 1; |
11342 | } |
11343 | |
11344 | static bool __init_or_module initcall_blacklisted(initcall_t fn) |
11345 | @@ -1072,7 +1072,9 @@ static noinline void __init kernel_init_freeable(void); |
11346 | bool rodata_enabled __ro_after_init = true; |
11347 | static int __init set_debug_rodata(char *str) |
11348 | { |
11349 | - return strtobool(str, &rodata_enabled); |
11350 | + if (strtobool(str, &rodata_enabled)) |
11351 | + pr_warn("Invalid option string for rodata: '%s'\n", str); |
11352 | + return 1; |
11353 | } |
11354 | __setup("rodata=", set_debug_rodata); |
11355 | #endif |
11356 | diff --git a/kernel/audit.h b/kernel/audit.h |
11357 | index ddc22878433d0..fed8e93ce1699 100644 |
11358 | --- a/kernel/audit.h |
11359 | +++ b/kernel/audit.h |
11360 | @@ -191,6 +191,10 @@ struct audit_context { |
11361 | struct { |
11362 | char *name; |
11363 | } module; |
11364 | + struct { |
11365 | + struct audit_ntp_data ntp_data; |
11366 | + struct timespec64 tk_injoffset; |
11367 | + } time; |
11368 | }; |
11369 | int fds[2]; |
11370 | struct audit_proctitle proctitle; |
11371 | diff --git a/kernel/auditsc.c b/kernel/auditsc.c |
11372 | index d33c5dccde1c7..e8e90c0c49367 100644 |
11373 | --- a/kernel/auditsc.c |
11374 | +++ b/kernel/auditsc.c |
11375 | @@ -1185,6 +1185,53 @@ static void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name) |
11376 | from_kuid(&init_user_ns, name->fcap.rootid)); |
11377 | } |
11378 | |
11379 | +static void audit_log_time(struct audit_context *context, struct audit_buffer **ab) |
11380 | +{ |
11381 | + const struct audit_ntp_data *ntp = &context->time.ntp_data; |
11382 | + const struct timespec64 *tk = &context->time.tk_injoffset; |
11383 | + static const char * const ntp_name[] = { |
11384 | + "offset", |
11385 | + "freq", |
11386 | + "status", |
11387 | + "tai", |
11388 | + "tick", |
11389 | + "adjust", |
11390 | + }; |
11391 | + int type; |
11392 | + |
11393 | + if (context->type == AUDIT_TIME_ADJNTPVAL) { |
11394 | + for (type = 0; type < AUDIT_NTP_NVALS; type++) { |
11395 | + if (ntp->vals[type].newval != ntp->vals[type].oldval) { |
11396 | + if (!*ab) { |
11397 | + *ab = audit_log_start(context, |
11398 | + GFP_KERNEL, |
11399 | + AUDIT_TIME_ADJNTPVAL); |
11400 | + if (!*ab) |
11401 | + return; |
11402 | + } |
11403 | + audit_log_format(*ab, "op=%s old=%lli new=%lli", |
11404 | + ntp_name[type], |
11405 | + ntp->vals[type].oldval, |
11406 | + ntp->vals[type].newval); |
11407 | + audit_log_end(*ab); |
11408 | + *ab = NULL; |
11409 | + } |
11410 | + } |
11411 | + } |
11412 | + if (tk->tv_sec != 0 || tk->tv_nsec != 0) { |
11413 | + if (!*ab) { |
11414 | + *ab = audit_log_start(context, GFP_KERNEL, |
11415 | + AUDIT_TIME_INJOFFSET); |
11416 | + if (!*ab) |
11417 | + return; |
11418 | + } |
11419 | + audit_log_format(*ab, "sec=%lli nsec=%li", |
11420 | + (long long)tk->tv_sec, tk->tv_nsec); |
11421 | + audit_log_end(*ab); |
11422 | + *ab = NULL; |
11423 | + } |
11424 | +} |
11425 | + |
11426 | static void show_special(struct audit_context *context, int *call_panic) |
11427 | { |
11428 | struct audit_buffer *ab; |
11429 | @@ -1290,6 +1337,11 @@ static void show_special(struct audit_context *context, int *call_panic) |
11430 | audit_log_format(ab, "(null)"); |
11431 | |
11432 | break; |
11433 | + case AUDIT_TIME_ADJNTPVAL: |
11434 | + case AUDIT_TIME_INJOFFSET: |
11435 | + /* this call deviates from the rest, eating the buffer */ |
11436 | + audit_log_time(context, &ab); |
11437 | + break; |
11438 | } |
11439 | audit_log_end(ab); |
11440 | } |
11441 | @@ -2518,31 +2570,26 @@ void __audit_fanotify(unsigned int response) |
11442 | |
11443 | void __audit_tk_injoffset(struct timespec64 offset) |
11444 | { |
11445 | - audit_log(audit_context(), GFP_KERNEL, AUDIT_TIME_INJOFFSET, |
11446 | - "sec=%lli nsec=%li", |
11447 | - (long long)offset.tv_sec, offset.tv_nsec); |
11448 | -} |
11449 | - |
11450 | -static void audit_log_ntp_val(const struct audit_ntp_data *ad, |
11451 | - const char *op, enum audit_ntp_type type) |
11452 | -{ |
11453 | - const struct audit_ntp_val *val = &ad->vals[type]; |
11454 | - |
11455 | - if (val->newval == val->oldval) |
11456 | - return; |
11457 | + struct audit_context *context = audit_context(); |
11458 | |
11459 | - audit_log(audit_context(), GFP_KERNEL, AUDIT_TIME_ADJNTPVAL, |
11460 | - "op=%s old=%lli new=%lli", op, val->oldval, val->newval); |
11461 | + /* only set type if not already set by NTP */ |
11462 | + if (!context->type) |
11463 | + context->type = AUDIT_TIME_INJOFFSET; |
11464 | + memcpy(&context->time.tk_injoffset, &offset, sizeof(offset)); |
11465 | } |
11466 | |
11467 | void __audit_ntp_log(const struct audit_ntp_data *ad) |
11468 | { |
11469 | - audit_log_ntp_val(ad, "offset", AUDIT_NTP_OFFSET); |
11470 | - audit_log_ntp_val(ad, "freq", AUDIT_NTP_FREQ); |
11471 | - audit_log_ntp_val(ad, "status", AUDIT_NTP_STATUS); |
11472 | - audit_log_ntp_val(ad, "tai", AUDIT_NTP_TAI); |
11473 | - audit_log_ntp_val(ad, "tick", AUDIT_NTP_TICK); |
11474 | - audit_log_ntp_val(ad, "adjust", AUDIT_NTP_ADJUST); |
11475 | + struct audit_context *context = audit_context(); |
11476 | + int type; |
11477 | + |
11478 | + for (type = 0; type < AUDIT_NTP_NVALS; type++) |
11479 | + if (ad->vals[type].newval != ad->vals[type].oldval) { |
11480 | + /* unconditionally set type, overwriting TK */ |
11481 | + context->type = AUDIT_TIME_ADJNTPVAL; |
11482 | + memcpy(&context->time.ntp_data, ad, sizeof(*ad)); |
11483 | + break; |
11484 | + } |
11485 | } |
11486 | |
11487 | static void audit_log_task(struct audit_buffer *ab) |
11488 | diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h |
11489 | index 809e34a3c0172..236f290224aae 100644 |
11490 | --- a/kernel/cgroup/cgroup-internal.h |
11491 | +++ b/kernel/cgroup/cgroup-internal.h |
11492 | @@ -65,6 +65,25 @@ static inline struct cgroup_fs_context *cgroup_fc2context(struct fs_context *fc) |
11493 | return container_of(kfc, struct cgroup_fs_context, kfc); |
11494 | } |
11495 | |
11496 | +struct cgroup_pidlist; |
11497 | + |
11498 | +struct cgroup_file_ctx { |
11499 | + struct cgroup_namespace *ns; |
11500 | + |
11501 | + struct { |
11502 | + void *trigger; |
11503 | + } psi; |
11504 | + |
11505 | + struct { |
11506 | + bool started; |
11507 | + struct css_task_iter iter; |
11508 | + } procs; |
11509 | + |
11510 | + struct { |
11511 | + struct cgroup_pidlist *pidlist; |
11512 | + } procs1; |
11513 | +}; |
11514 | + |
11515 | /* |
11516 | * A cgroup can be associated with multiple css_sets as different tasks may |
11517 | * belong to different cgroups on different hierarchies. In the other |
11518 | diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c |
11519 | index 5e465c4b1e64c..117d70098cd49 100644 |
11520 | --- a/kernel/cgroup/cgroup-v1.c |
11521 | +++ b/kernel/cgroup/cgroup-v1.c |
11522 | @@ -398,6 +398,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos) |
11523 | * next pid to display, if any |
11524 | */ |
11525 | struct kernfs_open_file *of = s->private; |
11526 | + struct cgroup_file_ctx *ctx = of->priv; |
11527 | struct cgroup *cgrp = seq_css(s)->cgroup; |
11528 | struct cgroup_pidlist *l; |
11529 | enum cgroup_filetype type = seq_cft(s)->private; |
11530 | @@ -407,25 +408,24 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos) |
11531 | mutex_lock(&cgrp->pidlist_mutex); |
11532 | |
11533 | /* |
11534 | - * !NULL @of->priv indicates that this isn't the first start() |
11535 | - * after open. If the matching pidlist is around, we can use that. |
11536 | - * Look for it. Note that @of->priv can't be used directly. It |
11537 | - * could already have been destroyed. |
11538 | + * !NULL @ctx->procs1.pidlist indicates that this isn't the first |
11539 | + * start() after open. If the matching pidlist is around, we can use |
11540 | + * that. Look for it. Note that @ctx->procs1.pidlist can't be used |
11541 | + * directly. It could already have been destroyed. |
11542 | */ |
11543 | - if (of->priv) |
11544 | - of->priv = cgroup_pidlist_find(cgrp, type); |
11545 | + if (ctx->procs1.pidlist) |
11546 | + ctx->procs1.pidlist = cgroup_pidlist_find(cgrp, type); |
11547 | |
11548 | /* |
11549 | * Either this is the first start() after open or the matching |
11550 | * pidlist has been destroyed inbetween. Create a new one. |
11551 | */ |
11552 | - if (!of->priv) { |
11553 | - ret = pidlist_array_load(cgrp, type, |
11554 | - (struct cgroup_pidlist **)&of->priv); |
11555 | + if (!ctx->procs1.pidlist) { |
11556 | + ret = pidlist_array_load(cgrp, type, &ctx->procs1.pidlist); |
11557 | if (ret) |
11558 | return ERR_PTR(ret); |
11559 | } |
11560 | - l = of->priv; |
11561 | + l = ctx->procs1.pidlist; |
11562 | |
11563 | if (pid) { |
11564 | int end = l->length; |
11565 | @@ -453,7 +453,8 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos) |
11566 | static void cgroup_pidlist_stop(struct seq_file *s, void *v) |
11567 | { |
11568 | struct kernfs_open_file *of = s->private; |
11569 | - struct cgroup_pidlist *l = of->priv; |
11570 | + struct cgroup_file_ctx *ctx = of->priv; |
11571 | + struct cgroup_pidlist *l = ctx->procs1.pidlist; |
11572 | |
11573 | if (l) |
11574 | mod_delayed_work(cgroup_pidlist_destroy_wq, &l->destroy_dwork, |
11575 | @@ -464,7 +465,8 @@ static void cgroup_pidlist_stop(struct seq_file *s, void *v) |
11576 | static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos) |
11577 | { |
11578 | struct kernfs_open_file *of = s->private; |
11579 | - struct cgroup_pidlist *l = of->priv; |
11580 | + struct cgroup_file_ctx *ctx = of->priv; |
11581 | + struct cgroup_pidlist *l = ctx->procs1.pidlist; |
11582 | pid_t *p = v; |
11583 | pid_t *end = l->list + l->length; |
11584 | /* |
11585 | @@ -507,10 +509,11 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, |
11586 | goto out_unlock; |
11587 | |
11588 | /* |
11589 | - * Even if we're attaching all tasks in the thread group, we only |
11590 | - * need to check permissions on one of them. |
11591 | + * Even if we're attaching all tasks in the thread group, we only need |
11592 | + * to check permissions on one of them. Check permissions using the |
11593 | + * credentials from file open to protect against inherited fd attacks. |
11594 | */ |
11595 | - cred = current_cred(); |
11596 | + cred = of->file->f_cred; |
11597 | tcred = get_task_cred(task); |
11598 | if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && |
11599 | !uid_eq(cred->euid, tcred->uid) && |
11600 | diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
11601 | index ce1745ac7b8c0..177d57ce90164 100644 |
11602 | --- a/kernel/cgroup/cgroup.c |
11603 | +++ b/kernel/cgroup/cgroup.c |
11604 | @@ -3648,6 +3648,7 @@ static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v) |
11605 | static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf, |
11606 | size_t nbytes, enum psi_res res) |
11607 | { |
11608 | + struct cgroup_file_ctx *ctx = of->priv; |
11609 | struct psi_trigger *new; |
11610 | struct cgroup *cgrp; |
11611 | struct psi_group *psi; |
11612 | @@ -3660,7 +3661,7 @@ static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf, |
11613 | cgroup_kn_unlock(of->kn); |
11614 | |
11615 | /* Allow only one trigger per file descriptor */ |
11616 | - if (of->priv) { |
11617 | + if (ctx->psi.trigger) { |
11618 | cgroup_put(cgrp); |
11619 | return -EBUSY; |
11620 | } |
11621 | @@ -3672,7 +3673,7 @@ static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf, |
11622 | return PTR_ERR(new); |
11623 | } |
11624 | |
11625 | - smp_store_release(&of->priv, new); |
11626 | + smp_store_release(&ctx->psi.trigger, new); |
11627 | cgroup_put(cgrp); |
11628 | |
11629 | return nbytes; |
11630 | @@ -3702,12 +3703,15 @@ static ssize_t cgroup_cpu_pressure_write(struct kernfs_open_file *of, |
11631 | static __poll_t cgroup_pressure_poll(struct kernfs_open_file *of, |
11632 | poll_table *pt) |
11633 | { |
11634 | - return psi_trigger_poll(&of->priv, of->file, pt); |
11635 | + struct cgroup_file_ctx *ctx = of->priv; |
11636 | + return psi_trigger_poll(&ctx->psi.trigger, of->file, pt); |
11637 | } |
11638 | |
11639 | static void cgroup_pressure_release(struct kernfs_open_file *of) |
11640 | { |
11641 | - psi_trigger_destroy(of->priv); |
11642 | + struct cgroup_file_ctx *ctx = of->priv; |
11643 | + |
11644 | + psi_trigger_destroy(ctx->psi.trigger); |
11645 | } |
11646 | #endif /* CONFIG_PSI */ |
11647 | |
11648 | @@ -3748,24 +3752,43 @@ static ssize_t cgroup_freeze_write(struct kernfs_open_file *of, |
11649 | static int cgroup_file_open(struct kernfs_open_file *of) |
11650 | { |
11651 | struct cftype *cft = of->kn->priv; |
11652 | + struct cgroup_file_ctx *ctx; |
11653 | + int ret; |
11654 | |
11655 | - if (cft->open) |
11656 | - return cft->open(of); |
11657 | - return 0; |
11658 | + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
11659 | + if (!ctx) |
11660 | + return -ENOMEM; |
11661 | + |
11662 | + ctx->ns = current->nsproxy->cgroup_ns; |
11663 | + get_cgroup_ns(ctx->ns); |
11664 | + of->priv = ctx; |
11665 | + |
11666 | + if (!cft->open) |
11667 | + return 0; |
11668 | + |
11669 | + ret = cft->open(of); |
11670 | + if (ret) { |
11671 | + put_cgroup_ns(ctx->ns); |
11672 | + kfree(ctx); |
11673 | + } |
11674 | + return ret; |
11675 | } |
11676 | |
11677 | static void cgroup_file_release(struct kernfs_open_file *of) |
11678 | { |
11679 | struct cftype *cft = of->kn->priv; |
11680 | + struct cgroup_file_ctx *ctx = of->priv; |
11681 | |
11682 | if (cft->release) |
11683 | cft->release(of); |
11684 | + put_cgroup_ns(ctx->ns); |
11685 | + kfree(ctx); |
11686 | } |
11687 | |
11688 | static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf, |
11689 | size_t nbytes, loff_t off) |
11690 | { |
11691 | - struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; |
11692 | + struct cgroup_file_ctx *ctx = of->priv; |
11693 | struct cgroup *cgrp = of->kn->parent->priv; |
11694 | struct cftype *cft = of->kn->priv; |
11695 | struct cgroup_subsys_state *css; |
11696 | @@ -3779,7 +3802,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf, |
11697 | */ |
11698 | if ((cgrp->root->flags & CGRP_ROOT_NS_DELEGATE) && |
11699 | !(cft->flags & CFTYPE_NS_DELEGATABLE) && |
11700 | - ns != &init_cgroup_ns && ns->root_cset->dfl_cgrp == cgrp) |
11701 | + ctx->ns != &init_cgroup_ns && ctx->ns->root_cset->dfl_cgrp == cgrp) |
11702 | return -EPERM; |
11703 | |
11704 | if (cft->write) |
11705 | @@ -4687,21 +4710,21 @@ void css_task_iter_end(struct css_task_iter *it) |
11706 | |
11707 | static void cgroup_procs_release(struct kernfs_open_file *of) |
11708 | { |
11709 | - if (of->priv) { |
11710 | - css_task_iter_end(of->priv); |
11711 | - kfree(of->priv); |
11712 | - } |
11713 | + struct cgroup_file_ctx *ctx = of->priv; |
11714 | + |
11715 | + if (ctx->procs.started) |
11716 | + css_task_iter_end(&ctx->procs.iter); |
11717 | } |
11718 | |
11719 | static void *cgroup_procs_next(struct seq_file *s, void *v, loff_t *pos) |
11720 | { |
11721 | struct kernfs_open_file *of = s->private; |
11722 | - struct css_task_iter *it = of->priv; |
11723 | + struct cgroup_file_ctx *ctx = of->priv; |
11724 | |
11725 | if (pos) |
11726 | (*pos)++; |
11727 | |
11728 | - return css_task_iter_next(it); |
11729 | + return css_task_iter_next(&ctx->procs.iter); |
11730 | } |
11731 | |
11732 | static void *__cgroup_procs_start(struct seq_file *s, loff_t *pos, |
11733 | @@ -4709,21 +4732,18 @@ static void *__cgroup_procs_start(struct seq_file *s, loff_t *pos, |
11734 | { |
11735 | struct kernfs_open_file *of = s->private; |
11736 | struct cgroup *cgrp = seq_css(s)->cgroup; |
11737 | - struct css_task_iter *it = of->priv; |
11738 | + struct cgroup_file_ctx *ctx = of->priv; |
11739 | + struct css_task_iter *it = &ctx->procs.iter; |
11740 | |
11741 | /* |
11742 | * When a seq_file is seeked, it's always traversed sequentially |
11743 | * from position 0, so we can simply keep iterating on !0 *pos. |
11744 | */ |
11745 | - if (!it) { |
11746 | + if (!ctx->procs.started) { |
11747 | if (WARN_ON_ONCE((*pos))) |
11748 | return ERR_PTR(-EINVAL); |
11749 | - |
11750 | - it = kzalloc(sizeof(*it), GFP_KERNEL); |
11751 | - if (!it) |
11752 | - return ERR_PTR(-ENOMEM); |
11753 | - of->priv = it; |
11754 | css_task_iter_start(&cgrp->self, iter_flags, it); |
11755 | + ctx->procs.started = true; |
11756 | } else if (!(*pos)) { |
11757 | css_task_iter_end(it); |
11758 | css_task_iter_start(&cgrp->self, iter_flags, it); |
11759 | @@ -4758,9 +4778,9 @@ static int cgroup_procs_show(struct seq_file *s, void *v) |
11760 | |
11761 | static int cgroup_procs_write_permission(struct cgroup *src_cgrp, |
11762 | struct cgroup *dst_cgrp, |
11763 | - struct super_block *sb) |
11764 | + struct super_block *sb, |
11765 | + struct cgroup_namespace *ns) |
11766 | { |
11767 | - struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; |
11768 | struct cgroup *com_cgrp = src_cgrp; |
11769 | struct inode *inode; |
11770 | int ret; |
11771 | @@ -4796,8 +4816,10 @@ static int cgroup_procs_write_permission(struct cgroup *src_cgrp, |
11772 | static ssize_t cgroup_procs_write(struct kernfs_open_file *of, |
11773 | char *buf, size_t nbytes, loff_t off) |
11774 | { |
11775 | + struct cgroup_file_ctx *ctx = of->priv; |
11776 | struct cgroup *src_cgrp, *dst_cgrp; |
11777 | struct task_struct *task; |
11778 | + const struct cred *saved_cred; |
11779 | ssize_t ret; |
11780 | |
11781 | dst_cgrp = cgroup_kn_lock_live(of->kn, false); |
11782 | @@ -4814,8 +4836,16 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of, |
11783 | src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root); |
11784 | spin_unlock_irq(&css_set_lock); |
11785 | |
11786 | + /* |
11787 | + * Process and thread migrations follow same delegation rule. Check |
11788 | + * permissions using the credentials from file open to protect against |
11789 | + * inherited fd attacks. |
11790 | + */ |
11791 | + saved_cred = override_creds(of->file->f_cred); |
11792 | ret = cgroup_procs_write_permission(src_cgrp, dst_cgrp, |
11793 | - of->file->f_path.dentry->d_sb); |
11794 | + of->file->f_path.dentry->d_sb, |
11795 | + ctx->ns); |
11796 | + revert_creds(saved_cred); |
11797 | if (ret) |
11798 | goto out_finish; |
11799 | |
11800 | @@ -4837,8 +4867,10 @@ static void *cgroup_threads_start(struct seq_file *s, loff_t *pos) |
11801 | static ssize_t cgroup_threads_write(struct kernfs_open_file *of, |
11802 | char *buf, size_t nbytes, loff_t off) |
11803 | { |
11804 | + struct cgroup_file_ctx *ctx = of->priv; |
11805 | struct cgroup *src_cgrp, *dst_cgrp; |
11806 | struct task_struct *task; |
11807 | + const struct cred *saved_cred; |
11808 | ssize_t ret; |
11809 | |
11810 | buf = strstrip(buf); |
11811 | @@ -4857,9 +4889,16 @@ static ssize_t cgroup_threads_write(struct kernfs_open_file *of, |
11812 | src_cgrp = task_cgroup_from_root(task, &cgrp_dfl_root); |
11813 | spin_unlock_irq(&css_set_lock); |
11814 | |
11815 | - /* thread migrations follow the cgroup.procs delegation rule */ |
11816 | + /* |
11817 | + * Process and thread migrations follow same delegation rule. Check |
11818 | + * permissions using the credentials from file open to protect against |
11819 | + * inherited fd attacks. |
11820 | + */ |
11821 | + saved_cred = override_creds(of->file->f_cred); |
11822 | ret = cgroup_procs_write_permission(src_cgrp, dst_cgrp, |
11823 | - of->file->f_path.dentry->d_sb); |
11824 | + of->file->f_path.dentry->d_sb, |
11825 | + ctx->ns); |
11826 | + revert_creds(saved_cred); |
11827 | if (ret) |
11828 | goto out_finish; |
11829 | |
11830 | diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c |
11831 | index b28665f4d8c7a..4dc3bbfd3e3f3 100644 |
11832 | --- a/kernel/dma/debug.c |
11833 | +++ b/kernel/dma/debug.c |
11834 | @@ -980,7 +980,7 @@ static __init int dma_debug_cmdline(char *str) |
11835 | global_disable = true; |
11836 | } |
11837 | |
11838 | - return 0; |
11839 | + return 1; |
11840 | } |
11841 | |
11842 | static __init int dma_debug_entries_cmdline(char *str) |
11843 | @@ -989,7 +989,7 @@ static __init int dma_debug_entries_cmdline(char *str) |
11844 | return -EINVAL; |
11845 | if (!get_option(&str, &nr_prealloc_entries)) |
11846 | nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES; |
11847 | - return 0; |
11848 | + return 1; |
11849 | } |
11850 | |
11851 | __setup("dma_debug=", dma_debug_cmdline); |
11852 | diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c |
11853 | index f99b79d7e1235..f17b771856d1c 100644 |
11854 | --- a/kernel/dma/swiotlb.c |
11855 | +++ b/kernel/dma/swiotlb.c |
11856 | @@ -572,7 +572,8 @@ found: |
11857 | for (i = 0; i < nslots; i++) |
11858 | io_tlb_orig_addr[index+i] = orig_addr + (i << IO_TLB_SHIFT); |
11859 | if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) && |
11860 | - (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)) |
11861 | + (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE || |
11862 | + dir == DMA_BIDIRECTIONAL)) |
11863 | swiotlb_bounce(orig_addr, tlb_addr, mapping_size, DMA_TO_DEVICE); |
11864 | |
11865 | return tlb_addr; |
11866 | diff --git a/kernel/events/core.c b/kernel/events/core.c |
11867 | index f720a40ccaf5f..52f4a9e467040 100644 |
11868 | --- a/kernel/events/core.c |
11869 | +++ b/kernel/events/core.c |
11870 | @@ -9490,8 +9490,11 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, |
11871 | } |
11872 | |
11873 | /* ready to consume more filters */ |
11874 | + kfree(filename); |
11875 | + filename = NULL; |
11876 | state = IF_STATE_ACTION; |
11877 | filter = NULL; |
11878 | + kernel = 0; |
11879 | } |
11880 | } |
11881 | |
11882 | diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c |
11883 | index 6cafb2e910a11..406b4cbbec5e7 100644 |
11884 | --- a/kernel/power/hibernate.c |
11885 | +++ b/kernel/power/hibernate.c |
11886 | @@ -1216,7 +1216,7 @@ static int __init resumedelay_setup(char *str) |
11887 | int rc = kstrtouint(str, 0, &resume_delay); |
11888 | |
11889 | if (rc) |
11890 | - return rc; |
11891 | + pr_warn("resumedelay: bad option string '%s'\n", str); |
11892 | return 1; |
11893 | } |
11894 | |
11895 | diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c |
11896 | index 60564b58de077..bfd2a96c695ca 100644 |
11897 | --- a/kernel/power/suspend_test.c |
11898 | +++ b/kernel/power/suspend_test.c |
11899 | @@ -157,22 +157,22 @@ static int __init setup_test_suspend(char *value) |
11900 | value++; |
11901 | suspend_type = strsep(&value, ","); |
11902 | if (!suspend_type) |
11903 | - return 0; |
11904 | + return 1; |
11905 | |
11906 | repeat = strsep(&value, ","); |
11907 | if (repeat) { |
11908 | if (kstrtou32(repeat, 0, &test_repeat_count_max)) |
11909 | - return 0; |
11910 | + return 1; |
11911 | } |
11912 | |
11913 | for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) |
11914 | if (!strcmp(pm_labels[i], suspend_type)) { |
11915 | test_state_label = pm_labels[i]; |
11916 | - return 0; |
11917 | + return 1; |
11918 | } |
11919 | |
11920 | printk(warn_bad_state, suspend_type); |
11921 | - return 0; |
11922 | + return 1; |
11923 | } |
11924 | __setup("test_suspend", setup_test_suspend); |
11925 | |
11926 | diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c |
11927 | index 23e26a203a9e9..bb2198b40756d 100644 |
11928 | --- a/kernel/printk/printk.c |
11929 | +++ b/kernel/printk/printk.c |
11930 | @@ -146,8 +146,10 @@ static int __control_devkmsg(char *str) |
11931 | |
11932 | static int __init control_devkmsg(char *str) |
11933 | { |
11934 | - if (__control_devkmsg(str) < 0) |
11935 | + if (__control_devkmsg(str) < 0) { |
11936 | + pr_warn("printk.devkmsg: bad option string '%s'\n", str); |
11937 | return 1; |
11938 | + } |
11939 | |
11940 | /* |
11941 | * Set sysctl string accordingly: |
11942 | @@ -166,7 +168,7 @@ static int __init control_devkmsg(char *str) |
11943 | */ |
11944 | devkmsg_log |= DEVKMSG_LOG_MASK_LOCK; |
11945 | |
11946 | - return 0; |
11947 | + return 1; |
11948 | } |
11949 | __setup("printk.devkmsg=", control_devkmsg); |
11950 | |
11951 | diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
11952 | index eb4d04cb3aaf5..d99f73f83bf5f 100644 |
11953 | --- a/kernel/ptrace.c |
11954 | +++ b/kernel/ptrace.c |
11955 | @@ -370,6 +370,26 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) |
11956 | return !err; |
11957 | } |
11958 | |
11959 | +static int check_ptrace_options(unsigned long data) |
11960 | +{ |
11961 | + if (data & ~(unsigned long)PTRACE_O_MASK) |
11962 | + return -EINVAL; |
11963 | + |
11964 | + if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) { |
11965 | + if (!IS_ENABLED(CONFIG_CHECKPOINT_RESTORE) || |
11966 | + !IS_ENABLED(CONFIG_SECCOMP)) |
11967 | + return -EINVAL; |
11968 | + |
11969 | + if (!capable(CAP_SYS_ADMIN)) |
11970 | + return -EPERM; |
11971 | + |
11972 | + if (seccomp_mode(¤t->seccomp) != SECCOMP_MODE_DISABLED || |
11973 | + current->ptrace & PT_SUSPEND_SECCOMP) |
11974 | + return -EPERM; |
11975 | + } |
11976 | + return 0; |
11977 | +} |
11978 | + |
11979 | static int ptrace_attach(struct task_struct *task, long request, |
11980 | unsigned long addr, |
11981 | unsigned long flags) |
11982 | @@ -381,8 +401,16 @@ static int ptrace_attach(struct task_struct *task, long request, |
11983 | if (seize) { |
11984 | if (addr != 0) |
11985 | goto out; |
11986 | + /* |
11987 | + * This duplicates the check in check_ptrace_options() because |
11988 | + * ptrace_attach() and ptrace_setoptions() have historically |
11989 | + * used different error codes for unknown ptrace options. |
11990 | + */ |
11991 | if (flags & ~(unsigned long)PTRACE_O_MASK) |
11992 | goto out; |
11993 | + retval = check_ptrace_options(flags); |
11994 | + if (retval) |
11995 | + return retval; |
11996 | flags = PT_PTRACED | PT_SEIZED | (flags << PT_OPT_FLAG_SHIFT); |
11997 | } else { |
11998 | flags = PT_PTRACED; |
11999 | @@ -655,22 +683,11 @@ int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long ds |
12000 | static int ptrace_setoptions(struct task_struct *child, unsigned long data) |
12001 | { |
12002 | unsigned flags; |
12003 | + int ret; |
12004 | |
12005 | - if (data & ~(unsigned long)PTRACE_O_MASK) |
12006 | - return -EINVAL; |
12007 | - |
12008 | - if (unlikely(data & PTRACE_O_SUSPEND_SECCOMP)) { |
12009 | - if (!IS_ENABLED(CONFIG_CHECKPOINT_RESTORE) || |
12010 | - !IS_ENABLED(CONFIG_SECCOMP)) |
12011 | - return -EINVAL; |
12012 | - |
12013 | - if (!capable(CAP_SYS_ADMIN)) |
12014 | - return -EPERM; |
12015 | - |
12016 | - if (seccomp_mode(¤t->seccomp) != SECCOMP_MODE_DISABLED || |
12017 | - current->ptrace & PT_SUSPEND_SECCOMP) |
12018 | - return -EPERM; |
12019 | - } |
12020 | + ret = check_ptrace_options(data); |
12021 | + if (ret) |
12022 | + return ret; |
12023 | |
12024 | /* Avoid intermediate state when all opts are cleared */ |
12025 | flags = child->ptrace; |
12026 | diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c |
12027 | index faada713cfae8..d5f7fc7099bc4 100644 |
12028 | --- a/kernel/sched/debug.c |
12029 | +++ b/kernel/sched/debug.c |
12030 | @@ -847,25 +847,15 @@ void print_numa_stats(struct seq_file *m, int node, unsigned long tsf, |
12031 | static void sched_show_numa(struct task_struct *p, struct seq_file *m) |
12032 | { |
12033 | #ifdef CONFIG_NUMA_BALANCING |
12034 | - struct mempolicy *pol; |
12035 | - |
12036 | if (p->mm) |
12037 | P(mm->numa_scan_seq); |
12038 | |
12039 | - task_lock(p); |
12040 | - pol = p->mempolicy; |
12041 | - if (pol && !(pol->flags & MPOL_F_MORON)) |
12042 | - pol = NULL; |
12043 | - mpol_get(pol); |
12044 | - task_unlock(p); |
12045 | - |
12046 | P(numa_pages_migrated); |
12047 | P(numa_preferred_nid); |
12048 | P(total_numa_faults); |
12049 | SEQ_printf(m, "current_node=%d, numa_group_id=%d\n", |
12050 | task_node(p), task_numa_group_id(p)); |
12051 | show_numa_stats(p, m); |
12052 | - mpol_put(pol); |
12053 | #endif |
12054 | } |
12055 | |
12056 | diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c |
12057 | index 4d0b59fa5550f..46f24b7a32217 100644 |
12058 | --- a/lib/lz4/lz4_decompress.c |
12059 | +++ b/lib/lz4/lz4_decompress.c |
12060 | @@ -268,8 +268,12 @@ static FORCE_INLINE int LZ4_decompress_generic( |
12061 | ip += length; |
12062 | op += length; |
12063 | |
12064 | - /* Necessarily EOF, due to parsing restrictions */ |
12065 | - if (!partialDecoding || (cpy == oend)) |
12066 | + /* Necessarily EOF when !partialDecoding. |
12067 | + * When partialDecoding, it is EOF if we've either |
12068 | + * filled the output buffer or |
12069 | + * can't proceed with reading an offset for following match. |
12070 | + */ |
12071 | + if (!partialDecoding || (cpy == oend) || (ip >= (iend - 2))) |
12072 | break; |
12073 | } else { |
12074 | /* may overwrite up to WILDCOPYLENGTH beyond cpy */ |
12075 | diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile |
12076 | index b9e6c3648be1a..98b9fd0354dd1 100644 |
12077 | --- a/lib/raid6/test/Makefile |
12078 | +++ b/lib/raid6/test/Makefile |
12079 | @@ -4,6 +4,8 @@ |
12080 | # from userspace. |
12081 | # |
12082 | |
12083 | +pound := \# |
12084 | + |
12085 | CC = gcc |
12086 | OPTFLAGS = -O2 # Adjust as desired |
12087 | CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) |
12088 | @@ -47,7 +49,7 @@ else ifeq ($(HAS_NEON),yes) |
12089 | OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o |
12090 | CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 |
12091 | else |
12092 | - HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\ |
12093 | + HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\ |
12094 | gcc -c -x c - >/dev/null && rm ./-.o && echo yes) |
12095 | ifeq ($(HAS_ALTIVEC),yes) |
12096 | CFLAGS += -I../../../arch/powerpc/include |
12097 | diff --git a/lib/raid6/test/test.c b/lib/raid6/test/test.c |
12098 | index a3cf071941ab4..841a55242abaa 100644 |
12099 | --- a/lib/raid6/test/test.c |
12100 | +++ b/lib/raid6/test/test.c |
12101 | @@ -19,7 +19,6 @@ |
12102 | #define NDISKS 16 /* Including P and Q */ |
12103 | |
12104 | const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); |
12105 | -struct raid6_calls raid6_call; |
12106 | |
12107 | char *dataptrs[NDISKS]; |
12108 | char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); |
12109 | diff --git a/lib/test_kmod.c b/lib/test_kmod.c |
12110 | index 87a0cc750ea23..6813b183aa348 100644 |
12111 | --- a/lib/test_kmod.c |
12112 | +++ b/lib/test_kmod.c |
12113 | @@ -1155,6 +1155,7 @@ static struct kmod_test_device *register_test_dev_kmod(void) |
12114 | if (ret) { |
12115 | pr_err("could not register misc device: %d\n", ret); |
12116 | free_test_dev_kmod(test_dev); |
12117 | + test_dev = NULL; |
12118 | goto out; |
12119 | } |
12120 | |
12121 | diff --git a/lib/test_xarray.c b/lib/test_xarray.c |
12122 | index 8262c3f05a5d3..aefa377c9c26a 100644 |
12123 | --- a/lib/test_xarray.c |
12124 | +++ b/lib/test_xarray.c |
12125 | @@ -1438,6 +1438,25 @@ unlock: |
12126 | XA_BUG_ON(xa, !xa_empty(xa)); |
12127 | } |
12128 | |
12129 | +static noinline void check_create_range_5(struct xarray *xa, |
12130 | + unsigned long index, unsigned int order) |
12131 | +{ |
12132 | + XA_STATE_ORDER(xas, xa, index, order); |
12133 | + unsigned int i; |
12134 | + |
12135 | + xa_store_order(xa, index, order, xa_mk_index(index), GFP_KERNEL); |
12136 | + |
12137 | + for (i = 0; i < order + 10; i++) { |
12138 | + do { |
12139 | + xas_lock(&xas); |
12140 | + xas_create_range(&xas); |
12141 | + xas_unlock(&xas); |
12142 | + } while (xas_nomem(&xas, GFP_KERNEL)); |
12143 | + } |
12144 | + |
12145 | + xa_destroy(xa); |
12146 | +} |
12147 | + |
12148 | static noinline void check_create_range(struct xarray *xa) |
12149 | { |
12150 | unsigned int order; |
12151 | @@ -1465,6 +1484,9 @@ static noinline void check_create_range(struct xarray *xa) |
12152 | check_create_range_4(xa, (3U << order) + 1, order); |
12153 | check_create_range_4(xa, (3U << order) - 1, order); |
12154 | check_create_range_4(xa, (1U << 24) + 1, order); |
12155 | + |
12156 | + check_create_range_5(xa, 0, order); |
12157 | + check_create_range_5(xa, (1U << order), order); |
12158 | } |
12159 | |
12160 | check_create_range_3(); |
12161 | diff --git a/lib/xarray.c b/lib/xarray.c |
12162 | index 7d22b30591275..61464c52c20e6 100644 |
12163 | --- a/lib/xarray.c |
12164 | +++ b/lib/xarray.c |
12165 | @@ -722,6 +722,8 @@ void xas_create_range(struct xa_state *xas) |
12166 | |
12167 | for (;;) { |
12168 | struct xa_node *node = xas->xa_node; |
12169 | + if (node->shift >= shift) |
12170 | + break; |
12171 | xas->xa_node = xa_parent_locked(xas->xa, node); |
12172 | xas->xa_offset = node->offset - 1; |
12173 | if (node->offset != 0) |
12174 | @@ -1078,6 +1080,7 @@ void xas_split(struct xa_state *xas, void *entry, unsigned int order) |
12175 | xa_mk_node(child)); |
12176 | if (xa_is_value(curr)) |
12177 | values--; |
12178 | + xas_update(xas, child); |
12179 | } else { |
12180 | unsigned int canon = offset - xas->xa_sibs; |
12181 | |
12182 | @@ -1092,6 +1095,7 @@ void xas_split(struct xa_state *xas, void *entry, unsigned int order) |
12183 | } while (offset-- > xas->xa_offset); |
12184 | |
12185 | node->nr_values += values; |
12186 | + xas_update(xas, node); |
12187 | } |
12188 | EXPORT_SYMBOL_GPL(xas_split); |
12189 | #endif |
12190 | diff --git a/mm/kmemleak.c b/mm/kmemleak.c |
12191 | index 4a669c81f4e22..d8cde7292bf92 100644 |
12192 | --- a/mm/kmemleak.c |
12193 | +++ b/mm/kmemleak.c |
12194 | @@ -787,6 +787,8 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) |
12195 | unsigned long flags; |
12196 | struct kmemleak_object *object; |
12197 | struct kmemleak_scan_area *area = NULL; |
12198 | + unsigned long untagged_ptr; |
12199 | + unsigned long untagged_objp; |
12200 | |
12201 | object = find_and_get_object(ptr, 1); |
12202 | if (!object) { |
12203 | @@ -795,6 +797,9 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) |
12204 | return; |
12205 | } |
12206 | |
12207 | + untagged_ptr = (unsigned long)kasan_reset_tag((void *)ptr); |
12208 | + untagged_objp = (unsigned long)kasan_reset_tag((void *)object->pointer); |
12209 | + |
12210 | if (scan_area_cache) |
12211 | area = kmem_cache_alloc(scan_area_cache, gfp_kmemleak_mask(gfp)); |
12212 | |
12213 | @@ -806,8 +811,8 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) |
12214 | goto out_unlock; |
12215 | } |
12216 | if (size == SIZE_MAX) { |
12217 | - size = object->pointer + object->size - ptr; |
12218 | - } else if (ptr + size > object->pointer + object->size) { |
12219 | + size = untagged_objp + object->size - untagged_ptr; |
12220 | + } else if (untagged_ptr + size > untagged_objp + object->size) { |
12221 | kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr); |
12222 | dump_object_info(object); |
12223 | kmem_cache_free(scan_area_cache, area); |
12224 | diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
12225 | index 6d7fe3589e4a0..8fc6635454987 100644 |
12226 | --- a/mm/memcontrol.c |
12227 | +++ b/mm/memcontrol.c |
12228 | @@ -6973,7 +6973,7 @@ static int __init cgroup_memory(char *s) |
12229 | if (!strcmp(token, "nokmem")) |
12230 | cgroup_memory_nokmem = true; |
12231 | } |
12232 | - return 0; |
12233 | + return 1; |
12234 | } |
12235 | __setup("cgroup.memory=", cgroup_memory); |
12236 | |
12237 | diff --git a/mm/memory.c b/mm/memory.c |
12238 | index 4bb7c6a364c81..8a72fd3e73bf1 100644 |
12239 | --- a/mm/memory.c |
12240 | +++ b/mm/memory.c |
12241 | @@ -1013,6 +1013,17 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, |
12242 | return ret; |
12243 | } |
12244 | |
12245 | +/* Whether we should zap all COWed (private) pages too */ |
12246 | +static inline bool should_zap_cows(struct zap_details *details) |
12247 | +{ |
12248 | + /* By default, zap all pages */ |
12249 | + if (!details) |
12250 | + return true; |
12251 | + |
12252 | + /* Or, we zap COWed pages only if the caller wants to */ |
12253 | + return !details->check_mapping; |
12254 | +} |
12255 | + |
12256 | static unsigned long zap_pte_range(struct mmu_gather *tlb, |
12257 | struct vm_area_struct *vma, pmd_t *pmd, |
12258 | unsigned long addr, unsigned long end, |
12259 | @@ -1104,16 +1115,18 @@ again: |
12260 | continue; |
12261 | } |
12262 | |
12263 | - /* If details->check_mapping, we leave swap entries. */ |
12264 | - if (unlikely(details)) |
12265 | - continue; |
12266 | - |
12267 | - if (!non_swap_entry(entry)) |
12268 | + if (!non_swap_entry(entry)) { |
12269 | + /* Genuine swap entry, hence a private anon page */ |
12270 | + if (!should_zap_cows(details)) |
12271 | + continue; |
12272 | rss[MM_SWAPENTS]--; |
12273 | - else if (is_migration_entry(entry)) { |
12274 | + } else if (is_migration_entry(entry)) { |
12275 | struct page *page; |
12276 | |
12277 | page = migration_entry_to_page(entry); |
12278 | + if (details && details->check_mapping && |
12279 | + details->check_mapping != page_rmapping(page)) |
12280 | + continue; |
12281 | rss[mm_counter(page)]--; |
12282 | } |
12283 | if (unlikely(!free_swap_and_cache(entry))) |
12284 | @@ -3245,11 +3258,20 @@ static vm_fault_t __do_fault(struct vm_fault *vmf) |
12285 | return ret; |
12286 | |
12287 | if (unlikely(PageHWPoison(vmf->page))) { |
12288 | - if (ret & VM_FAULT_LOCKED) |
12289 | - unlock_page(vmf->page); |
12290 | - put_page(vmf->page); |
12291 | + struct page *page = vmf->page; |
12292 | + vm_fault_t poisonret = VM_FAULT_HWPOISON; |
12293 | + if (ret & VM_FAULT_LOCKED) { |
12294 | + if (page_mapped(page)) |
12295 | + unmap_mapping_pages(page_mapping(page), |
12296 | + page->index, 1, false); |
12297 | + /* Retry if a clean page was removed from the cache. */ |
12298 | + if (invalidate_inode_page(page)) |
12299 | + poisonret = VM_FAULT_NOPAGE; |
12300 | + unlock_page(page); |
12301 | + } |
12302 | + put_page(page); |
12303 | vmf->page = NULL; |
12304 | - return VM_FAULT_HWPOISON; |
12305 | + return poisonret; |
12306 | } |
12307 | |
12308 | if (unlikely(!(ret & VM_FAULT_LOCKED))) |
12309 | diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
12310 | index 2c4082f71d258..d79ab5116a7be 100644 |
12311 | --- a/mm/mempolicy.c |
12312 | +++ b/mm/mempolicy.c |
12313 | @@ -731,7 +731,6 @@ static int vma_replace_policy(struct vm_area_struct *vma, |
12314 | static int mbind_range(struct mm_struct *mm, unsigned long start, |
12315 | unsigned long end, struct mempolicy *new_pol) |
12316 | { |
12317 | - struct vm_area_struct *next; |
12318 | struct vm_area_struct *prev; |
12319 | struct vm_area_struct *vma; |
12320 | int err = 0; |
12321 | @@ -747,8 +746,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, |
12322 | if (start > vma->vm_start) |
12323 | prev = vma; |
12324 | |
12325 | - for (; vma && vma->vm_start < end; prev = vma, vma = next) { |
12326 | - next = vma->vm_next; |
12327 | + for (; vma && vma->vm_start < end; prev = vma, vma = vma->vm_next) { |
12328 | vmstart = max(start, vma->vm_start); |
12329 | vmend = min(end, vma->vm_end); |
12330 | |
12331 | @@ -762,10 +760,6 @@ static int mbind_range(struct mm_struct *mm, unsigned long start, |
12332 | new_pol, vma->vm_userfaultfd_ctx); |
12333 | if (prev) { |
12334 | vma = prev; |
12335 | - next = vma->vm_next; |
12336 | - if (mpol_equal(vma_policy(vma), new_pol)) |
12337 | - continue; |
12338 | - /* vma_merge() joined vma && vma->next, case 8 */ |
12339 | goto replace; |
12340 | } |
12341 | if (vma->vm_start != vmstart) { |
12342 | @@ -2565,6 +2559,7 @@ alloc_new: |
12343 | mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL); |
12344 | if (!mpol_new) |
12345 | goto err_out; |
12346 | + atomic_set(&mpol_new->refcnt, 1); |
12347 | goto restart; |
12348 | } |
12349 | |
12350 | diff --git a/mm/mmap.c b/mm/mmap.c |
12351 | index ba78f1f1b1bd1..58cfd5b1e0b16 100644 |
12352 | --- a/mm/mmap.c |
12353 | +++ b/mm/mmap.c |
12354 | @@ -2515,7 +2515,7 @@ static int __init cmdline_parse_stack_guard_gap(char *p) |
12355 | if (!*endptr) |
12356 | stack_guard_gap = val << PAGE_SHIFT; |
12357 | |
12358 | - return 0; |
12359 | + return 1; |
12360 | } |
12361 | __setup("stack_guard_gap=", cmdline_parse_stack_guard_gap); |
12362 | |
12363 | diff --git a/mm/mremap.c b/mm/mremap.c |
12364 | index 8005d0b2b8438..8ce1b7632fbb8 100644 |
12365 | --- a/mm/mremap.c |
12366 | +++ b/mm/mremap.c |
12367 | @@ -246,6 +246,9 @@ unsigned long move_page_tables(struct vm_area_struct *vma, |
12368 | struct mmu_notifier_range range; |
12369 | pmd_t *old_pmd, *new_pmd; |
12370 | |
12371 | + if (!len) |
12372 | + return 0; |
12373 | + |
12374 | old_end = old_addr + len; |
12375 | flush_cache_range(vma, old_addr, old_end); |
12376 | |
12377 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
12378 | index c3835915d1157..5038611563dfb 100644 |
12379 | --- a/mm/page_alloc.c |
12380 | +++ b/mm/page_alloc.c |
12381 | @@ -7326,10 +7326,17 @@ restart: |
12382 | |
12383 | out2: |
12384 | /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ |
12385 | - for (nid = 0; nid < MAX_NUMNODES; nid++) |
12386 | + for (nid = 0; nid < MAX_NUMNODES; nid++) { |
12387 | + unsigned long start_pfn, end_pfn; |
12388 | + |
12389 | zone_movable_pfn[nid] = |
12390 | roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES); |
12391 | |
12392 | + get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); |
12393 | + if (zone_movable_pfn[nid] >= end_pfn) |
12394 | + zone_movable_pfn[nid] = 0; |
12395 | + } |
12396 | + |
12397 | out: |
12398 | /* restore the node_state */ |
12399 | node_states[N_MEMORY] = saved_node_state; |
12400 | diff --git a/mm/rmap.c b/mm/rmap.c |
12401 | index 45f2106852e84..6d80e92688fe7 100644 |
12402 | --- a/mm/rmap.c |
12403 | +++ b/mm/rmap.c |
12404 | @@ -1602,7 +1602,30 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, |
12405 | |
12406 | /* MADV_FREE page check */ |
12407 | if (!PageSwapBacked(page)) { |
12408 | - if (!PageDirty(page)) { |
12409 | + int ref_count, map_count; |
12410 | + |
12411 | + /* |
12412 | + * Synchronize with gup_pte_range(): |
12413 | + * - clear PTE; barrier; read refcount |
12414 | + * - inc refcount; barrier; read PTE |
12415 | + */ |
12416 | + smp_mb(); |
12417 | + |
12418 | + ref_count = page_ref_count(page); |
12419 | + map_count = page_mapcount(page); |
12420 | + |
12421 | + /* |
12422 | + * Order reads for page refcount and dirty flag |
12423 | + * (see comments in __remove_mapping()). |
12424 | + */ |
12425 | + smp_rmb(); |
12426 | + |
12427 | + /* |
12428 | + * The only page refs must be one from isolation |
12429 | + * plus the rmap(s) (dropped by discard:). |
12430 | + */ |
12431 | + if (ref_count == 1 + map_count && |
12432 | + !PageDirty(page)) { |
12433 | /* Invalidate as we cleared the pte */ |
12434 | mmu_notifier_invalidate_range(mm, |
12435 | address, address + PAGE_SIZE); |
12436 | diff --git a/mm/usercopy.c b/mm/usercopy.c |
12437 | index 660717a1ea5cd..f70455bad7f32 100644 |
12438 | --- a/mm/usercopy.c |
12439 | +++ b/mm/usercopy.c |
12440 | @@ -294,7 +294,10 @@ static bool enable_checks __initdata = true; |
12441 | |
12442 | static int __init parse_hardened_usercopy(char *str) |
12443 | { |
12444 | - return strtobool(str, &enable_checks); |
12445 | + if (strtobool(str, &enable_checks)) |
12446 | + pr_warn("Invalid option string for hardened_usercopy: '%s'\n", |
12447 | + str); |
12448 | + return 1; |
12449 | } |
12450 | |
12451 | __setup("hardened_usercopy=", parse_hardened_usercopy); |
12452 | diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c |
12453 | index 09d81f9c2a649..6f0a9f4392333 100644 |
12454 | --- a/net/batman-adv/multicast.c |
12455 | +++ b/net/batman-adv/multicast.c |
12456 | @@ -136,7 +136,7 @@ static u8 batadv_mcast_mla_rtr_flags_softif_get_ipv6(struct net_device *dev) |
12457 | { |
12458 | struct inet6_dev *in6_dev = __in6_dev_get(dev); |
12459 | |
12460 | - if (in6_dev && in6_dev->cnf.mc_forwarding) |
12461 | + if (in6_dev && atomic_read(&in6_dev->cnf.mc_forwarding)) |
12462 | return BATADV_NO_FLAGS; |
12463 | else |
12464 | return BATADV_MCAST_WANT_NO_RTR6; |
12465 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
12466 | index 082a262ab49c3..ff6625493c9f8 100644 |
12467 | --- a/net/bluetooth/hci_event.c |
12468 | +++ b/net/bluetooth/hci_event.c |
12469 | @@ -4911,8 +4911,9 @@ static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, |
12470 | hci_dev_lock(hdev); |
12471 | |
12472 | hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); |
12473 | - if (hcon) { |
12474 | + if (hcon && hcon->type == AMP_LINK) { |
12475 | hcon->state = BT_CLOSED; |
12476 | + hci_disconn_cfm(hcon, ev->reason); |
12477 | hci_conn_del(hcon); |
12478 | } |
12479 | |
12480 | diff --git a/net/core/filter.c b/net/core/filter.c |
12481 | index d39518f691b4b..e16b2b5cda981 100644 |
12482 | --- a/net/core/filter.c |
12483 | +++ b/net/core/filter.c |
12484 | @@ -5824,24 +5824,33 @@ BPF_CALL_5(bpf_tcp_check_syncookie, struct sock *, sk, void *, iph, u32, iph_len |
12485 | if (!th->ack || th->rst || th->syn) |
12486 | return -ENOENT; |
12487 | |
12488 | + if (unlikely(iph_len < sizeof(struct iphdr))) |
12489 | + return -EINVAL; |
12490 | + |
12491 | if (tcp_synq_no_recent_overflow(sk)) |
12492 | return -ENOENT; |
12493 | |
12494 | cookie = ntohl(th->ack_seq) - 1; |
12495 | |
12496 | - switch (sk->sk_family) { |
12497 | - case AF_INET: |
12498 | - if (unlikely(iph_len < sizeof(struct iphdr))) |
12499 | + /* Both struct iphdr and struct ipv6hdr have the version field at the |
12500 | + * same offset so we can cast to the shorter header (struct iphdr). |
12501 | + */ |
12502 | + switch (((struct iphdr *)iph)->version) { |
12503 | + case 4: |
12504 | + if (sk->sk_family == AF_INET6 && ipv6_only_sock(sk)) |
12505 | return -EINVAL; |
12506 | |
12507 | ret = __cookie_v4_check((struct iphdr *)iph, th, cookie); |
12508 | break; |
12509 | |
12510 | #if IS_BUILTIN(CONFIG_IPV6) |
12511 | - case AF_INET6: |
12512 | + case 6: |
12513 | if (unlikely(iph_len < sizeof(struct ipv6hdr))) |
12514 | return -EINVAL; |
12515 | |
12516 | + if (sk->sk_family != AF_INET6) |
12517 | + return -EINVAL; |
12518 | + |
12519 | ret = __cookie_v6_check((struct ipv6hdr *)iph, th, cookie); |
12520 | break; |
12521 | #endif /* CONFIG_IPV6 */ |
12522 | @@ -6708,6 +6717,7 @@ bool bpf_sock_is_valid_access(int off, int size, enum bpf_access_type type, |
12523 | struct bpf_insn_access_aux *info) |
12524 | { |
12525 | const int size_default = sizeof(__u32); |
12526 | + int field_size; |
12527 | |
12528 | if (off < 0 || off >= sizeof(struct bpf_sock)) |
12529 | return false; |
12530 | @@ -6719,7 +6729,6 @@ bool bpf_sock_is_valid_access(int off, int size, enum bpf_access_type type, |
12531 | case offsetof(struct bpf_sock, family): |
12532 | case offsetof(struct bpf_sock, type): |
12533 | case offsetof(struct bpf_sock, protocol): |
12534 | - case offsetof(struct bpf_sock, dst_port): |
12535 | case offsetof(struct bpf_sock, src_port): |
12536 | case bpf_ctx_range(struct bpf_sock, src_ip4): |
12537 | case bpf_ctx_range_till(struct bpf_sock, src_ip6[0], src_ip6[3]): |
12538 | @@ -6727,6 +6736,14 @@ bool bpf_sock_is_valid_access(int off, int size, enum bpf_access_type type, |
12539 | case bpf_ctx_range_till(struct bpf_sock, dst_ip6[0], dst_ip6[3]): |
12540 | bpf_ctx_record_field_size(info, size_default); |
12541 | return bpf_ctx_narrow_access_ok(off, size, size_default); |
12542 | + case bpf_ctx_range(struct bpf_sock, dst_port): |
12543 | + field_size = size == size_default ? |
12544 | + size_default : sizeof_field(struct bpf_sock, dst_port); |
12545 | + bpf_ctx_record_field_size(info, field_size); |
12546 | + return bpf_ctx_narrow_access_ok(off, size, field_size); |
12547 | + case offsetofend(struct bpf_sock, dst_port) ... |
12548 | + offsetof(struct bpf_sock, dst_ip4) - 1: |
12549 | + return false; |
12550 | } |
12551 | |
12552 | return size == size_default; |
12553 | diff --git a/net/core/skmsg.c b/net/core/skmsg.c |
12554 | index 17cc1edd149cb..a606ad8e8be25 100644 |
12555 | --- a/net/core/skmsg.c |
12556 | +++ b/net/core/skmsg.c |
12557 | @@ -27,6 +27,7 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, |
12558 | int elem_first_coalesce) |
12559 | { |
12560 | struct page_frag *pfrag = sk_page_frag(sk); |
12561 | + u32 osize = msg->sg.size; |
12562 | int ret = 0; |
12563 | |
12564 | len -= msg->sg.size; |
12565 | @@ -35,13 +36,17 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, |
12566 | u32 orig_offset; |
12567 | int use, i; |
12568 | |
12569 | - if (!sk_page_frag_refill(sk, pfrag)) |
12570 | - return -ENOMEM; |
12571 | + if (!sk_page_frag_refill(sk, pfrag)) { |
12572 | + ret = -ENOMEM; |
12573 | + goto msg_trim; |
12574 | + } |
12575 | |
12576 | orig_offset = pfrag->offset; |
12577 | use = min_t(int, len, pfrag->size - orig_offset); |
12578 | - if (!sk_wmem_schedule(sk, use)) |
12579 | - return -ENOMEM; |
12580 | + if (!sk_wmem_schedule(sk, use)) { |
12581 | + ret = -ENOMEM; |
12582 | + goto msg_trim; |
12583 | + } |
12584 | |
12585 | i = msg->sg.end; |
12586 | sk_msg_iter_var_prev(i); |
12587 | @@ -71,6 +76,10 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, |
12588 | } |
12589 | |
12590 | return ret; |
12591 | + |
12592 | +msg_trim: |
12593 | + sk_msg_trim(sk, msg, osize); |
12594 | + return ret; |
12595 | } |
12596 | EXPORT_SYMBOL_GPL(sk_msg_alloc); |
12597 | |
12598 | diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c |
12599 | index 7b951992c372b..b8fe943ae89d0 100644 |
12600 | --- a/net/ipv4/arp.c |
12601 | +++ b/net/ipv4/arp.c |
12602 | @@ -1116,13 +1116,18 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) |
12603 | return err; |
12604 | } |
12605 | |
12606 | -static int arp_invalidate(struct net_device *dev, __be32 ip) |
12607 | +int arp_invalidate(struct net_device *dev, __be32 ip, bool force) |
12608 | { |
12609 | struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); |
12610 | int err = -ENXIO; |
12611 | struct neigh_table *tbl = &arp_tbl; |
12612 | |
12613 | if (neigh) { |
12614 | + if ((neigh->nud_state & NUD_VALID) && !force) { |
12615 | + neigh_release(neigh); |
12616 | + return 0; |
12617 | + } |
12618 | + |
12619 | if (neigh->nud_state & ~NUD_NOARP) |
12620 | err = neigh_update(neigh, NULL, NUD_FAILED, |
12621 | NEIGH_UPDATE_F_OVERRIDE| |
12622 | @@ -1169,7 +1174,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r, |
12623 | if (!dev) |
12624 | return -EINVAL; |
12625 | } |
12626 | - return arp_invalidate(dev, ip); |
12627 | + return arp_invalidate(dev, ip, true); |
12628 | } |
12629 | |
12630 | /* |
12631 | diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
12632 | index a95102fe66371..ef3e7a3e3a29e 100644 |
12633 | --- a/net/ipv4/fib_frontend.c |
12634 | +++ b/net/ipv4/fib_frontend.c |
12635 | @@ -1122,9 +1122,11 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) |
12636 | return; |
12637 | |
12638 | /* Add broadcast address, if it is explicitly assigned. */ |
12639 | - if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF)) |
12640 | + if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF)) { |
12641 | fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, |
12642 | prim, 0); |
12643 | + arp_invalidate(dev, ifa->ifa_broadcast, false); |
12644 | + } |
12645 | |
12646 | if (!ipv4_is_zeronet(prefix) && !(ifa->ifa_flags & IFA_F_SECONDARY) && |
12647 | (prefix != addr || ifa->ifa_prefixlen < 32)) { |
12648 | @@ -1140,6 +1142,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) |
12649 | prim, 0); |
12650 | fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix | ~mask, |
12651 | 32, prim, 0); |
12652 | + arp_invalidate(dev, prefix | ~mask, false); |
12653 | } |
12654 | } |
12655 | } |
12656 | diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
12657 | index 692ba6d6180f8..f99ad4a98907d 100644 |
12658 | --- a/net/ipv4/fib_semantics.c |
12659 | +++ b/net/ipv4/fib_semantics.c |
12660 | @@ -876,8 +876,13 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi, |
12661 | } |
12662 | |
12663 | if (cfg->fc_oif || cfg->fc_gw_family) { |
12664 | - struct fib_nh *nh = fib_info_nh(fi, 0); |
12665 | + struct fib_nh *nh; |
12666 | + |
12667 | + /* cannot match on nexthop object attributes */ |
12668 | + if (fi->nh) |
12669 | + return 1; |
12670 | |
12671 | + nh = fib_info_nh(fi, 0); |
12672 | if (cfg->fc_encap) { |
12673 | if (fib_encap_match(cfg->fc_encap_type, cfg->fc_encap, |
12674 | nh, cfg, extack)) |
12675 | diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c |
12676 | index 7df7ec74807ac..bcc13368c8363 100644 |
12677 | --- a/net/ipv4/tcp_bpf.c |
12678 | +++ b/net/ipv4/tcp_bpf.c |
12679 | @@ -296,10 +296,9 @@ int tcp_bpf_sendmsg_redir(struct sock *sk, struct sk_msg *msg, |
12680 | struct sk_psock *psock = sk_psock_get(sk); |
12681 | int ret; |
12682 | |
12683 | - if (unlikely(!psock)) { |
12684 | - sk_msg_free(sk, msg); |
12685 | - return 0; |
12686 | - } |
12687 | + if (unlikely(!psock)) |
12688 | + return -EPIPE; |
12689 | + |
12690 | ret = ingress ? bpf_tcp_ingress(sk, psock, msg, bytes, flags) : |
12691 | tcp_bpf_push_locked(sk, msg, bytes, flags, false); |
12692 | sk_psock_put(sk, psock); |
12693 | @@ -367,7 +366,7 @@ more_data: |
12694 | cork = true; |
12695 | psock->cork = NULL; |
12696 | } |
12697 | - sk_msg_return(sk, msg, tosend); |
12698 | + sk_msg_return(sk, msg, msg->sg.size); |
12699 | release_sock(sk); |
12700 | |
12701 | ret = tcp_bpf_sendmsg_redir(sk_redir, msg, tosend, flags); |
12702 | @@ -407,8 +406,11 @@ more_data: |
12703 | } |
12704 | if (msg && |
12705 | msg->sg.data[msg->sg.start].page_link && |
12706 | - msg->sg.data[msg->sg.start].length) |
12707 | + msg->sg.data[msg->sg.start].length) { |
12708 | + if (eval == __SK_REDIRECT) |
12709 | + sk_mem_charge(sk, msg->sg.size); |
12710 | goto more_data; |
12711 | + } |
12712 | } |
12713 | return ret; |
12714 | } |
12715 | diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
12716 | index 638d7b49ad716..139e962d1aef3 100644 |
12717 | --- a/net/ipv4/tcp_output.c |
12718 | +++ b/net/ipv4/tcp_output.c |
12719 | @@ -3492,6 +3492,7 @@ static void tcp_connect_queue_skb(struct sock *sk, struct sk_buff *skb) |
12720 | */ |
12721 | static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) |
12722 | { |
12723 | + struct inet_connection_sock *icsk = inet_csk(sk); |
12724 | struct tcp_sock *tp = tcp_sk(sk); |
12725 | struct tcp_fastopen_request *fo = tp->fastopen_req; |
12726 | int space, err = 0; |
12727 | @@ -3506,8 +3507,10 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) |
12728 | * private TCP options. The cost is reduced data space in SYN :( |
12729 | */ |
12730 | tp->rx_opt.mss_clamp = tcp_mss_clamp(tp, tp->rx_opt.mss_clamp); |
12731 | + /* Sync mss_cache after updating the mss_clamp */ |
12732 | + tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); |
12733 | |
12734 | - space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - |
12735 | + space = __tcp_mtu_to_mss(sk, icsk->icsk_pmtu_cookie) - |
12736 | MAX_TCP_OPTION_SPACE; |
12737 | |
12738 | space = min_t(size_t, space, fo->size); |
12739 | diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
12740 | index 3cdf011a8dd8d..83fd4fa40d5e6 100644 |
12741 | --- a/net/ipv4/udp.c |
12742 | +++ b/net/ipv4/udp.c |
12743 | @@ -544,6 +544,12 @@ void udp_encap_enable(void) |
12744 | } |
12745 | EXPORT_SYMBOL(udp_encap_enable); |
12746 | |
12747 | +void udp_encap_disable(void) |
12748 | +{ |
12749 | + static_branch_dec(&udp_encap_needed_key); |
12750 | +} |
12751 | +EXPORT_SYMBOL(udp_encap_disable); |
12752 | + |
12753 | /* Handler for tunnels with arbitrary destination ports: no socket lookup, go |
12754 | * through error handlers in encapsulations looking for a match. |
12755 | */ |
12756 | diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
12757 | index 60d070b254846..69aef71f32ea7 100644 |
12758 | --- a/net/ipv6/addrconf.c |
12759 | +++ b/net/ipv6/addrconf.c |
12760 | @@ -542,7 +542,7 @@ static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex, |
12761 | #ifdef CONFIG_IPV6_MROUTE |
12762 | if ((all || type == NETCONFA_MC_FORWARDING) && |
12763 | nla_put_s32(skb, NETCONFA_MC_FORWARDING, |
12764 | - devconf->mc_forwarding) < 0) |
12765 | + atomic_read(&devconf->mc_forwarding)) < 0) |
12766 | goto nla_put_failure; |
12767 | #endif |
12768 | if ((all || type == NETCONFA_PROXY_NEIGH) && |
12769 | @@ -5460,7 +5460,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, |
12770 | array[DEVCONF_USE_OPTIMISTIC] = cnf->use_optimistic; |
12771 | #endif |
12772 | #ifdef CONFIG_IPV6_MROUTE |
12773 | - array[DEVCONF_MC_FORWARDING] = cnf->mc_forwarding; |
12774 | + array[DEVCONF_MC_FORWARDING] = atomic_read(&cnf->mc_forwarding); |
12775 | #endif |
12776 | array[DEVCONF_DISABLE_IPV6] = cnf->disable_ipv6; |
12777 | array[DEVCONF_ACCEPT_DAD] = cnf->accept_dad; |
12778 | diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c |
12779 | index 7e5df23cbe7bf..e6c4966aa956c 100644 |
12780 | --- a/net/ipv6/ip6_input.c |
12781 | +++ b/net/ipv6/ip6_input.c |
12782 | @@ -485,7 +485,7 @@ int ip6_mc_input(struct sk_buff *skb) |
12783 | /* |
12784 | * IPv6 multicast router mode is now supported ;) |
12785 | */ |
12786 | - if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding && |
12787 | + if (atomic_read(&dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding) && |
12788 | !(ipv6_addr_type(&hdr->daddr) & |
12789 | (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) && |
12790 | likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) { |
12791 | diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c |
12792 | index aee1f6bc039ab..6248e00c2bf72 100644 |
12793 | --- a/net/ipv6/ip6mr.c |
12794 | +++ b/net/ipv6/ip6mr.c |
12795 | @@ -736,7 +736,7 @@ static int mif6_delete(struct mr_table *mrt, int vifi, int notify, |
12796 | |
12797 | in6_dev = __in6_dev_get(dev); |
12798 | if (in6_dev) { |
12799 | - in6_dev->cnf.mc_forwarding--; |
12800 | + atomic_dec(&in6_dev->cnf.mc_forwarding); |
12801 | inet6_netconf_notify_devconf(dev_net(dev), RTM_NEWNETCONF, |
12802 | NETCONFA_MC_FORWARDING, |
12803 | dev->ifindex, &in6_dev->cnf); |
12804 | @@ -904,7 +904,7 @@ static int mif6_add(struct net *net, struct mr_table *mrt, |
12805 | |
12806 | in6_dev = __in6_dev_get(dev); |
12807 | if (in6_dev) { |
12808 | - in6_dev->cnf.mc_forwarding++; |
12809 | + atomic_inc(&in6_dev->cnf.mc_forwarding); |
12810 | inet6_netconf_notify_devconf(dev_net(dev), RTM_NEWNETCONF, |
12811 | NETCONFA_MC_FORWARDING, |
12812 | dev->ifindex, &in6_dev->cnf); |
12813 | @@ -1553,7 +1553,7 @@ static int ip6mr_sk_init(struct mr_table *mrt, struct sock *sk) |
12814 | } else { |
12815 | rcu_assign_pointer(mrt->mroute_sk, sk); |
12816 | sock_set_flag(sk, SOCK_RCU_FREE); |
12817 | - net->ipv6.devconf_all->mc_forwarding++; |
12818 | + atomic_inc(&net->ipv6.devconf_all->mc_forwarding); |
12819 | } |
12820 | write_unlock_bh(&mrt_lock); |
12821 | |
12822 | @@ -1586,7 +1586,7 @@ int ip6mr_sk_done(struct sock *sk) |
12823 | * so the RCU grace period before sk freeing |
12824 | * is guaranteed by sk_destruct() |
12825 | */ |
12826 | - net->ipv6.devconf_all->mc_forwarding--; |
12827 | + atomic_dec(&net->ipv6.devconf_all->mc_forwarding); |
12828 | write_unlock_bh(&mrt_lock); |
12829 | inet6_netconf_notify_devconf(net, RTM_NEWNETCONF, |
12830 | NETCONFA_MC_FORWARDING, |
12831 | diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
12832 | index 2a13394ab8541..619d9dffa9e44 100644 |
12833 | --- a/net/ipv6/route.c |
12834 | +++ b/net/ipv6/route.c |
12835 | @@ -4403,7 +4403,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes) |
12836 | struct inet6_dev *idev; |
12837 | int type; |
12838 | |
12839 | - if (netif_is_l3_master(skb->dev) && |
12840 | + if (netif_is_l3_master(skb->dev) || |
12841 | dst->dev == net->loopback_dev) |
12842 | idev = __in6_dev_get_safely(dev_get_by_index_rcu(net, IP6CB(skb)->iif)); |
12843 | else |
12844 | diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
12845 | index a71bfa5b02770..040869f45682d 100644 |
12846 | --- a/net/ipv6/udp.c |
12847 | +++ b/net/ipv6/udp.c |
12848 | @@ -1553,8 +1553,10 @@ void udpv6_destroy_sock(struct sock *sk) |
12849 | if (encap_destroy) |
12850 | encap_destroy(sk); |
12851 | } |
12852 | - if (up->encap_enabled) |
12853 | + if (up->encap_enabled) { |
12854 | static_branch_dec(&udpv6_encap_needed_key); |
12855 | + udp_encap_disable(); |
12856 | + } |
12857 | } |
12858 | |
12859 | inet6_destroy_sock(sk); |
12860 | diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c |
12861 | index 6b0ed6c593e2b..a6f13fab963f7 100644 |
12862 | --- a/net/ipv6/xfrm6_output.c |
12863 | +++ b/net/ipv6/xfrm6_output.c |
12864 | @@ -140,6 +140,19 @@ static int __xfrm6_output_finish(struct net *net, struct sock *sk, struct sk_buf |
12865 | return __xfrm6_output_state_finish(x, sk, skb); |
12866 | } |
12867 | |
12868 | +static int xfrm6_noneed_fragment(struct sk_buff *skb) |
12869 | +{ |
12870 | + struct frag_hdr *fh; |
12871 | + u8 prevhdr = ipv6_hdr(skb)->nexthdr; |
12872 | + |
12873 | + if (prevhdr != NEXTHDR_FRAGMENT) |
12874 | + return 0; |
12875 | + fh = (struct frag_hdr *)(skb->data + sizeof(struct ipv6hdr)); |
12876 | + if (fh->nexthdr == NEXTHDR_ESP || fh->nexthdr == NEXTHDR_AUTH) |
12877 | + return 1; |
12878 | + return 0; |
12879 | +} |
12880 | + |
12881 | static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) |
12882 | { |
12883 | struct dst_entry *dst = skb_dst(skb); |
12884 | @@ -168,6 +181,9 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) |
12885 | xfrm6_local_rxpmtu(skb, mtu); |
12886 | kfree_skb(skb); |
12887 | return -EMSGSIZE; |
12888 | + } else if (toobig && xfrm6_noneed_fragment(skb)) { |
12889 | + skb->ignore_df = 1; |
12890 | + goto skip_frag; |
12891 | } else if (!skb->ignore_df && toobig && skb->sk) { |
12892 | xfrm_local_error(skb, mtu); |
12893 | kfree_skb(skb); |
12894 | diff --git a/net/key/af_key.c b/net/key/af_key.c |
12895 | index 406e13478b01b..2ac9560020f91 100644 |
12896 | --- a/net/key/af_key.c |
12897 | +++ b/net/key/af_key.c |
12898 | @@ -1703,7 +1703,7 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad |
12899 | |
12900 | xfrm_probe_algs(); |
12901 | |
12902 | - supp_skb = compose_sadb_supported(hdr, GFP_KERNEL); |
12903 | + supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO); |
12904 | if (!supp_skb) { |
12905 | if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) |
12906 | pfk->registered &= ~(1<<hdr->sadb_msg_satype); |
12907 | diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c |
12908 | index 848b137151c26..b8cc3339a2495 100644 |
12909 | --- a/net/netfilter/nf_conntrack_proto_tcp.c |
12910 | +++ b/net/netfilter/nf_conntrack_proto_tcp.c |
12911 | @@ -354,8 +354,8 @@ static void tcp_options(const struct sk_buff *skb, |
12912 | length, buff); |
12913 | BUG_ON(ptr == NULL); |
12914 | |
12915 | - state->td_scale = |
12916 | - state->flags = 0; |
12917 | + state->td_scale = 0; |
12918 | + state->flags &= IP_CT_TCP_FLAG_BE_LIBERAL; |
12919 | |
12920 | while (length > 0) { |
12921 | int opcode=*ptr++; |
12922 | @@ -840,6 +840,16 @@ static bool nf_conntrack_tcp_established(const struct nf_conn *ct) |
12923 | test_bit(IPS_ASSURED_BIT, &ct->status); |
12924 | } |
12925 | |
12926 | +static void nf_ct_tcp_state_reset(struct ip_ct_tcp_state *state) |
12927 | +{ |
12928 | + state->td_end = 0; |
12929 | + state->td_maxend = 0; |
12930 | + state->td_maxwin = 0; |
12931 | + state->td_maxack = 0; |
12932 | + state->td_scale = 0; |
12933 | + state->flags &= IP_CT_TCP_FLAG_BE_LIBERAL; |
12934 | +} |
12935 | + |
12936 | /* Returns verdict for packet, or -1 for invalid. */ |
12937 | int nf_conntrack_tcp_packet(struct nf_conn *ct, |
12938 | struct sk_buff *skb, |
12939 | @@ -946,8 +956,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, |
12940 | ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK; |
12941 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = |
12942 | ct->proto.tcp.last_flags; |
12943 | - memset(&ct->proto.tcp.seen[dir], 0, |
12944 | - sizeof(struct ip_ct_tcp_state)); |
12945 | + nf_ct_tcp_state_reset(&ct->proto.tcp.seen[dir]); |
12946 | break; |
12947 | } |
12948 | ct->proto.tcp.last_index = index; |
12949 | diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c |
12950 | index 5e1239cef0005..91b35b7c80d82 100644 |
12951 | --- a/net/netlabel/netlabel_kapi.c |
12952 | +++ b/net/netlabel/netlabel_kapi.c |
12953 | @@ -885,6 +885,8 @@ int netlbl_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len, |
12954 | unsigned char bitmask; |
12955 | unsigned char byte; |
12956 | |
12957 | + if (offset >= bitmap_len) |
12958 | + return -1; |
12959 | byte_offset = offset / 8; |
12960 | byte = bitmap[byte_offset]; |
12961 | bit_spot = offset; |
12962 | diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
12963 | index 891e029ad0f89..fb28969899af0 100644 |
12964 | --- a/net/netlink/af_netlink.c |
12965 | +++ b/net/netlink/af_netlink.c |
12966 | @@ -148,6 +148,8 @@ static const struct rhashtable_params netlink_rhashtable_params; |
12967 | |
12968 | static inline u32 netlink_group_mask(u32 group) |
12969 | { |
12970 | + if (group > 32) |
12971 | + return 0; |
12972 | return group ? 1 << (group - 1) : 0; |
12973 | } |
12974 | |
12975 | diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c |
12976 | index 2c0f8cbc5c43b..ae40593daf214 100644 |
12977 | --- a/net/openvswitch/actions.c |
12978 | +++ b/net/openvswitch/actions.c |
12979 | @@ -1037,7 +1037,7 @@ static int clone(struct datapath *dp, struct sk_buff *skb, |
12980 | int rem = nla_len(attr); |
12981 | bool dont_clone_flow_key; |
12982 | |
12983 | - /* The first action is always 'OVS_CLONE_ATTR_ARG'. */ |
12984 | + /* The first action is always 'OVS_CLONE_ATTR_EXEC'. */ |
12985 | clone_arg = nla_data(attr); |
12986 | dont_clone_flow_key = nla_get_u32(clone_arg); |
12987 | actions = nla_next(clone_arg, &rem); |
12988 | diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c |
12989 | index b6f98eba71f1b..816036b9c223a 100644 |
12990 | --- a/net/openvswitch/conntrack.c |
12991 | +++ b/net/openvswitch/conntrack.c |
12992 | @@ -730,6 +730,57 @@ static bool skb_nfct_cached(struct net *net, |
12993 | } |
12994 | |
12995 | #if IS_ENABLED(CONFIG_NF_NAT) |
12996 | +static void ovs_nat_update_key(struct sw_flow_key *key, |
12997 | + const struct sk_buff *skb, |
12998 | + enum nf_nat_manip_type maniptype) |
12999 | +{ |
13000 | + if (maniptype == NF_NAT_MANIP_SRC) { |
13001 | + __be16 src; |
13002 | + |
13003 | + key->ct_state |= OVS_CS_F_SRC_NAT; |
13004 | + if (key->eth.type == htons(ETH_P_IP)) |
13005 | + key->ipv4.addr.src = ip_hdr(skb)->saddr; |
13006 | + else if (key->eth.type == htons(ETH_P_IPV6)) |
13007 | + memcpy(&key->ipv6.addr.src, &ipv6_hdr(skb)->saddr, |
13008 | + sizeof(key->ipv6.addr.src)); |
13009 | + else |
13010 | + return; |
13011 | + |
13012 | + if (key->ip.proto == IPPROTO_UDP) |
13013 | + src = udp_hdr(skb)->source; |
13014 | + else if (key->ip.proto == IPPROTO_TCP) |
13015 | + src = tcp_hdr(skb)->source; |
13016 | + else if (key->ip.proto == IPPROTO_SCTP) |
13017 | + src = sctp_hdr(skb)->source; |
13018 | + else |
13019 | + return; |
13020 | + |
13021 | + key->tp.src = src; |
13022 | + } else { |
13023 | + __be16 dst; |
13024 | + |
13025 | + key->ct_state |= OVS_CS_F_DST_NAT; |
13026 | + if (key->eth.type == htons(ETH_P_IP)) |
13027 | + key->ipv4.addr.dst = ip_hdr(skb)->daddr; |
13028 | + else if (key->eth.type == htons(ETH_P_IPV6)) |
13029 | + memcpy(&key->ipv6.addr.dst, &ipv6_hdr(skb)->daddr, |
13030 | + sizeof(key->ipv6.addr.dst)); |
13031 | + else |
13032 | + return; |
13033 | + |
13034 | + if (key->ip.proto == IPPROTO_UDP) |
13035 | + dst = udp_hdr(skb)->dest; |
13036 | + else if (key->ip.proto == IPPROTO_TCP) |
13037 | + dst = tcp_hdr(skb)->dest; |
13038 | + else if (key->ip.proto == IPPROTO_SCTP) |
13039 | + dst = sctp_hdr(skb)->dest; |
13040 | + else |
13041 | + return; |
13042 | + |
13043 | + key->tp.dst = dst; |
13044 | + } |
13045 | +} |
13046 | + |
13047 | /* Modelled after nf_nat_ipv[46]_fn(). |
13048 | * range is only used for new, uninitialized NAT state. |
13049 | * Returns either NF_ACCEPT or NF_DROP. |
13050 | @@ -737,7 +788,7 @@ static bool skb_nfct_cached(struct net *net, |
13051 | static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, |
13052 | enum ip_conntrack_info ctinfo, |
13053 | const struct nf_nat_range2 *range, |
13054 | - enum nf_nat_manip_type maniptype) |
13055 | + enum nf_nat_manip_type maniptype, struct sw_flow_key *key) |
13056 | { |
13057 | int hooknum, nh_off, err = NF_ACCEPT; |
13058 | |
13059 | @@ -810,58 +861,11 @@ push: |
13060 | skb_push(skb, nh_off); |
13061 | skb_postpush_rcsum(skb, skb->data, nh_off); |
13062 | |
13063 | - return err; |
13064 | -} |
13065 | - |
13066 | -static void ovs_nat_update_key(struct sw_flow_key *key, |
13067 | - const struct sk_buff *skb, |
13068 | - enum nf_nat_manip_type maniptype) |
13069 | -{ |
13070 | - if (maniptype == NF_NAT_MANIP_SRC) { |
13071 | - __be16 src; |
13072 | - |
13073 | - key->ct_state |= OVS_CS_F_SRC_NAT; |
13074 | - if (key->eth.type == htons(ETH_P_IP)) |
13075 | - key->ipv4.addr.src = ip_hdr(skb)->saddr; |
13076 | - else if (key->eth.type == htons(ETH_P_IPV6)) |
13077 | - memcpy(&key->ipv6.addr.src, &ipv6_hdr(skb)->saddr, |
13078 | - sizeof(key->ipv6.addr.src)); |
13079 | - else |
13080 | - return; |
13081 | - |
13082 | - if (key->ip.proto == IPPROTO_UDP) |
13083 | - src = udp_hdr(skb)->source; |
13084 | - else if (key->ip.proto == IPPROTO_TCP) |
13085 | - src = tcp_hdr(skb)->source; |
13086 | - else if (key->ip.proto == IPPROTO_SCTP) |
13087 | - src = sctp_hdr(skb)->source; |
13088 | - else |
13089 | - return; |
13090 | - |
13091 | - key->tp.src = src; |
13092 | - } else { |
13093 | - __be16 dst; |
13094 | - |
13095 | - key->ct_state |= OVS_CS_F_DST_NAT; |
13096 | - if (key->eth.type == htons(ETH_P_IP)) |
13097 | - key->ipv4.addr.dst = ip_hdr(skb)->daddr; |
13098 | - else if (key->eth.type == htons(ETH_P_IPV6)) |
13099 | - memcpy(&key->ipv6.addr.dst, &ipv6_hdr(skb)->daddr, |
13100 | - sizeof(key->ipv6.addr.dst)); |
13101 | - else |
13102 | - return; |
13103 | - |
13104 | - if (key->ip.proto == IPPROTO_UDP) |
13105 | - dst = udp_hdr(skb)->dest; |
13106 | - else if (key->ip.proto == IPPROTO_TCP) |
13107 | - dst = tcp_hdr(skb)->dest; |
13108 | - else if (key->ip.proto == IPPROTO_SCTP) |
13109 | - dst = sctp_hdr(skb)->dest; |
13110 | - else |
13111 | - return; |
13112 | + /* Update the flow key if NAT successful. */ |
13113 | + if (err == NF_ACCEPT) |
13114 | + ovs_nat_update_key(key, skb, maniptype); |
13115 | |
13116 | - key->tp.dst = dst; |
13117 | - } |
13118 | + return err; |
13119 | } |
13120 | |
13121 | /* Returns NF_DROP if the packet should be dropped, NF_ACCEPT otherwise. */ |
13122 | @@ -903,7 +907,7 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, |
13123 | } else { |
13124 | return NF_ACCEPT; /* Connection is not NATed. */ |
13125 | } |
13126 | - err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype); |
13127 | + err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype, key); |
13128 | |
13129 | if (err == NF_ACCEPT && ct->status & IPS_DST_NAT) { |
13130 | if (ct->status & IPS_SRC_NAT) { |
13131 | @@ -913,17 +917,13 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, |
13132 | maniptype = NF_NAT_MANIP_SRC; |
13133 | |
13134 | err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, |
13135 | - maniptype); |
13136 | + maniptype, key); |
13137 | } else if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) { |
13138 | err = ovs_ct_nat_execute(skb, ct, ctinfo, NULL, |
13139 | - NF_NAT_MANIP_SRC); |
13140 | + NF_NAT_MANIP_SRC, key); |
13141 | } |
13142 | } |
13143 | |
13144 | - /* Mark NAT done if successful and update the flow key. */ |
13145 | - if (err == NF_ACCEPT) |
13146 | - ovs_nat_update_key(key, skb, maniptype); |
13147 | - |
13148 | return err; |
13149 | } |
13150 | #else /* !CONFIG_NF_NAT */ |
13151 | diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c |
13152 | index d7559c64795dc..d3f068ad154cb 100644 |
13153 | --- a/net/openvswitch/flow_netlink.c |
13154 | +++ b/net/openvswitch/flow_netlink.c |
13155 | @@ -2179,8 +2179,8 @@ static int __ovs_nla_put_key(const struct sw_flow_key *swkey, |
13156 | icmpv6_key->icmpv6_type = ntohs(output->tp.src); |
13157 | icmpv6_key->icmpv6_code = ntohs(output->tp.dst); |
13158 | |
13159 | - if (icmpv6_key->icmpv6_type == NDISC_NEIGHBOUR_SOLICITATION || |
13160 | - icmpv6_key->icmpv6_type == NDISC_NEIGHBOUR_ADVERTISEMENT) { |
13161 | + if (swkey->tp.src == htons(NDISC_NEIGHBOUR_SOLICITATION) || |
13162 | + swkey->tp.src == htons(NDISC_NEIGHBOUR_ADVERTISEMENT)) { |
13163 | struct ovs_key_nd *nd_key; |
13164 | |
13165 | nla = nla_reserve(skb, OVS_KEY_ATTR_ND, sizeof(*nd_key)); |
13166 | @@ -3284,7 +3284,9 @@ static int clone_action_to_attr(const struct nlattr *attr, |
13167 | if (!start) |
13168 | return -EMSGSIZE; |
13169 | |
13170 | - err = ovs_nla_put_actions(nla_data(attr), rem, skb); |
13171 | + /* Skipping the OVS_CLONE_ATTR_EXEC that is always the first attribute. */ |
13172 | + attr = nla_next(nla_data(attr), &rem); |
13173 | + err = ovs_nla_put_actions(attr, rem, skb); |
13174 | |
13175 | if (err) |
13176 | nla_nest_cancel(skb, start); |
13177 | diff --git a/net/rxrpc/net_ns.c b/net/rxrpc/net_ns.c |
13178 | index b312aab80fed6..9a76b74af37bc 100644 |
13179 | --- a/net/rxrpc/net_ns.c |
13180 | +++ b/net/rxrpc/net_ns.c |
13181 | @@ -116,8 +116,8 @@ static __net_exit void rxrpc_exit_net(struct net *net) |
13182 | struct rxrpc_net *rxnet = rxrpc_net(net); |
13183 | |
13184 | rxnet->live = false; |
13185 | - del_timer_sync(&rxnet->peer_keepalive_timer); |
13186 | cancel_work_sync(&rxnet->peer_keepalive_work); |
13187 | + del_timer_sync(&rxnet->peer_keepalive_timer); |
13188 | rxrpc_destroy_all_calls(rxnet); |
13189 | rxrpc_destroy_all_connections(rxnet); |
13190 | rxrpc_destroy_all_peers(rxnet); |
13191 | diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c |
13192 | index 12672019f76c5..66cdfd5725acf 100644 |
13193 | --- a/net/smc/smc_core.c |
13194 | +++ b/net/smc/smc_core.c |
13195 | @@ -734,7 +734,7 @@ static struct smc_buf_desc *smc_buf_get_slot(int compressed_bufsize, |
13196 | */ |
13197 | static inline int smc_rmb_wnd_update_limit(int rmbe_size) |
13198 | { |
13199 | - return min_t(int, rmbe_size / 10, SOCK_MIN_SNDBUF / 2); |
13200 | + return max_t(int, rmbe_size / 10, SOCK_MIN_SNDBUF / 2); |
13201 | } |
13202 | |
13203 | static struct smc_buf_desc *smcr_new_buf_create(struct smc_link_group *lgr, |
13204 | diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c |
13205 | index b6039642df67e..08e1ccc01e983 100644 |
13206 | --- a/net/sunrpc/clnt.c |
13207 | +++ b/net/sunrpc/clnt.c |
13208 | @@ -2223,6 +2223,7 @@ call_transmit_status(struct rpc_task *task) |
13209 | * socket just returned a connection error, |
13210 | * then hold onto the transport lock. |
13211 | */ |
13212 | + case -ENOMEM: |
13213 | case -ENOBUFS: |
13214 | rpc_delay(task, HZ>>2); |
13215 | /* fall through */ |
13216 | @@ -2308,6 +2309,7 @@ call_bc_transmit_status(struct rpc_task *task) |
13217 | case -ENOTCONN: |
13218 | case -EPIPE: |
13219 | break; |
13220 | + case -ENOMEM: |
13221 | case -ENOBUFS: |
13222 | rpc_delay(task, HZ>>2); |
13223 | /* fall through */ |
13224 | @@ -2392,6 +2394,11 @@ call_status(struct rpc_task *task) |
13225 | case -EPIPE: |
13226 | case -EAGAIN: |
13227 | break; |
13228 | + case -ENFILE: |
13229 | + case -ENOBUFS: |
13230 | + case -ENOMEM: |
13231 | + rpc_delay(task, HZ>>2); |
13232 | + break; |
13233 | case -EIO: |
13234 | /* shutdown or soft timeout */ |
13235 | goto out_exit; |
13236 | diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
13237 | index 8fc4a6b3422f4..32ffa801a5b97 100644 |
13238 | --- a/net/sunrpc/sched.c |
13239 | +++ b/net/sunrpc/sched.c |
13240 | @@ -1039,8 +1039,10 @@ int rpc_malloc(struct rpc_task *task) |
13241 | struct rpc_buffer *buf; |
13242 | gfp_t gfp = GFP_NOFS; |
13243 | |
13244 | + if (RPC_IS_ASYNC(task)) |
13245 | + gfp = GFP_NOWAIT | __GFP_NOWARN; |
13246 | if (RPC_IS_SWAPPER(task)) |
13247 | - gfp = __GFP_MEMALLOC | GFP_NOWAIT | __GFP_NOWARN; |
13248 | + gfp |= __GFP_MEMALLOC; |
13249 | |
13250 | size += sizeof(struct rpc_buffer); |
13251 | if (size <= RPC_BUFFER_MAXSIZE) |
13252 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c |
13253 | index 93b6afd28405e..8ac579778e487 100644 |
13254 | --- a/net/sunrpc/xprt.c |
13255 | +++ b/net/sunrpc/xprt.c |
13256 | @@ -2006,7 +2006,14 @@ static void xprt_destroy(struct rpc_xprt *xprt) |
13257 | */ |
13258 | wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE); |
13259 | |
13260 | + /* |
13261 | + * xprt_schedule_autodisconnect() can run after XPRT_LOCKED |
13262 | + * is cleared. We use ->transport_lock to ensure the mod_timer() |
13263 | + * can only run *before* del_time_sync(), never after. |
13264 | + */ |
13265 | + spin_lock(&xprt->transport_lock); |
13266 | del_timer_sync(&xprt->timer); |
13267 | + spin_unlock(&xprt->transport_lock); |
13268 | |
13269 | /* |
13270 | * Destroy sockets etc from the system workqueue so they can |
13271 | diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c |
13272 | index 2f21e3c52bfc1..866bcd99bdc0e 100644 |
13273 | --- a/net/sunrpc/xprtrdma/transport.c |
13274 | +++ b/net/sunrpc/xprtrdma/transport.c |
13275 | @@ -626,8 +626,10 @@ xprt_rdma_allocate(struct rpc_task *task) |
13276 | gfp_t flags; |
13277 | |
13278 | flags = RPCRDMA_DEF_GFP; |
13279 | + if (RPC_IS_ASYNC(task)) |
13280 | + flags = GFP_NOWAIT | __GFP_NOWARN; |
13281 | if (RPC_IS_SWAPPER(task)) |
13282 | - flags = __GFP_MEMALLOC | GFP_NOWAIT | __GFP_NOWARN; |
13283 | + flags |= __GFP_MEMALLOC; |
13284 | |
13285 | if (!rpcrdma_check_regbuf(r_xprt, req->rl_sendbuf, rqst->rq_callsize, |
13286 | flags)) |
13287 | diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
13288 | index 8ffc54b6661f8..480e879e74ae5 100644 |
13289 | --- a/net/sunrpc/xprtsock.c |
13290 | +++ b/net/sunrpc/xprtsock.c |
13291 | @@ -872,12 +872,12 @@ out: |
13292 | /** |
13293 | * xs_nospace - handle transmit was incomplete |
13294 | * @req: pointer to RPC request |
13295 | + * @transport: pointer to struct sock_xprt |
13296 | * |
13297 | */ |
13298 | -static int xs_nospace(struct rpc_rqst *req) |
13299 | +static int xs_nospace(struct rpc_rqst *req, struct sock_xprt *transport) |
13300 | { |
13301 | - struct rpc_xprt *xprt = req->rq_xprt; |
13302 | - struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); |
13303 | + struct rpc_xprt *xprt = &transport->xprt; |
13304 | struct sock *sk = transport->inet; |
13305 | int ret = -EAGAIN; |
13306 | |
13307 | @@ -891,25 +891,49 @@ static int xs_nospace(struct rpc_rqst *req) |
13308 | |
13309 | /* Don't race with disconnect */ |
13310 | if (xprt_connected(xprt)) { |
13311 | + struct socket_wq *wq; |
13312 | + |
13313 | + rcu_read_lock(); |
13314 | + wq = rcu_dereference(sk->sk_wq); |
13315 | + set_bit(SOCKWQ_ASYNC_NOSPACE, &wq->flags); |
13316 | + rcu_read_unlock(); |
13317 | + |
13318 | /* wait for more buffer space */ |
13319 | + set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
13320 | sk->sk_write_pending++; |
13321 | xprt_wait_for_buffer_space(xprt); |
13322 | } else |
13323 | ret = -ENOTCONN; |
13324 | |
13325 | spin_unlock(&xprt->transport_lock); |
13326 | + return ret; |
13327 | +} |
13328 | |
13329 | - /* Race breaker in case memory is freed before above code is called */ |
13330 | - if (ret == -EAGAIN) { |
13331 | - struct socket_wq *wq; |
13332 | +static int xs_sock_nospace(struct rpc_rqst *req) |
13333 | +{ |
13334 | + struct sock_xprt *transport = |
13335 | + container_of(req->rq_xprt, struct sock_xprt, xprt); |
13336 | + struct sock *sk = transport->inet; |
13337 | + int ret = -EAGAIN; |
13338 | |
13339 | - rcu_read_lock(); |
13340 | - wq = rcu_dereference(sk->sk_wq); |
13341 | - set_bit(SOCKWQ_ASYNC_NOSPACE, &wq->flags); |
13342 | - rcu_read_unlock(); |
13343 | + lock_sock(sk); |
13344 | + if (!sock_writeable(sk)) |
13345 | + ret = xs_nospace(req, transport); |
13346 | + release_sock(sk); |
13347 | + return ret; |
13348 | +} |
13349 | |
13350 | - sk->sk_write_space(sk); |
13351 | - } |
13352 | +static int xs_stream_nospace(struct rpc_rqst *req) |
13353 | +{ |
13354 | + struct sock_xprt *transport = |
13355 | + container_of(req->rq_xprt, struct sock_xprt, xprt); |
13356 | + struct sock *sk = transport->inet; |
13357 | + int ret = -EAGAIN; |
13358 | + |
13359 | + lock_sock(sk); |
13360 | + if (!sk_stream_memory_free(sk)) |
13361 | + ret = xs_nospace(req, transport); |
13362 | + release_sock(sk); |
13363 | return ret; |
13364 | } |
13365 | |
13366 | @@ -996,7 +1020,7 @@ static int xs_local_send_request(struct rpc_rqst *req) |
13367 | case -ENOBUFS: |
13368 | break; |
13369 | case -EAGAIN: |
13370 | - status = xs_nospace(req); |
13371 | + status = xs_stream_nospace(req); |
13372 | break; |
13373 | default: |
13374 | dprintk("RPC: sendmsg returned unrecognized error %d\n", |
13375 | @@ -1068,7 +1092,7 @@ process_status: |
13376 | /* Should we call xs_close() here? */ |
13377 | break; |
13378 | case -EAGAIN: |
13379 | - status = xs_nospace(req); |
13380 | + status = xs_sock_nospace(req); |
13381 | break; |
13382 | case -ENETUNREACH: |
13383 | case -ENOBUFS: |
13384 | @@ -1181,7 +1205,7 @@ static int xs_tcp_send_request(struct rpc_rqst *req) |
13385 | /* Should we call xs_close() here? */ |
13386 | break; |
13387 | case -EAGAIN: |
13388 | - status = xs_nospace(req); |
13389 | + status = xs_stream_nospace(req); |
13390 | break; |
13391 | case -ECONNRESET: |
13392 | case -ECONNREFUSED: |
13393 | diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
13394 | index f4217673eee70..d543c4556df20 100644 |
13395 | --- a/net/tipc/socket.c |
13396 | +++ b/net/tipc/socket.c |
13397 | @@ -2698,7 +2698,8 @@ static void tipc_sk_retry_connect(struct sock *sk, struct sk_buff_head *list) |
13398 | |
13399 | /* Try again later if dest link is congested */ |
13400 | if (tsk->cong_link_cnt) { |
13401 | - sk_reset_timer(sk, &sk->sk_timer, msecs_to_jiffies(100)); |
13402 | + sk_reset_timer(sk, &sk->sk_timer, |
13403 | + jiffies + msecs_to_jiffies(100)); |
13404 | return; |
13405 | } |
13406 | /* Prepare SYN for retransmit */ |
13407 | diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c |
13408 | index 1436a36c1934a..af3be9a29d6db 100644 |
13409 | --- a/net/tls/tls_sw.c |
13410 | +++ b/net/tls/tls_sw.c |
13411 | @@ -1479,7 +1479,7 @@ static int decrypt_internal(struct sock *sk, struct sk_buff *skb, |
13412 | } |
13413 | if (prot->version == TLS_1_3_VERSION) |
13414 | memcpy(iv + iv_offset, tls_ctx->rx.iv, |
13415 | - crypto_aead_ivsize(ctx->aead_recv)); |
13416 | + prot->iv_size + prot->salt_size); |
13417 | else |
13418 | memcpy(iv + iv_offset, tls_ctx->rx.iv, prot->salt_size); |
13419 | |
13420 | diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c |
13421 | index d8d603aa48875..c94aa587e0c92 100644 |
13422 | --- a/net/x25/af_x25.c |
13423 | +++ b/net/x25/af_x25.c |
13424 | @@ -1767,10 +1767,15 @@ void x25_kill_by_neigh(struct x25_neigh *nb) |
13425 | |
13426 | write_lock_bh(&x25_list_lock); |
13427 | |
13428 | - sk_for_each(s, &x25_list) |
13429 | - if (x25_sk(s)->neighbour == nb) |
13430 | + sk_for_each(s, &x25_list) { |
13431 | + if (x25_sk(s)->neighbour == nb) { |
13432 | + write_unlock_bh(&x25_list_lock); |
13433 | + lock_sock(s); |
13434 | x25_disconnect(s, ENETUNREACH, 0, 0); |
13435 | - |
13436 | + release_sock(s); |
13437 | + write_lock_bh(&x25_list_lock); |
13438 | + } |
13439 | + } |
13440 | write_unlock_bh(&x25_list_lock); |
13441 | |
13442 | /* Remove any related forwards */ |
13443 | diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c |
13444 | index 3932d3aaff270..4cfa79e04e3d1 100644 |
13445 | --- a/net/xfrm/xfrm_interface.c |
13446 | +++ b/net/xfrm/xfrm_interface.c |
13447 | @@ -300,7 +300,10 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) |
13448 | if (mtu < IPV6_MIN_MTU) |
13449 | mtu = IPV6_MIN_MTU; |
13450 | |
13451 | - icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
13452 | + if (skb->len > 1280) |
13453 | + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
13454 | + else |
13455 | + goto xmit; |
13456 | } else { |
13457 | if (!(ip_hdr(skb)->frag_off & htons(IP_DF))) |
13458 | goto xmit; |
13459 | diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c |
13460 | index dbd37460c573e..f46abb315010d 100644 |
13461 | --- a/scripts/gcc-plugins/stackleak_plugin.c |
13462 | +++ b/scripts/gcc-plugins/stackleak_plugin.c |
13463 | @@ -262,6 +262,23 @@ static unsigned int stackleak_cleanup_execute(void) |
13464 | return 0; |
13465 | } |
13466 | |
13467 | +/* |
13468 | + * STRING_CST may or may not be NUL terminated: |
13469 | + * https://gcc.gnu.org/onlinedocs/gccint/Constant-expressions.html |
13470 | + */ |
13471 | +static inline bool string_equal(tree node, const char *string, int length) |
13472 | +{ |
13473 | + if (TREE_STRING_LENGTH(node) < length) |
13474 | + return false; |
13475 | + if (TREE_STRING_LENGTH(node) > length + 1) |
13476 | + return false; |
13477 | + if (TREE_STRING_LENGTH(node) == length + 1 && |
13478 | + TREE_STRING_POINTER(node)[length] != '\0') |
13479 | + return false; |
13480 | + return !memcmp(TREE_STRING_POINTER(node), string, length); |
13481 | +} |
13482 | +#define STRING_EQUAL(node, str) string_equal(node, str, strlen(str)) |
13483 | + |
13484 | static bool stackleak_gate(void) |
13485 | { |
13486 | tree section; |
13487 | @@ -271,13 +288,13 @@ static bool stackleak_gate(void) |
13488 | if (section && TREE_VALUE(section)) { |
13489 | section = TREE_VALUE(TREE_VALUE(section)); |
13490 | |
13491 | - if (!strncmp(TREE_STRING_POINTER(section), ".init.text", 10)) |
13492 | + if (STRING_EQUAL(section, ".init.text")) |
13493 | return false; |
13494 | - if (!strncmp(TREE_STRING_POINTER(section), ".devinit.text", 13)) |
13495 | + if (STRING_EQUAL(section, ".devinit.text")) |
13496 | return false; |
13497 | - if (!strncmp(TREE_STRING_POINTER(section), ".cpuinit.text", 13)) |
13498 | + if (STRING_EQUAL(section, ".cpuinit.text")) |
13499 | return false; |
13500 | - if (!strncmp(TREE_STRING_POINTER(section), ".meminit.text", 13)) |
13501 | + if (STRING_EQUAL(section, ".meminit.text")) |
13502 | return false; |
13503 | } |
13504 | |
13505 | diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c |
13506 | index 931d8dfb4a7f4..63e5c646f7620 100644 |
13507 | --- a/security/keys/keyctl_pkey.c |
13508 | +++ b/security/keys/keyctl_pkey.c |
13509 | @@ -135,15 +135,23 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par |
13510 | |
13511 | switch (op) { |
13512 | case KEYCTL_PKEY_ENCRYPT: |
13513 | + if (uparams.in_len > info.max_dec_size || |
13514 | + uparams.out_len > info.max_enc_size) |
13515 | + return -EINVAL; |
13516 | + break; |
13517 | case KEYCTL_PKEY_DECRYPT: |
13518 | if (uparams.in_len > info.max_enc_size || |
13519 | uparams.out_len > info.max_dec_size) |
13520 | return -EINVAL; |
13521 | break; |
13522 | case KEYCTL_PKEY_SIGN: |
13523 | + if (uparams.in_len > info.max_data_size || |
13524 | + uparams.out_len > info.max_sig_size) |
13525 | + return -EINVAL; |
13526 | + break; |
13527 | case KEYCTL_PKEY_VERIFY: |
13528 | - if (uparams.in_len > info.max_sig_size || |
13529 | - uparams.out_len > info.max_data_size) |
13530 | + if (uparams.in_len > info.max_data_size || |
13531 | + uparams.in2_len > info.max_sig_size) |
13532 | return -EINVAL; |
13533 | break; |
13534 | default: |
13535 | @@ -151,7 +159,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par |
13536 | } |
13537 | |
13538 | params->in_len = uparams.in_len; |
13539 | - params->out_len = uparams.out_len; |
13540 | + params->out_len = uparams.out_len; /* Note: same as in2_len */ |
13541 | return 0; |
13542 | } |
13543 | |
13544 | diff --git a/security/security.c b/security/security.c |
13545 | index c34ec4c7d98cc..f633717311a34 100644 |
13546 | --- a/security/security.c |
13547 | +++ b/security/security.c |
13548 | @@ -802,9 +802,22 @@ int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc) |
13549 | return call_int_hook(fs_context_dup, 0, fc, src_fc); |
13550 | } |
13551 | |
13552 | -int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) |
13553 | +int security_fs_context_parse_param(struct fs_context *fc, |
13554 | + struct fs_parameter *param) |
13555 | { |
13556 | - return call_int_hook(fs_context_parse_param, -ENOPARAM, fc, param); |
13557 | + struct security_hook_list *hp; |
13558 | + int trc; |
13559 | + int rc = -ENOPARAM; |
13560 | + |
13561 | + hlist_for_each_entry(hp, &security_hook_heads.fs_context_parse_param, |
13562 | + list) { |
13563 | + trc = hp->hook.fs_context_parse_param(fc, param); |
13564 | + if (trc == 0) |
13565 | + rc = 0; |
13566 | + else if (trc != -ENOPARAM) |
13567 | + return trc; |
13568 | + } |
13569 | + return rc; |
13570 | } |
13571 | |
13572 | int security_sb_alloc(struct super_block *sb) |
13573 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
13574 | index 56418cf72069d..d9f15c84aab7d 100644 |
13575 | --- a/security/selinux/hooks.c |
13576 | +++ b/security/selinux/hooks.c |
13577 | @@ -2855,10 +2855,9 @@ static int selinux_fs_context_parse_param(struct fs_context *fc, |
13578 | return opt; |
13579 | |
13580 | rc = selinux_add_opt(opt, param->string, &fc->security); |
13581 | - if (!rc) { |
13582 | + if (!rc) |
13583 | param->string = NULL; |
13584 | - rc = 1; |
13585 | - } |
13586 | + |
13587 | return rc; |
13588 | } |
13589 | |
13590 | diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c |
13591 | index 7314196185d15..00e95f8bd7c73 100644 |
13592 | --- a/security/selinux/xfrm.c |
13593 | +++ b/security/selinux/xfrm.c |
13594 | @@ -346,7 +346,7 @@ int selinux_xfrm_state_alloc_acquire(struct xfrm_state *x, |
13595 | int rc; |
13596 | struct xfrm_sec_ctx *ctx; |
13597 | char *ctx_str = NULL; |
13598 | - int str_len; |
13599 | + u32 str_len; |
13600 | |
13601 | if (!polsec) |
13602 | return 0; |
13603 | diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c |
13604 | index 12c0fa85d9f82..0253cd2e2358a 100644 |
13605 | --- a/security/smack/smack_lsm.c |
13606 | +++ b/security/smack/smack_lsm.c |
13607 | @@ -2501,7 +2501,7 @@ static int smk_ipv6_check(struct smack_known *subject, |
13608 | #ifdef CONFIG_AUDIT |
13609 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
13610 | ad.a.u.net->family = PF_INET6; |
13611 | - ad.a.u.net->dport = ntohs(address->sin6_port); |
13612 | + ad.a.u.net->dport = address->sin6_port; |
13613 | if (act == SMK_RECEIVING) |
13614 | ad.a.u.net->v6info.saddr = address->sin6_addr; |
13615 | else |
13616 | diff --git a/security/tomoyo/load_policy.c b/security/tomoyo/load_policy.c |
13617 | index 3445ae6fd4794..363b65be87ab7 100644 |
13618 | --- a/security/tomoyo/load_policy.c |
13619 | +++ b/security/tomoyo/load_policy.c |
13620 | @@ -24,7 +24,7 @@ static const char *tomoyo_loader; |
13621 | static int __init tomoyo_loader_setup(char *str) |
13622 | { |
13623 | tomoyo_loader = str; |
13624 | - return 0; |
13625 | + return 1; |
13626 | } |
13627 | |
13628 | __setup("TOMOYO_loader=", tomoyo_loader_setup); |
13629 | @@ -64,7 +64,7 @@ static const char *tomoyo_trigger; |
13630 | static int __init tomoyo_trigger_setup(char *str) |
13631 | { |
13632 | tomoyo_trigger = str; |
13633 | - return 0; |
13634 | + return 1; |
13635 | } |
13636 | |
13637 | __setup("TOMOYO_trigger=", tomoyo_trigger_setup); |
13638 | diff --git a/sound/firewire/fcp.c b/sound/firewire/fcp.c |
13639 | index bbfbebf4affbc..df44dd5dc4b22 100644 |
13640 | --- a/sound/firewire/fcp.c |
13641 | +++ b/sound/firewire/fcp.c |
13642 | @@ -240,9 +240,7 @@ int fcp_avc_transaction(struct fw_unit *unit, |
13643 | t.response_match_bytes = response_match_bytes; |
13644 | t.state = STATE_PENDING; |
13645 | init_waitqueue_head(&t.wait); |
13646 | - |
13647 | - if (*(const u8 *)command == 0x00 || *(const u8 *)command == 0x03) |
13648 | - t.deferrable = true; |
13649 | + t.deferrable = (*(const u8 *)command == 0x00 || *(const u8 *)command == 0x03); |
13650 | |
13651 | spin_lock_irq(&transactions_lock); |
13652 | list_add_tail(&t.list, &transactions); |
13653 | diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c |
13654 | index fa3c39cff5f85..9ee3a312c6793 100644 |
13655 | --- a/sound/isa/cs423x/cs4236.c |
13656 | +++ b/sound/isa/cs423x/cs4236.c |
13657 | @@ -544,7 +544,7 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, |
13658 | static int dev; |
13659 | int err; |
13660 | struct snd_card *card; |
13661 | - struct pnp_dev *cdev; |
13662 | + struct pnp_dev *cdev, *iter; |
13663 | char cid[PNP_ID_LEN]; |
13664 | |
13665 | if (pnp_device_is_isapnp(pdev)) |
13666 | @@ -560,9 +560,11 @@ static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, |
13667 | strcpy(cid, pdev->id[0].id); |
13668 | cid[5] = '1'; |
13669 | cdev = NULL; |
13670 | - list_for_each_entry(cdev, &(pdev->protocol->devices), protocol_list) { |
13671 | - if (!strcmp(cdev->id[0].id, cid)) |
13672 | + list_for_each_entry(iter, &(pdev->protocol->devices), protocol_list) { |
13673 | + if (!strcmp(iter->id[0].id, cid)) { |
13674 | + cdev = iter; |
13675 | break; |
13676 | + } |
13677 | } |
13678 | err = snd_cs423x_card_new(&pdev->dev, dev, &card); |
13679 | if (err < 0) |
13680 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
13681 | index d201043d661c1..05ca4196cb0fd 100644 |
13682 | --- a/sound/pci/hda/patch_realtek.c |
13683 | +++ b/sound/pci/hda/patch_realtek.c |
13684 | @@ -3557,8 +3557,8 @@ static void alc256_shutup(struct hda_codec *codec) |
13685 | /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly |
13686 | * when booting with headset plugged. So skip setting it for the codec alc257 |
13687 | */ |
13688 | - if (spec->codec_variant != ALC269_TYPE_ALC257 && |
13689 | - spec->codec_variant != ALC269_TYPE_ALC256) |
13690 | + if (codec->core.vendor_id != 0x10ec0236 && |
13691 | + codec->core.vendor_id != 0x10ec0257) |
13692 | alc_update_coef_idx(codec, 0x46, 0, 3 << 12); |
13693 | |
13694 | if (!spec->no_shutup_pins) |
13695 | @@ -6456,6 +6456,7 @@ enum { |
13696 | ALC285_FIXUP_HP_MUTE_LED, |
13697 | ALC236_FIXUP_HP_MUTE_LED, |
13698 | ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, |
13699 | + ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, |
13700 | ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, |
13701 | ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, |
13702 | ALC269VC_FIXUP_ACER_HEADSET_MIC, |
13703 | @@ -7740,6 +7741,14 @@ static const struct hda_fixup alc269_fixups[] = { |
13704 | { } |
13705 | }, |
13706 | }, |
13707 | + [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { |
13708 | + .type = HDA_FIXUP_VERBS, |
13709 | + .v.verbs = (const struct hda_verb[]) { |
13710 | + { 0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
13711 | + { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf}, |
13712 | + { } |
13713 | + }, |
13714 | + }, |
13715 | [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = { |
13716 | .type = HDA_FIXUP_PINS, |
13717 | .v.pins = (const struct hda_pintbl[]) { |
13718 | @@ -8217,6 +8226,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
13719 | SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), |
13720 | SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
13721 | SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
13722 | + SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
13723 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), |
13724 | SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), |
13725 | SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), |
13726 | @@ -8540,6 +8550,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { |
13727 | {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"}, |
13728 | {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, |
13729 | {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, |
13730 | + {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"}, |
13731 | {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"}, |
13732 | {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"}, |
13733 | {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, |
13734 | diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c |
13735 | index ca603397651c0..1e0973322cd00 100644 |
13736 | --- a/sound/soc/atmel/atmel_ssc_dai.c |
13737 | +++ b/sound/soc/atmel/atmel_ssc_dai.c |
13738 | @@ -280,7 +280,10 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream, |
13739 | |
13740 | /* Enable PMC peripheral clock for this SSC */ |
13741 | pr_debug("atmel_ssc_dai: Starting clock\n"); |
13742 | - clk_enable(ssc_p->ssc->clk); |
13743 | + ret = clk_enable(ssc_p->ssc->clk); |
13744 | + if (ret) |
13745 | + return ret; |
13746 | + |
13747 | ssc_p->mck_rate = clk_get_rate(ssc_p->ssc->clk); |
13748 | |
13749 | /* Reset the SSC unless initialized to keep it in a clean state */ |
13750 | diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c |
13751 | index b1bef2bf142dc..05277a88e20d8 100644 |
13752 | --- a/sound/soc/atmel/sam9g20_wm8731.c |
13753 | +++ b/sound/soc/atmel/sam9g20_wm8731.c |
13754 | @@ -214,6 +214,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) |
13755 | cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0); |
13756 | if (!cpu_np) { |
13757 | dev_err(&pdev->dev, "dai and pcm info missing\n"); |
13758 | + of_node_put(codec_np); |
13759 | return -EINVAL; |
13760 | } |
13761 | at91sam9g20ek_dai.cpus->of_node = cpu_np; |
13762 | diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig |
13763 | index 229cc89f8c5a5..466dc67799f4c 100644 |
13764 | --- a/sound/soc/codecs/Kconfig |
13765 | +++ b/sound/soc/codecs/Kconfig |
13766 | @@ -586,21 +586,26 @@ config SND_SOC_CS4349 |
13767 | |
13768 | config SND_SOC_CS47L15 |
13769 | tristate |
13770 | + depends on MFD_CS47L15 |
13771 | |
13772 | config SND_SOC_CS47L24 |
13773 | tristate |
13774 | |
13775 | config SND_SOC_CS47L35 |
13776 | tristate |
13777 | + depends on MFD_CS47L35 |
13778 | |
13779 | config SND_SOC_CS47L85 |
13780 | tristate |
13781 | + depends on MFD_CS47L85 |
13782 | |
13783 | config SND_SOC_CS47L90 |
13784 | tristate |
13785 | + depends on MFD_CS47L90 |
13786 | |
13787 | config SND_SOC_CS47L92 |
13788 | tristate |
13789 | + depends on MFD_CS47L92 |
13790 | |
13791 | # Cirrus Logic Quad-Channel ADC |
13792 | config SND_SOC_CS53L30 |
13793 | diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c |
13794 | index 337bddb7c2a49..5a8eedea6be03 100644 |
13795 | --- a/sound/soc/codecs/msm8916-wcd-analog.c |
13796 | +++ b/sound/soc/codecs/msm8916-wcd-analog.c |
13797 | @@ -1195,8 +1195,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
13798 | } |
13799 | |
13800 | irq = platform_get_irq_byname(pdev, "mbhc_switch_int"); |
13801 | - if (irq < 0) |
13802 | - return irq; |
13803 | + if (irq < 0) { |
13804 | + ret = irq; |
13805 | + goto err_disable_clk; |
13806 | + } |
13807 | |
13808 | ret = devm_request_threaded_irq(dev, irq, NULL, |
13809 | pm8916_mbhc_switch_irq_handler, |
13810 | @@ -1208,8 +1210,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
13811 | |
13812 | if (priv->mbhc_btn_enabled) { |
13813 | irq = platform_get_irq_byname(pdev, "mbhc_but_press_det"); |
13814 | - if (irq < 0) |
13815 | - return irq; |
13816 | + if (irq < 0) { |
13817 | + ret = irq; |
13818 | + goto err_disable_clk; |
13819 | + } |
13820 | |
13821 | ret = devm_request_threaded_irq(dev, irq, NULL, |
13822 | mbhc_btn_press_irq_handler, |
13823 | @@ -1220,8 +1224,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
13824 | dev_err(dev, "cannot request mbhc button press irq\n"); |
13825 | |
13826 | irq = platform_get_irq_byname(pdev, "mbhc_but_rel_det"); |
13827 | - if (irq < 0) |
13828 | - return irq; |
13829 | + if (irq < 0) { |
13830 | + ret = irq; |
13831 | + goto err_disable_clk; |
13832 | + } |
13833 | |
13834 | ret = devm_request_threaded_irq(dev, irq, NULL, |
13835 | mbhc_btn_release_irq_handler, |
13836 | @@ -1238,6 +1244,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) |
13837 | return devm_snd_soc_register_component(dev, &pm8916_wcd_analog, |
13838 | pm8916_wcd_analog_dai, |
13839 | ARRAY_SIZE(pm8916_wcd_analog_dai)); |
13840 | + |
13841 | +err_disable_clk: |
13842 | + clk_disable_unprepare(priv->mclk); |
13843 | + return ret; |
13844 | } |
13845 | |
13846 | static int pm8916_wcd_analog_spmi_remove(struct platform_device *pdev) |
13847 | diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c |
13848 | index 09fccacadd6b1..d5269ab5f91c5 100644 |
13849 | --- a/sound/soc/codecs/msm8916-wcd-digital.c |
13850 | +++ b/sound/soc/codecs/msm8916-wcd-digital.c |
13851 | @@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) |
13852 | ret = clk_prepare_enable(priv->mclk); |
13853 | if (ret < 0) { |
13854 | dev_err(dev, "failed to enable mclk %d\n", ret); |
13855 | - return ret; |
13856 | + goto err_clk; |
13857 | } |
13858 | |
13859 | dev_set_drvdata(dev, priv); |
13860 | @@ -1209,6 +1209,9 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) |
13861 | return devm_snd_soc_register_component(dev, &msm8916_wcd_digital, |
13862 | msm8916_wcd_digital_dai, |
13863 | ARRAY_SIZE(msm8916_wcd_digital_dai)); |
13864 | +err_clk: |
13865 | + clk_disable_unprepare(priv->ahbclk); |
13866 | + return ret; |
13867 | } |
13868 | |
13869 | static int msm8916_wcd_digital_remove(struct platform_device *pdev) |
13870 | diff --git a/sound/soc/codecs/mt6358.c b/sound/soc/codecs/mt6358.c |
13871 | index bb737fd678cc6..494ba0eeb4336 100644 |
13872 | --- a/sound/soc/codecs/mt6358.c |
13873 | +++ b/sound/soc/codecs/mt6358.c |
13874 | @@ -103,6 +103,7 @@ int mt6358_set_mtkaif_protocol(struct snd_soc_component *cmpnt, |
13875 | priv->mtkaif_protocol = mtkaif_protocol; |
13876 | return 0; |
13877 | } |
13878 | +EXPORT_SYMBOL_GPL(mt6358_set_mtkaif_protocol); |
13879 | |
13880 | static void playback_gpio_set(struct mt6358_priv *priv) |
13881 | { |
13882 | @@ -269,6 +270,7 @@ int mt6358_mtkaif_calibration_enable(struct snd_soc_component *cmpnt) |
13883 | 1 << RG_AUD_PAD_TOP_DAT_MISO_LOOPBACK_SFT); |
13884 | return 0; |
13885 | } |
13886 | +EXPORT_SYMBOL_GPL(mt6358_mtkaif_calibration_enable); |
13887 | |
13888 | int mt6358_mtkaif_calibration_disable(struct snd_soc_component *cmpnt) |
13889 | { |
13890 | @@ -292,6 +294,7 @@ int mt6358_mtkaif_calibration_disable(struct snd_soc_component *cmpnt) |
13891 | capture_gpio_reset(priv); |
13892 | return 0; |
13893 | } |
13894 | +EXPORT_SYMBOL_GPL(mt6358_mtkaif_calibration_disable); |
13895 | |
13896 | int mt6358_set_mtkaif_calibration_phase(struct snd_soc_component *cmpnt, |
13897 | int phase_1, int phase_2) |
13898 | @@ -306,6 +309,7 @@ int mt6358_set_mtkaif_calibration_phase(struct snd_soc_component *cmpnt, |
13899 | phase_2 << RG_AUD_PAD_TOP_PHASE_MODE2_SFT); |
13900 | return 0; |
13901 | } |
13902 | +EXPORT_SYMBOL_GPL(mt6358_set_mtkaif_calibration_phase); |
13903 | |
13904 | /* dl pga gain */ |
13905 | enum { |
13906 | diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c |
13907 | index 3610be1590fcc..19e2f622718d6 100644 |
13908 | --- a/sound/soc/codecs/rt5663.c |
13909 | +++ b/sound/soc/codecs/rt5663.c |
13910 | @@ -3478,6 +3478,8 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) |
13911 | table_size = sizeof(struct impedance_mapping_table) * |
13912 | rt5663->pdata.impedance_sensing_num; |
13913 | rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); |
13914 | + if (!rt5663->imp_table) |
13915 | + return -ENOMEM; |
13916 | ret = device_property_read_u32_array(dev, |
13917 | "realtek,impedance_sensing_table", |
13918 | (u32 *)rt5663->imp_table, table_size); |
13919 | diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c |
13920 | index fe99584c917f8..9cd91bb0a9022 100644 |
13921 | --- a/sound/soc/codecs/wm8350.c |
13922 | +++ b/sound/soc/codecs/wm8350.c |
13923 | @@ -1535,18 +1535,38 @@ static int wm8350_component_probe(struct snd_soc_component *component) |
13924 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, |
13925 | WM8350_JDL_ENA | WM8350_JDR_ENA); |
13926 | |
13927 | - wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, |
13928 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, |
13929 | wm8350_hpl_jack_handler, 0, "Left jack detect", |
13930 | priv); |
13931 | - wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, |
13932 | + if (ret != 0) |
13933 | + goto err; |
13934 | + |
13935 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, |
13936 | wm8350_hpr_jack_handler, 0, "Right jack detect", |
13937 | priv); |
13938 | - wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICSCD, |
13939 | + if (ret != 0) |
13940 | + goto free_jck_det_l; |
13941 | + |
13942 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICSCD, |
13943 | wm8350_mic_handler, 0, "Microphone short", priv); |
13944 | - wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICD, |
13945 | + if (ret != 0) |
13946 | + goto free_jck_det_r; |
13947 | + |
13948 | + ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICD, |
13949 | wm8350_mic_handler, 0, "Microphone detect", priv); |
13950 | + if (ret != 0) |
13951 | + goto free_micscd; |
13952 | |
13953 | return 0; |
13954 | + |
13955 | +free_micscd: |
13956 | + wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_MICSCD, priv); |
13957 | +free_jck_det_r: |
13958 | + wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R, priv); |
13959 | +free_jck_det_l: |
13960 | + wm8350_free_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_L, priv); |
13961 | +err: |
13962 | + return ret; |
13963 | } |
13964 | |
13965 | static void wm8350_component_remove(struct snd_soc_component *component) |
13966 | diff --git a/sound/soc/fsl/imx-es8328.c b/sound/soc/fsl/imx-es8328.c |
13967 | index fad1eb6253d53..9e602c3456196 100644 |
13968 | --- a/sound/soc/fsl/imx-es8328.c |
13969 | +++ b/sound/soc/fsl/imx-es8328.c |
13970 | @@ -87,6 +87,7 @@ static int imx_es8328_probe(struct platform_device *pdev) |
13971 | if (int_port > MUX_PORT_MAX || int_port == 0) { |
13972 | dev_err(dev, "mux-int-port: hardware only has %d mux ports\n", |
13973 | MUX_PORT_MAX); |
13974 | + ret = -EINVAL; |
13975 | goto fail; |
13976 | } |
13977 | |
13978 | diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c |
13979 | index 1e38ce8583262..cb1b525cbe9de 100644 |
13980 | --- a/sound/soc/mxs/mxs-saif.c |
13981 | +++ b/sound/soc/mxs/mxs-saif.c |
13982 | @@ -455,7 +455,10 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream, |
13983 | * basic clock which should be fast enough for the internal |
13984 | * logic. |
13985 | */ |
13986 | - clk_enable(saif->clk); |
13987 | + ret = clk_enable(saif->clk); |
13988 | + if (ret) |
13989 | + return ret; |
13990 | + |
13991 | ret = clk_set_rate(saif->clk, 24000000); |
13992 | clk_disable(saif->clk); |
13993 | if (ret) |
13994 | diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c |
13995 | index 9841e1da97826..8282fe6d00dd4 100644 |
13996 | --- a/sound/soc/mxs/mxs-sgtl5000.c |
13997 | +++ b/sound/soc/mxs/mxs-sgtl5000.c |
13998 | @@ -118,6 +118,9 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev) |
13999 | codec_np = of_parse_phandle(np, "audio-codec", 0); |
14000 | if (!saif_np[0] || !saif_np[1] || !codec_np) { |
14001 | dev_err(&pdev->dev, "phandle missing or invalid\n"); |
14002 | + of_node_put(codec_np); |
14003 | + of_node_put(saif_np[0]); |
14004 | + of_node_put(saif_np[1]); |
14005 | return -EINVAL; |
14006 | } |
14007 | |
14008 | diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c |
14009 | index 3447dbdba1f17..6ac7df30a2890 100644 |
14010 | --- a/sound/soc/sh/fsi.c |
14011 | +++ b/sound/soc/sh/fsi.c |
14012 | @@ -816,14 +816,27 @@ static int fsi_clk_enable(struct device *dev, |
14013 | return ret; |
14014 | } |
14015 | |
14016 | - clk_enable(clock->xck); |
14017 | - clk_enable(clock->ick); |
14018 | - clk_enable(clock->div); |
14019 | + ret = clk_enable(clock->xck); |
14020 | + if (ret) |
14021 | + goto err; |
14022 | + ret = clk_enable(clock->ick); |
14023 | + if (ret) |
14024 | + goto disable_xck; |
14025 | + ret = clk_enable(clock->div); |
14026 | + if (ret) |
14027 | + goto disable_ick; |
14028 | |
14029 | clock->count++; |
14030 | } |
14031 | |
14032 | return ret; |
14033 | + |
14034 | +disable_ick: |
14035 | + clk_disable(clock->ick); |
14036 | +disable_xck: |
14037 | + clk_disable(clock->xck); |
14038 | +err: |
14039 | + return ret; |
14040 | } |
14041 | |
14042 | static int fsi_clk_disable(struct device *dev, |
14043 | diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c |
14044 | index 9e54d8ae6d2cf..da6e40aef7b6e 100644 |
14045 | --- a/sound/soc/soc-compress.c |
14046 | +++ b/sound/soc/soc-compress.c |
14047 | @@ -871,6 +871,11 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) |
14048 | return -EINVAL; |
14049 | } |
14050 | |
14051 | + if (!codec_dai) { |
14052 | + dev_err(rtd->card->dev, "Missing codec\n"); |
14053 | + return -EINVAL; |
14054 | + } |
14055 | + |
14056 | /* check client and interface hw capabilities */ |
14057 | if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && |
14058 | snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) |
14059 | diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
14060 | index c0e03cc8ea822..093ab32ea2c3a 100644 |
14061 | --- a/sound/soc/soc-core.c |
14062 | +++ b/sound/soc/soc-core.c |
14063 | @@ -3362,7 +3362,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args, |
14064 | for_each_component(pos) { |
14065 | component_of_node = soc_component_to_node(pos); |
14066 | |
14067 | - if (component_of_node != args->np) |
14068 | + if (component_of_node != args->np || !pos->num_dai) |
14069 | continue; |
14070 | |
14071 | ret = snd_soc_component_of_xlate_dai_name(pos, args, dai_name); |
14072 | diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c |
14073 | index 5552c66ca6422..ca4b17bd95d14 100644 |
14074 | --- a/sound/soc/soc-generic-dmaengine-pcm.c |
14075 | +++ b/sound/soc/soc-generic-dmaengine-pcm.c |
14076 | @@ -91,10 +91,10 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream, |
14077 | |
14078 | memset(&slave_config, 0, sizeof(slave_config)); |
14079 | |
14080 | - if (!pcm->config) |
14081 | - prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
14082 | - else |
14083 | + if (pcm->config && pcm->config->prepare_slave_config) |
14084 | prepare_slave_config = pcm->config->prepare_slave_config; |
14085 | + else |
14086 | + prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
14087 | |
14088 | if (prepare_slave_config) { |
14089 | ret = prepare_slave_config(substream, params, &slave_config); |
14090 | diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c |
14091 | index 21f859e56b700..870b002293535 100644 |
14092 | --- a/sound/soc/soc-topology.c |
14093 | +++ b/sound/soc/soc-topology.c |
14094 | @@ -587,7 +587,8 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, |
14095 | |
14096 | if (le32_to_cpu(hdr->ops.info) == SND_SOC_TPLG_CTL_BYTES |
14097 | && k->iface & SNDRV_CTL_ELEM_IFACE_MIXER |
14098 | - && k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE |
14099 | + && (k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ |
14100 | + || k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) |
14101 | && k->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { |
14102 | struct soc_bytes_ext *sbe; |
14103 | struct snd_soc_tplg_bytes_control *be; |
14104 | diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c |
14105 | index 356bb134ae93a..7573f3f9f0f21 100644 |
14106 | --- a/sound/soc/sof/intel/hda-loader.c |
14107 | +++ b/sound/soc/sof/intel/hda-loader.c |
14108 | @@ -50,7 +50,7 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format, |
14109 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, &pci->dev, size, dmab); |
14110 | if (ret < 0) { |
14111 | dev_err(sdev->dev, "error: memory alloc failed: %x\n", ret); |
14112 | - goto error; |
14113 | + goto out_put; |
14114 | } |
14115 | |
14116 | hstream->period_bytes = 0;/* initialize period_bytes */ |
14117 | @@ -60,16 +60,17 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format, |
14118 | ret = hda_dsp_stream_hw_params(sdev, dsp_stream, dmab, NULL); |
14119 | if (ret < 0) { |
14120 | dev_err(sdev->dev, "error: hdac prepare failed: %x\n", ret); |
14121 | - goto error; |
14122 | + goto out_free; |
14123 | } |
14124 | |
14125 | hda_dsp_stream_spib_config(sdev, dsp_stream, HDA_DSP_SPIB_ENABLE, size); |
14126 | |
14127 | return hstream->stream_tag; |
14128 | |
14129 | -error: |
14130 | - hda_dsp_stream_put(sdev, direction, hstream->stream_tag); |
14131 | +out_free: |
14132 | snd_dma_free_pages(dmab); |
14133 | +out_put: |
14134 | + hda_dsp_stream_put(sdev, direction, hstream->stream_tag); |
14135 | return ret; |
14136 | } |
14137 | |
14138 | diff --git a/sound/soc/ti/davinci-i2s.c b/sound/soc/ti/davinci-i2s.c |
14139 | index d89b5c928c4d7..b2b2dcdb05d4c 100644 |
14140 | --- a/sound/soc/ti/davinci-i2s.c |
14141 | +++ b/sound/soc/ti/davinci-i2s.c |
14142 | @@ -708,7 +708,9 @@ static int davinci_i2s_probe(struct platform_device *pdev) |
14143 | dev->clk = clk_get(&pdev->dev, NULL); |
14144 | if (IS_ERR(dev->clk)) |
14145 | return -ENODEV; |
14146 | - clk_enable(dev->clk); |
14147 | + ret = clk_enable(dev->clk); |
14148 | + if (ret) |
14149 | + goto err_put_clk; |
14150 | |
14151 | dev->dev = &pdev->dev; |
14152 | dev_set_drvdata(&pdev->dev, dev); |
14153 | @@ -730,6 +732,7 @@ err_unregister_component: |
14154 | snd_soc_unregister_component(&pdev->dev); |
14155 | err_release_clk: |
14156 | clk_disable(dev->clk); |
14157 | +err_put_clk: |
14158 | clk_put(dev->clk); |
14159 | return ret; |
14160 | } |
14161 | diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c |
14162 | index 4de1ba9a418d9..6e5d315bab59b 100644 |
14163 | --- a/sound/spi/at73c213.c |
14164 | +++ b/sound/spi/at73c213.c |
14165 | @@ -218,7 +218,9 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream) |
14166 | runtime->hw = snd_at73c213_playback_hw; |
14167 | chip->substream = substream; |
14168 | |
14169 | - clk_enable(chip->ssc->clk); |
14170 | + err = clk_enable(chip->ssc->clk); |
14171 | + if (err) |
14172 | + return err; |
14173 | |
14174 | return 0; |
14175 | } |
14176 | @@ -784,7 +786,9 @@ static int snd_at73c213_chip_init(struct snd_at73c213 *chip) |
14177 | goto out; |
14178 | |
14179 | /* Enable DAC master clock. */ |
14180 | - clk_enable(chip->board->dac_clk); |
14181 | + retval = clk_enable(chip->board->dac_clk); |
14182 | + if (retval) |
14183 | + goto out; |
14184 | |
14185 | /* Initialize at73c213 on SPI bus. */ |
14186 | retval = snd_at73c213_write_reg(chip, DAC_RST, 0x04); |
14187 | @@ -897,7 +901,9 @@ static int snd_at73c213_dev_init(struct snd_card *card, |
14188 | chip->card = card; |
14189 | chip->irq = -1; |
14190 | |
14191 | - clk_enable(chip->ssc->clk); |
14192 | + retval = clk_enable(chip->ssc->clk); |
14193 | + if (retval) |
14194 | + return retval; |
14195 | |
14196 | retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip); |
14197 | if (retval) { |
14198 | @@ -1016,7 +1022,9 @@ static int snd_at73c213_remove(struct spi_device *spi) |
14199 | int retval; |
14200 | |
14201 | /* Stop playback. */ |
14202 | - clk_enable(chip->ssc->clk); |
14203 | + retval = clk_enable(chip->ssc->clk); |
14204 | + if (retval) |
14205 | + goto out; |
14206 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS)); |
14207 | clk_disable(chip->ssc->clk); |
14208 | |
14209 | @@ -1096,9 +1104,16 @@ static int snd_at73c213_resume(struct device *dev) |
14210 | { |
14211 | struct snd_card *card = dev_get_drvdata(dev); |
14212 | struct snd_at73c213 *chip = card->private_data; |
14213 | + int retval; |
14214 | |
14215 | - clk_enable(chip->board->dac_clk); |
14216 | - clk_enable(chip->ssc->clk); |
14217 | + retval = clk_enable(chip->board->dac_clk); |
14218 | + if (retval) |
14219 | + return retval; |
14220 | + retval = clk_enable(chip->ssc->clk); |
14221 | + if (retval) { |
14222 | + clk_disable(chip->board->dac_clk); |
14223 | + return retval; |
14224 | + } |
14225 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN)); |
14226 | |
14227 | return 0; |
14228 | diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile |
14229 | index 2a261b909dd8d..88392219d425e 100644 |
14230 | --- a/tools/build/feature/Makefile |
14231 | +++ b/tools/build/feature/Makefile |
14232 | @@ -204,9 +204,16 @@ strip-libs = $(filter-out -l%,$(1)) |
14233 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
14234 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) |
14235 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
14236 | -PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` |
14237 | +PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) |
14238 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
14239 | |
14240 | +ifeq ($(CC_NO_CLANG), 0) |
14241 | + PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) |
14242 | + PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) |
14243 | + PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) |
14244 | + FLAGS_PERL_EMBED += -Wno-compound-token-split-by-macro |
14245 | +endif |
14246 | + |
14247 | $(OUTPUT)test-libperl.bin: |
14248 | $(BUILD) $(FLAGS_PERL_EMBED) |
14249 | |
14250 | diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h |
14251 | index 63038eb23560b..0bfad86ec960a 100644 |
14252 | --- a/tools/include/uapi/linux/bpf.h |
14253 | +++ b/tools/include/uapi/linux/bpf.h |
14254 | @@ -1294,8 +1294,8 @@ union bpf_attr { |
14255 | * Return |
14256 | * The return value depends on the result of the test, and can be: |
14257 | * |
14258 | - * * 0, if current task belongs to the cgroup2. |
14259 | - * * 1, if current task does not belong to the cgroup2. |
14260 | + * * 1, if current task belongs to the cgroup2. |
14261 | + * * 0, if current task does not belong to the cgroup2. |
14262 | * * A negative error code, if an error occurred. |
14263 | * |
14264 | * int bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags) |
14265 | diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c |
14266 | index b2fc452504501..a1176a9e8430a 100644 |
14267 | --- a/tools/lib/bpf/btf_dump.c |
14268 | +++ b/tools/lib/bpf/btf_dump.c |
14269 | @@ -1366,6 +1366,11 @@ static const char *btf_dump_resolve_name(struct btf_dump *d, __u32 id, |
14270 | if (s->name_resolved) |
14271 | return *cached_name ? *cached_name : orig_name; |
14272 | |
14273 | + if (btf_is_fwd(t) || (btf_is_enum(t) && btf_vlen(t) == 0)) { |
14274 | + s->name_resolved = 1; |
14275 | + return orig_name; |
14276 | + } |
14277 | + |
14278 | dup_cnt = btf_dump_name_dups(d, name_map, orig_name); |
14279 | if (dup_cnt > 1) { |
14280 | const size_t max_len = 256; |
14281 | diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config |
14282 | index 7578af2504549..b94d9afad3f79 100644 |
14283 | --- a/tools/perf/Makefile.config |
14284 | +++ b/tools/perf/Makefile.config |
14285 | @@ -706,6 +706,9 @@ else |
14286 | LDFLAGS += $(PERL_EMBED_LDFLAGS) |
14287 | EXTLIBS += $(PERL_EMBED_LIBADD) |
14288 | CFLAGS += -DHAVE_LIBPERL_SUPPORT |
14289 | + ifeq ($(CC_NO_CLANG), 0) |
14290 | + CFLAGS += -Wno-compound-token-split-by-macro |
14291 | + endif |
14292 | $(call detected,CONFIG_LIBPERL) |
14293 | endif |
14294 | endif |
14295 | diff --git a/tools/perf/perf.c b/tools/perf/perf.c |
14296 | index 27f94b0bb8747..505e2a2f1872b 100644 |
14297 | --- a/tools/perf/perf.c |
14298 | +++ b/tools/perf/perf.c |
14299 | @@ -433,7 +433,7 @@ void pthread__unblock_sigwinch(void) |
14300 | static int libperf_print(enum libperf_print_level level, |
14301 | const char *fmt, va_list ap) |
14302 | { |
14303 | - return eprintf(level, verbose, fmt, ap); |
14304 | + return veprintf(level, verbose, fmt, ap); |
14305 | } |
14306 | |
14307 | int main(int argc, const char **argv) |
14308 | diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c |
14309 | index 8ff2c98e90322..01e15b445cb58 100644 |
14310 | --- a/tools/perf/util/session.c |
14311 | +++ b/tools/perf/util/session.c |
14312 | @@ -1960,6 +1960,7 @@ prefetch_event(char *buf, u64 head, size_t mmap_size, |
14313 | bool needs_swap, union perf_event *error) |
14314 | { |
14315 | union perf_event *event; |
14316 | + u16 event_size; |
14317 | |
14318 | /* |
14319 | * Ensure we have enough space remaining to read |
14320 | @@ -1972,15 +1973,23 @@ prefetch_event(char *buf, u64 head, size_t mmap_size, |
14321 | if (needs_swap) |
14322 | perf_event_header__bswap(&event->header); |
14323 | |
14324 | - if (head + event->header.size <= mmap_size) |
14325 | + event_size = event->header.size; |
14326 | + if (head + event_size <= mmap_size) |
14327 | return event; |
14328 | |
14329 | /* We're not fetching the event so swap back again */ |
14330 | if (needs_swap) |
14331 | perf_event_header__bswap(&event->header); |
14332 | |
14333 | - pr_debug("%s: head=%#" PRIx64 " event->header_size=%#x, mmap_size=%#zx:" |
14334 | - " fuzzed or compressed perf.data?\n",__func__, head, event->header.size, mmap_size); |
14335 | + /* Check if the event fits into the next mmapped buf. */ |
14336 | + if (event_size <= mmap_size - head % page_size) { |
14337 | + /* Remap buf and fetch again. */ |
14338 | + return NULL; |
14339 | + } |
14340 | + |
14341 | + /* Invalid input. Event size should never exceed mmap_size. */ |
14342 | + pr_debug("%s: head=%#" PRIx64 " event->header.size=%#x, mmap_size=%#zx:" |
14343 | + " fuzzed or compressed perf.data?\n", __func__, head, event_size, mmap_size); |
14344 | |
14345 | return error; |
14346 | } |
14347 | diff --git a/tools/testing/selftests/bpf/test_lirc_mode2.sh b/tools/testing/selftests/bpf/test_lirc_mode2.sh |
14348 | index ec4e15948e406..5252b91f48a18 100755 |
14349 | --- a/tools/testing/selftests/bpf/test_lirc_mode2.sh |
14350 | +++ b/tools/testing/selftests/bpf/test_lirc_mode2.sh |
14351 | @@ -3,6 +3,7 @@ |
14352 | |
14353 | # Kselftest framework requirement - SKIP code is 4. |
14354 | ksft_skip=4 |
14355 | +ret=$ksft_skip |
14356 | |
14357 | msg="skip all tests:" |
14358 | if [ $UID != 0 ]; then |
14359 | @@ -25,7 +26,7 @@ do |
14360 | fi |
14361 | done |
14362 | |
14363 | -if [ -n $LIRCDEV ]; |
14364 | +if [ -n "$LIRCDEV" ]; |
14365 | then |
14366 | TYPE=lirc_mode2 |
14367 | ./test_lirc_mode2_user $LIRCDEV $INPUTDEV |
14368 | @@ -36,3 +37,5 @@ then |
14369 | echo -e ${GREEN}"PASS: $TYPE"${NC} |
14370 | fi |
14371 | fi |
14372 | + |
14373 | +exit $ret |
14374 | diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
14375 | index b497bb85b667f..6c69c42b1d607 100755 |
14376 | --- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
14377 | +++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
14378 | @@ -120,6 +120,14 @@ setup() |
14379 | ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 |
14380 | ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 |
14381 | |
14382 | + # disable IPv6 DAD because it sometimes takes too long and fails tests |
14383 | + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.all.accept_dad=0 |
14384 | + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.all.accept_dad=0 |
14385 | + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.all.accept_dad=0 |
14386 | + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.default.accept_dad=0 |
14387 | + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.default.accept_dad=0 |
14388 | + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.default.accept_dad=0 |
14389 | + |
14390 | ip link add veth1 type veth peer name veth2 |
14391 | ip link add veth3 type veth peer name veth4 |
14392 | ip link add veth5 type veth peer name veth6 |
14393 | @@ -289,7 +297,7 @@ test_ping() |
14394 | ip netns exec ${NS1} ping -c 1 -W 1 -I veth1 ${IPv4_DST} 2>&1 > /dev/null |
14395 | RET=$? |
14396 | elif [ "${PROTO}" == "IPv6" ] ; then |
14397 | - ip netns exec ${NS1} ping6 -c 1 -W 6 -I veth1 ${IPv6_DST} 2>&1 > /dev/null |
14398 | + ip netns exec ${NS1} ping6 -c 1 -W 1 -I veth1 ${IPv6_DST} 2>&1 > /dev/null |
14399 | RET=$? |
14400 | else |
14401 | echo " test_ping: unknown PROTO: ${PROTO}" |
14402 | diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c |
14403 | index 5e939ff1e3f95..819f3480a6f71 100644 |
14404 | --- a/tools/testing/selftests/cgroup/cgroup_util.c |
14405 | +++ b/tools/testing/selftests/cgroup/cgroup_util.c |
14406 | @@ -202,7 +202,7 @@ int cg_find_unified_root(char *root, size_t len) |
14407 | |
14408 | int cg_create(const char *cgroup) |
14409 | { |
14410 | - return mkdir(cgroup, 0644); |
14411 | + return mkdir(cgroup, 0755); |
14412 | } |
14413 | |
14414 | int cg_wait_for_proc_count(const char *cgroup, int count) |
14415 | diff --git a/tools/testing/selftests/cgroup/test_core.c b/tools/testing/selftests/cgroup/test_core.c |
14416 | index 79053a4f47838..599234c5e496c 100644 |
14417 | --- a/tools/testing/selftests/cgroup/test_core.c |
14418 | +++ b/tools/testing/selftests/cgroup/test_core.c |
14419 | @@ -1,8 +1,13 @@ |
14420 | /* SPDX-License-Identifier: GPL-2.0 */ |
14421 | |
14422 | +#define _GNU_SOURCE |
14423 | #include <linux/limits.h> |
14424 | +#include <linux/sched.h> |
14425 | #include <sys/types.h> |
14426 | +#include <sys/wait.h> |
14427 | #include <unistd.h> |
14428 | +#include <fcntl.h> |
14429 | +#include <sched.h> |
14430 | #include <stdio.h> |
14431 | #include <errno.h> |
14432 | |
14433 | @@ -354,6 +359,166 @@ cleanup: |
14434 | return ret; |
14435 | } |
14436 | |
14437 | +/* |
14438 | + * cgroup migration permission check should be performed based on the |
14439 | + * credentials at the time of open instead of write. |
14440 | + */ |
14441 | +static int test_cgcore_lesser_euid_open(const char *root) |
14442 | +{ |
14443 | + const uid_t test_euid = 65534; /* usually nobody, any !root is fine */ |
14444 | + int ret = KSFT_FAIL; |
14445 | + char *cg_test_a = NULL, *cg_test_b = NULL; |
14446 | + char *cg_test_a_procs = NULL, *cg_test_b_procs = NULL; |
14447 | + int cg_test_b_procs_fd = -1; |
14448 | + uid_t saved_uid; |
14449 | + |
14450 | + cg_test_a = cg_name(root, "cg_test_a"); |
14451 | + cg_test_b = cg_name(root, "cg_test_b"); |
14452 | + |
14453 | + if (!cg_test_a || !cg_test_b) |
14454 | + goto cleanup; |
14455 | + |
14456 | + cg_test_a_procs = cg_name(cg_test_a, "cgroup.procs"); |
14457 | + cg_test_b_procs = cg_name(cg_test_b, "cgroup.procs"); |
14458 | + |
14459 | + if (!cg_test_a_procs || !cg_test_b_procs) |
14460 | + goto cleanup; |
14461 | + |
14462 | + if (cg_create(cg_test_a) || cg_create(cg_test_b)) |
14463 | + goto cleanup; |
14464 | + |
14465 | + if (cg_enter_current(cg_test_a)) |
14466 | + goto cleanup; |
14467 | + |
14468 | + if (chown(cg_test_a_procs, test_euid, -1) || |
14469 | + chown(cg_test_b_procs, test_euid, -1)) |
14470 | + goto cleanup; |
14471 | + |
14472 | + saved_uid = geteuid(); |
14473 | + if (seteuid(test_euid)) |
14474 | + goto cleanup; |
14475 | + |
14476 | + cg_test_b_procs_fd = open(cg_test_b_procs, O_RDWR); |
14477 | + |
14478 | + if (seteuid(saved_uid)) |
14479 | + goto cleanup; |
14480 | + |
14481 | + if (cg_test_b_procs_fd < 0) |
14482 | + goto cleanup; |
14483 | + |
14484 | + if (write(cg_test_b_procs_fd, "0", 1) >= 0 || errno != EACCES) |
14485 | + goto cleanup; |
14486 | + |
14487 | + ret = KSFT_PASS; |
14488 | + |
14489 | +cleanup: |
14490 | + cg_enter_current(root); |
14491 | + if (cg_test_b_procs_fd >= 0) |
14492 | + close(cg_test_b_procs_fd); |
14493 | + if (cg_test_b) |
14494 | + cg_destroy(cg_test_b); |
14495 | + if (cg_test_a) |
14496 | + cg_destroy(cg_test_a); |
14497 | + free(cg_test_b_procs); |
14498 | + free(cg_test_a_procs); |
14499 | + free(cg_test_b); |
14500 | + free(cg_test_a); |
14501 | + return ret; |
14502 | +} |
14503 | + |
14504 | +struct lesser_ns_open_thread_arg { |
14505 | + const char *path; |
14506 | + int fd; |
14507 | + int err; |
14508 | +}; |
14509 | + |
14510 | +static int lesser_ns_open_thread_fn(void *arg) |
14511 | +{ |
14512 | + struct lesser_ns_open_thread_arg *targ = arg; |
14513 | + |
14514 | + targ->fd = open(targ->path, O_RDWR); |
14515 | + targ->err = errno; |
14516 | + return 0; |
14517 | +} |
14518 | + |
14519 | +/* |
14520 | + * cgroup migration permission check should be performed based on the cgroup |
14521 | + * namespace at the time of open instead of write. |
14522 | + */ |
14523 | +static int test_cgcore_lesser_ns_open(const char *root) |
14524 | +{ |
14525 | + static char stack[65536]; |
14526 | + const uid_t test_euid = 65534; /* usually nobody, any !root is fine */ |
14527 | + int ret = KSFT_FAIL; |
14528 | + char *cg_test_a = NULL, *cg_test_b = NULL; |
14529 | + char *cg_test_a_procs = NULL, *cg_test_b_procs = NULL; |
14530 | + int cg_test_b_procs_fd = -1; |
14531 | + struct lesser_ns_open_thread_arg targ = { .fd = -1 }; |
14532 | + pid_t pid; |
14533 | + int status; |
14534 | + |
14535 | + cg_test_a = cg_name(root, "cg_test_a"); |
14536 | + cg_test_b = cg_name(root, "cg_test_b"); |
14537 | + |
14538 | + if (!cg_test_a || !cg_test_b) |
14539 | + goto cleanup; |
14540 | + |
14541 | + cg_test_a_procs = cg_name(cg_test_a, "cgroup.procs"); |
14542 | + cg_test_b_procs = cg_name(cg_test_b, "cgroup.procs"); |
14543 | + |
14544 | + if (!cg_test_a_procs || !cg_test_b_procs) |
14545 | + goto cleanup; |
14546 | + |
14547 | + if (cg_create(cg_test_a) || cg_create(cg_test_b)) |
14548 | + goto cleanup; |
14549 | + |
14550 | + if (cg_enter_current(cg_test_b)) |
14551 | + goto cleanup; |
14552 | + |
14553 | + if (chown(cg_test_a_procs, test_euid, -1) || |
14554 | + chown(cg_test_b_procs, test_euid, -1)) |
14555 | + goto cleanup; |
14556 | + |
14557 | + targ.path = cg_test_b_procs; |
14558 | + pid = clone(lesser_ns_open_thread_fn, stack + sizeof(stack), |
14559 | + CLONE_NEWCGROUP | CLONE_FILES | CLONE_VM | SIGCHLD, |
14560 | + &targ); |
14561 | + if (pid < 0) |
14562 | + goto cleanup; |
14563 | + |
14564 | + if (waitpid(pid, &status, 0) < 0) |
14565 | + goto cleanup; |
14566 | + |
14567 | + if (!WIFEXITED(status)) |
14568 | + goto cleanup; |
14569 | + |
14570 | + cg_test_b_procs_fd = targ.fd; |
14571 | + if (cg_test_b_procs_fd < 0) |
14572 | + goto cleanup; |
14573 | + |
14574 | + if (cg_enter_current(cg_test_a)) |
14575 | + goto cleanup; |
14576 | + |
14577 | + if ((status = write(cg_test_b_procs_fd, "0", 1)) >= 0 || errno != ENOENT) |
14578 | + goto cleanup; |
14579 | + |
14580 | + ret = KSFT_PASS; |
14581 | + |
14582 | +cleanup: |
14583 | + cg_enter_current(root); |
14584 | + if (cg_test_b_procs_fd >= 0) |
14585 | + close(cg_test_b_procs_fd); |
14586 | + if (cg_test_b) |
14587 | + cg_destroy(cg_test_b); |
14588 | + if (cg_test_a) |
14589 | + cg_destroy(cg_test_a); |
14590 | + free(cg_test_b_procs); |
14591 | + free(cg_test_a_procs); |
14592 | + free(cg_test_b); |
14593 | + free(cg_test_a); |
14594 | + return ret; |
14595 | +} |
14596 | + |
14597 | #define T(x) { x, #x } |
14598 | struct corecg_test { |
14599 | int (*fn)(const char *root); |
14600 | @@ -366,6 +531,8 @@ struct corecg_test { |
14601 | T(test_cgcore_parent_becomes_threaded), |
14602 | T(test_cgcore_invalid_domain), |
14603 | T(test_cgcore_populated), |
14604 | + T(test_cgcore_lesser_euid_open), |
14605 | + T(test_cgcore_lesser_ns_open), |
14606 | }; |
14607 | #undef T |
14608 | |
14609 | diff --git a/tools/testing/selftests/net/test_vxlan_under_vrf.sh b/tools/testing/selftests/net/test_vxlan_under_vrf.sh |
14610 | index 09f9ed92cbe4c..a44b9aca74272 100755 |
14611 | --- a/tools/testing/selftests/net/test_vxlan_under_vrf.sh |
14612 | +++ b/tools/testing/selftests/net/test_vxlan_under_vrf.sh |
14613 | @@ -118,11 +118,11 @@ echo "[ OK ]" |
14614 | |
14615 | # Move the underlay to a non-default VRF |
14616 | ip -netns hv-1 link set veth0 vrf vrf-underlay |
14617 | -ip -netns hv-1 link set veth0 down |
14618 | -ip -netns hv-1 link set veth0 up |
14619 | +ip -netns hv-1 link set vxlan0 down |
14620 | +ip -netns hv-1 link set vxlan0 up |
14621 | ip -netns hv-2 link set veth0 vrf vrf-underlay |
14622 | -ip -netns hv-2 link set veth0 down |
14623 | -ip -netns hv-2 link set veth0 up |
14624 | +ip -netns hv-2 link set vxlan0 down |
14625 | +ip -netns hv-2 link set vxlan0 up |
14626 | |
14627 | echo -n "Check VM connectivity through VXLAN (underlay in a VRF) " |
14628 | ip netns exec vm-1 ping -c 1 -W 1 10.0.0.2 &> /dev/null || (echo "[FAIL]"; false) |
14629 | diff --git a/tools/testing/selftests/x86/check_cc.sh b/tools/testing/selftests/x86/check_cc.sh |
14630 | index 3e2089c8cf549..8c669c0d662ee 100755 |
14631 | --- a/tools/testing/selftests/x86/check_cc.sh |
14632 | +++ b/tools/testing/selftests/x86/check_cc.sh |
14633 | @@ -7,7 +7,7 @@ CC="$1" |
14634 | TESTPROG="$2" |
14635 | shift 2 |
14636 | |
14637 | -if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then |
14638 | +if [ -n "$CC" ] && $CC -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then |
14639 | echo 1 |
14640 | else |
14641 | echo 0 |
14642 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
14643 | index f31976010622f..287444e52ccf8 100644 |
14644 | --- a/virt/kvm/kvm_main.c |
14645 | +++ b/virt/kvm/kvm_main.c |
14646 | @@ -115,6 +115,8 @@ EXPORT_SYMBOL_GPL(kvm_debugfs_dir); |
14647 | static int kvm_debugfs_num_entries; |
14648 | static const struct file_operations *stat_fops_per_vm[]; |
14649 | |
14650 | +static struct file_operations kvm_chardev_ops; |
14651 | + |
14652 | static long kvm_vcpu_ioctl(struct file *file, unsigned int ioctl, |
14653 | unsigned long arg); |
14654 | #ifdef CONFIG_KVM_COMPAT |
14655 | @@ -766,6 +768,16 @@ static struct kvm *kvm_create_vm(unsigned long type) |
14656 | |
14657 | preempt_notifier_inc(); |
14658 | |
14659 | + /* |
14660 | + * When the fd passed to this ioctl() is opened it pins the module, |
14661 | + * but try_module_get() also prevents getting a reference if the module |
14662 | + * is in MODULE_STATE_GOING (e.g. if someone ran "rmmod --wait"). |
14663 | + */ |
14664 | + if (!try_module_get(kvm_chardev_ops.owner)) { |
14665 | + r = -ENODEV; |
14666 | + goto out_err; |
14667 | + } |
14668 | + |
14669 | return kvm; |
14670 | |
14671 | out_err: |
14672 | @@ -844,6 +856,7 @@ static void kvm_destroy_vm(struct kvm *kvm) |
14673 | preempt_notifier_dec(); |
14674 | hardware_disable_all(); |
14675 | mmdrop(mm); |
14676 | + module_put(kvm_chardev_ops.owner); |
14677 | } |
14678 | |
14679 | void kvm_get_kvm(struct kvm *kvm) |