Contents of /trunk/kernel-alx/patches-4.1/0113-4.1.14-all-fixes.patch
Parent Directory | Revision Log
Revision 2748 -
(show annotations)
(download)
Mon Jan 11 12:00:45 2016 UTC (8 years, 8 months ago) by niro
File size: 106047 byte(s)
Mon Jan 11 12:00:45 2016 UTC (8 years, 8 months ago) by niro
File size: 106047 byte(s)
-linux-4.1 patches up to 4.1.15
1 | diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt |
2 | index c3b6b301d8b0..749b7bae0c00 100644 |
3 | --- a/Documentation/filesystems/proc.txt |
4 | +++ b/Documentation/filesystems/proc.txt |
5 | @@ -140,7 +140,8 @@ Table 1-1: Process specific entries in /proc |
6 | stat Process status |
7 | statm Process memory status information |
8 | status Process status in human readable form |
9 | - wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan |
10 | + wchan Present with CONFIG_KALLSYMS=y: it shows the kernel function |
11 | + symbol the task is blocked in - or "0" if not blocked. |
12 | pagemap Page table |
13 | stack Report full stack trace, enable via CONFIG_STACKTRACE |
14 | smaps a extension based on maps, showing the memory consumption of |
15 | @@ -309,7 +310,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7) |
16 | blocked bitmap of blocked signals |
17 | sigign bitmap of ignored signals |
18 | sigcatch bitmap of caught signals |
19 | - wchan address where process went to sleep |
20 | + 0 (place holder, used to be the wchan address, use /proc/PID/wchan instead) |
21 | 0 (place holder) |
22 | 0 (place holder) |
23 | exit_signal signal to send to parent thread on exit |
24 | diff --git a/Makefile b/Makefile |
25 | index d5d229db61d5..091280d66452 100644 |
26 | --- a/Makefile |
27 | +++ b/Makefile |
28 | @@ -1,6 +1,6 @@ |
29 | VERSION = 4 |
30 | PATCHLEVEL = 1 |
31 | -SUBLEVEL = 13 |
32 | +SUBLEVEL = 14 |
33 | EXTRAVERSION = |
34 | NAME = Series 4800 |
35 | |
36 | diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi |
37 | index bc215e4b75fd..6a87233d0b19 100644 |
38 | --- a/arch/arm/boot/dts/imx27.dtsi |
39 | +++ b/arch/arm/boot/dts/imx27.dtsi |
40 | @@ -477,7 +477,10 @@ |
41 | compatible = "fsl,imx27-usb"; |
42 | reg = <0x10024000 0x200>; |
43 | interrupts = <56>; |
44 | - clocks = <&clks IMX27_CLK_USB_IPG_GATE>; |
45 | + clocks = <&clks IMX27_CLK_USB_IPG_GATE>, |
46 | + <&clks IMX27_CLK_USB_AHB_GATE>, |
47 | + <&clks IMX27_CLK_USB_DIV>; |
48 | + clock-names = "ipg", "ahb", "per"; |
49 | fsl,usbmisc = <&usbmisc 0>; |
50 | status = "disabled"; |
51 | }; |
52 | @@ -486,7 +489,10 @@ |
53 | compatible = "fsl,imx27-usb"; |
54 | reg = <0x10024200 0x200>; |
55 | interrupts = <54>; |
56 | - clocks = <&clks IMX27_CLK_USB_IPG_GATE>; |
57 | + clocks = <&clks IMX27_CLK_USB_IPG_GATE>, |
58 | + <&clks IMX27_CLK_USB_AHB_GATE>, |
59 | + <&clks IMX27_CLK_USB_DIV>; |
60 | + clock-names = "ipg", "ahb", "per"; |
61 | fsl,usbmisc = <&usbmisc 1>; |
62 | dr_mode = "host"; |
63 | status = "disabled"; |
64 | @@ -496,7 +502,10 @@ |
65 | compatible = "fsl,imx27-usb"; |
66 | reg = <0x10024400 0x200>; |
67 | interrupts = <55>; |
68 | - clocks = <&clks IMX27_CLK_USB_IPG_GATE>; |
69 | + clocks = <&clks IMX27_CLK_USB_IPG_GATE>, |
70 | + <&clks IMX27_CLK_USB_AHB_GATE>, |
71 | + <&clks IMX27_CLK_USB_DIV>; |
72 | + clock-names = "ipg", "ahb", "per"; |
73 | fsl,usbmisc = <&usbmisc 2>; |
74 | dr_mode = "host"; |
75 | status = "disabled"; |
76 | @@ -506,7 +515,6 @@ |
77 | #index-cells = <1>; |
78 | compatible = "fsl,imx27-usbmisc"; |
79 | reg = <0x10024600 0x200>; |
80 | - clocks = <&clks IMX27_CLK_USB_AHB_GATE>; |
81 | }; |
82 | |
83 | sahara2: sahara@10025000 { |
84 | diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts |
85 | index 1b958e92d674..2e7c1364cb00 100644 |
86 | --- a/arch/arm/boot/dts/omap5-uevm.dts |
87 | +++ b/arch/arm/boot/dts/omap5-uevm.dts |
88 | @@ -31,6 +31,24 @@ |
89 | regulator-max-microvolt = <3000000>; |
90 | }; |
91 | |
92 | + mmc3_pwrseq: sdhci0_pwrseq { |
93 | + compatible = "mmc-pwrseq-simple"; |
94 | + clocks = <&clk32kgaudio>; |
95 | + clock-names = "ext_clock"; |
96 | + }; |
97 | + |
98 | + vmmcsdio_fixed: fixedregulator-mmcsdio { |
99 | + compatible = "regulator-fixed"; |
100 | + regulator-name = "vmmcsdio_fixed"; |
101 | + regulator-min-microvolt = <1800000>; |
102 | + regulator-max-microvolt = <1800000>; |
103 | + gpio = <&gpio5 12 GPIO_ACTIVE_HIGH>; /* gpio140 WLAN_EN */ |
104 | + enable-active-high; |
105 | + startup-delay-us = <70000>; |
106 | + pinctrl-names = "default"; |
107 | + pinctrl-0 = <&wlan_pins>; |
108 | + }; |
109 | + |
110 | /* HS USB Host PHY on PORT 2 */ |
111 | hsusb2_phy: hsusb2_phy { |
112 | compatible = "usb-nop-xceiv"; |
113 | @@ -197,12 +215,20 @@ |
114 | >; |
115 | }; |
116 | |
117 | - mcspi4_pins: pinmux_mcspi4_pins { |
118 | + mmc3_pins: pinmux_mmc3_pins { |
119 | + pinctrl-single,pins = < |
120 | + OMAP5_IOPAD(0x01a4, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_clk */ |
121 | + OMAP5_IOPAD(0x01a6, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_cmd */ |
122 | + OMAP5_IOPAD(0x01a8, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data0 */ |
123 | + OMAP5_IOPAD(0x01aa, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data1 */ |
124 | + OMAP5_IOPAD(0x01ac, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data2 */ |
125 | + OMAP5_IOPAD(0x01ae, PIN_INPUT_PULLUP | MUX_MODE0) /* wlsdio_data3 */ |
126 | + >; |
127 | + }; |
128 | + |
129 | + wlan_pins: pinmux_wlan_pins { |
130 | pinctrl-single,pins = < |
131 | - 0x164 (PIN_INPUT | MUX_MODE1) /* mcspi4_clk */ |
132 | - 0x168 (PIN_INPUT | MUX_MODE1) /* mcspi4_simo */ |
133 | - 0x16a (PIN_INPUT | MUX_MODE1) /* mcspi4_somi */ |
134 | - 0x16c (PIN_INPUT | MUX_MODE1) /* mcspi4_cs0 */ |
135 | + OMAP5_IOPAD(0x1bc, PIN_OUTPUT | MUX_MODE6) /* mcspi1_clk.gpio5_140 */ |
136 | >; |
137 | }; |
138 | |
139 | @@ -276,6 +302,12 @@ |
140 | 0x1A (PIN_OUTPUT | MUX_MODE0) /* fref_clk1_out, USB hub clk */ |
141 | >; |
142 | }; |
143 | + |
144 | + wlcore_irq_pin: pinmux_wlcore_irq_pin { |
145 | + pinctrl-single,pins = < |
146 | + OMAP5_IOPAD(0x040, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE6) /* llia_wakereqin.gpio1_wk14 */ |
147 | + >; |
148 | + }; |
149 | }; |
150 | |
151 | &mmc1 { |
152 | @@ -290,8 +322,25 @@ |
153 | }; |
154 | |
155 | &mmc3 { |
156 | + vmmc-supply = <&vmmcsdio_fixed>; |
157 | + mmc-pwrseq = <&mmc3_pwrseq>; |
158 | bus-width = <4>; |
159 | - ti,non-removable; |
160 | + non-removable; |
161 | + cap-power-off-card; |
162 | + pinctrl-names = "default"; |
163 | + pinctrl-0 = <&mmc3_pins &wlcore_irq_pin>; |
164 | + interrupts-extended = <&gic GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH |
165 | + &omap5_pmx_core 0x168>; |
166 | + |
167 | + #address-cells = <1>; |
168 | + #size-cells = <0>; |
169 | + wlcore: wlcore@2 { |
170 | + compatible = "ti,wl1271"; |
171 | + reg = <2>; |
172 | + interrupt-parent = <&gpio1>; |
173 | + interrupts = <14 IRQ_TYPE_LEVEL_HIGH>; /* gpio 14 */ |
174 | + ref-clock-frequency = <26000000>; |
175 | + }; |
176 | }; |
177 | |
178 | &mmc4 { |
179 | @@ -591,11 +640,6 @@ |
180 | pinctrl-0 = <&mcspi3_pins>; |
181 | }; |
182 | |
183 | -&mcspi4 { |
184 | - pinctrl-names = "default"; |
185 | - pinctrl-0 = <&mcspi4_pins>; |
186 | -}; |
187 | - |
188 | &uart1 { |
189 | pinctrl-names = "default"; |
190 | pinctrl-0 = <&uart1_pins>; |
191 | diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi |
192 | index a5f5f4090af6..9cf0ab62db7d 100644 |
193 | --- a/arch/arm/boot/dts/sama5d4.dtsi |
194 | +++ b/arch/arm/boot/dts/sama5d4.dtsi |
195 | @@ -918,11 +918,11 @@ |
196 | reg = <0xf8018000 0x4000>; |
197 | interrupts = <33 IRQ_TYPE_LEVEL_HIGH 6>; |
198 | dmas = <&dma1 |
199 | - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
200 | - AT91_XDMAC_DT_PERID(4)>, |
201 | + (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
202 | + | AT91_XDMAC_DT_PERID(4))>, |
203 | <&dma1 |
204 | - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)) |
205 | - AT91_XDMAC_DT_PERID(5)>; |
206 | + (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
207 | + | AT91_XDMAC_DT_PERID(5))>; |
208 | dma-names = "tx", "rx"; |
209 | pinctrl-names = "default"; |
210 | pinctrl-0 = <&pinctrl_i2c1>; |
211 | diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c |
212 | index 5662a872689b..30613204da15 100644 |
213 | --- a/arch/arm/common/edma.c |
214 | +++ b/arch/arm/common/edma.c |
215 | @@ -406,7 +406,8 @@ static irqreturn_t dma_irq_handler(int irq, void *data) |
216 | BIT(slot)); |
217 | if (edma_cc[ctlr]->intr_data[channel].callback) |
218 | edma_cc[ctlr]->intr_data[channel].callback( |
219 | - channel, EDMA_DMA_COMPLETE, |
220 | + EDMA_CTLR_CHAN(ctlr, channel), |
221 | + EDMA_DMA_COMPLETE, |
222 | edma_cc[ctlr]->intr_data[channel].data); |
223 | } |
224 | } while (sh_ipr); |
225 | @@ -460,7 +461,8 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) |
226 | if (edma_cc[ctlr]->intr_data[k]. |
227 | callback) { |
228 | edma_cc[ctlr]->intr_data[k]. |
229 | - callback(k, |
230 | + callback( |
231 | + EDMA_CTLR_CHAN(ctlr, k), |
232 | EDMA_DMA_CC_ERROR, |
233 | edma_cc[ctlr]->intr_data |
234 | [k].data); |
235 | diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S |
236 | index bd22b2c8a051..d3161c7ee1fd 100644 |
237 | --- a/arch/arm/mach-at91/pm_suspend.S |
238 | +++ b/arch/arm/mach-at91/pm_suspend.S |
239 | @@ -81,6 +81,8 @@ tmp2 .req r5 |
240 | * @r2: base address of second SDRAM Controller or 0 if not present |
241 | * @r3: pm information |
242 | */ |
243 | +/* at91_pm_suspend_in_sram must be 8-byte aligned per the requirements of fncpy() */ |
244 | + .align 3 |
245 | ENTRY(at91_pm_suspend_in_sram) |
246 | /* Save registers on stack */ |
247 | stmfd sp!, {r4 - r12, lr} |
248 | diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h |
249 | index 599b925a657c..1a4291936c58 100644 |
250 | --- a/arch/arm/mach-pxa/include/mach/pxa27x.h |
251 | +++ b/arch/arm/mach-pxa/include/mach/pxa27x.h |
252 | @@ -19,7 +19,7 @@ |
253 | #define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */ |
254 | #define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */ |
255 | |
256 | -extern int __init pxa27x_set_pwrmode(unsigned int mode); |
257 | +extern int pxa27x_set_pwrmode(unsigned int mode); |
258 | extern void pxa27x_cpu_pm_enter(suspend_state_t state); |
259 | |
260 | #endif /* __MACH_PXA27x_H */ |
261 | diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c |
262 | index af423a48c2e3..782e6b98dd9a 100644 |
263 | --- a/arch/arm/mach-pxa/pxa27x.c |
264 | +++ b/arch/arm/mach-pxa/pxa27x.c |
265 | @@ -251,7 +251,7 @@ static struct clk_lookup pxa27x_clkregs[] = { |
266 | */ |
267 | static unsigned int pwrmode = PWRMODE_SLEEP; |
268 | |
269 | -int __init pxa27x_set_pwrmode(unsigned int mode) |
270 | +int pxa27x_set_pwrmode(unsigned int mode) |
271 | { |
272 | switch (mode) { |
273 | case PWRMODE_SLEEP: |
274 | diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c |
275 | index fbe74c6806f3..49d1110cff53 100644 |
276 | --- a/arch/arm/mach-tegra/board-paz00.c |
277 | +++ b/arch/arm/mach-tegra/board-paz00.c |
278 | @@ -39,8 +39,8 @@ static struct platform_device wifi_rfkill_device = { |
279 | static struct gpiod_lookup_table wifi_gpio_lookup = { |
280 | .dev_id = "rfkill_gpio", |
281 | .table = { |
282 | - GPIO_LOOKUP_IDX("tegra-gpio", 25, NULL, 0, 0), |
283 | - GPIO_LOOKUP_IDX("tegra-gpio", 85, NULL, 1, 0), |
284 | + GPIO_LOOKUP("tegra-gpio", 25, "reset", 0), |
285 | + GPIO_LOOKUP("tegra-gpio", 85, "shutdown", 0), |
286 | { }, |
287 | }, |
288 | }; |
289 | diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c |
290 | index 6e4b9ff22ef3..64d7486262e5 100644 |
291 | --- a/arch/arm/mm/dma-mapping.c |
292 | +++ b/arch/arm/mm/dma-mapping.c |
293 | @@ -1395,12 +1395,19 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, |
294 | unsigned long uaddr = vma->vm_start; |
295 | unsigned long usize = vma->vm_end - vma->vm_start; |
296 | struct page **pages = __iommu_get_pages(cpu_addr, attrs); |
297 | + unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; |
298 | + unsigned long off = vma->vm_pgoff; |
299 | |
300 | vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot); |
301 | |
302 | if (!pages) |
303 | return -ENXIO; |
304 | |
305 | + if (off >= nr_pages || (usize >> PAGE_SHIFT) > nr_pages - off) |
306 | + return -ENXIO; |
307 | + |
308 | + pages += off; |
309 | + |
310 | do { |
311 | int ret = vm_insert_page(vma, uaddr, *pages++); |
312 | if (ret) { |
313 | diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h |
314 | index d6dd9fdbc3be..d4264bb0a409 100644 |
315 | --- a/arch/arm64/include/asm/ptrace.h |
316 | +++ b/arch/arm64/include/asm/ptrace.h |
317 | @@ -83,14 +83,14 @@ |
318 | #define compat_sp regs[13] |
319 | #define compat_lr regs[14] |
320 | #define compat_sp_hyp regs[15] |
321 | -#define compat_sp_irq regs[16] |
322 | -#define compat_lr_irq regs[17] |
323 | -#define compat_sp_svc regs[18] |
324 | -#define compat_lr_svc regs[19] |
325 | -#define compat_sp_abt regs[20] |
326 | -#define compat_lr_abt regs[21] |
327 | -#define compat_sp_und regs[22] |
328 | -#define compat_lr_und regs[23] |
329 | +#define compat_lr_irq regs[16] |
330 | +#define compat_sp_irq regs[17] |
331 | +#define compat_lr_svc regs[18] |
332 | +#define compat_sp_svc regs[19] |
333 | +#define compat_lr_abt regs[20] |
334 | +#define compat_sp_abt regs[21] |
335 | +#define compat_lr_und regs[22] |
336 | +#define compat_sp_und regs[23] |
337 | #define compat_r8_fiq regs[24] |
338 | #define compat_r9_fiq regs[25] |
339 | #define compat_r10_fiq regs[26] |
340 | diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S |
341 | index a2c29865c3fe..aff07bcad882 100644 |
342 | --- a/arch/arm64/kernel/vmlinux.lds.S |
343 | +++ b/arch/arm64/kernel/vmlinux.lds.S |
344 | @@ -54,9 +54,12 @@ PECOFF_FILE_ALIGNMENT = 0x200; |
345 | #define PECOFF_EDATA_PADDING |
346 | #endif |
347 | |
348 | -#ifdef CONFIG_DEBUG_ALIGN_RODATA |
349 | +#if defined(CONFIG_DEBUG_ALIGN_RODATA) |
350 | #define ALIGN_DEBUG_RO . = ALIGN(1<<SECTION_SHIFT); |
351 | #define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO |
352 | +#elif defined(CONFIG_DEBUG_RODATA) |
353 | +#define ALIGN_DEBUG_RO . = ALIGN(1<<PAGE_SHIFT); |
354 | +#define ALIGN_DEBUG_RO_MIN(min) ALIGN_DEBUG_RO |
355 | #else |
356 | #define ALIGN_DEBUG_RO |
357 | #define ALIGN_DEBUG_RO_MIN(min) . = ALIGN(min); |
358 | diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c |
359 | index d5fa3eaf39a1..41b1b090f56f 100644 |
360 | --- a/arch/mips/kvm/emulate.c |
361 | +++ b/arch/mips/kvm/emulate.c |
362 | @@ -1581,7 +1581,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, |
363 | |
364 | base = (inst >> 21) & 0x1f; |
365 | op_inst = (inst >> 16) & 0x1f; |
366 | - offset = inst & 0xffff; |
367 | + offset = (int16_t)inst; |
368 | cache = (inst >> 16) & 0x3; |
369 | op = (inst >> 18) & 0x7; |
370 | |
371 | diff --git a/arch/mips/kvm/locore.S b/arch/mips/kvm/locore.S |
372 | index c567240386a0..d1ee95a7f7dd 100644 |
373 | --- a/arch/mips/kvm/locore.S |
374 | +++ b/arch/mips/kvm/locore.S |
375 | @@ -165,9 +165,11 @@ FEXPORT(__kvm_mips_vcpu_run) |
376 | |
377 | FEXPORT(__kvm_mips_load_asid) |
378 | /* Set the ASID for the Guest Kernel */ |
379 | - INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ |
380 | - /* addresses shift to 0x80000000 */ |
381 | - bltz t0, 1f /* If kernel */ |
382 | + PTR_L t0, VCPU_COP0(k1) |
383 | + LONG_L t0, COP0_STATUS(t0) |
384 | + andi t0, KSU_USER | ST0_ERL | ST0_EXL |
385 | + xori t0, KSU_USER |
386 | + bnez t0, 1f /* If kernel */ |
387 | INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ |
388 | INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ |
389 | 1: |
390 | @@ -482,9 +484,11 @@ __kvm_mips_return_to_guest: |
391 | mtc0 t0, CP0_EPC |
392 | |
393 | /* Set the ASID for the Guest Kernel */ |
394 | - INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ |
395 | - /* addresses shift to 0x80000000 */ |
396 | - bltz t0, 1f /* If kernel */ |
397 | + PTR_L t0, VCPU_COP0(k1) |
398 | + LONG_L t0, COP0_STATUS(t0) |
399 | + andi t0, KSU_USER | ST0_ERL | ST0_EXL |
400 | + xori t0, KSU_USER |
401 | + bnez t0, 1f /* If kernel */ |
402 | INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ |
403 | INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */ |
404 | 1: |
405 | diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c |
406 | index 52f205ae1281..22ee0afc7d5d 100644 |
407 | --- a/arch/mips/kvm/mips.c |
408 | +++ b/arch/mips/kvm/mips.c |
409 | @@ -277,7 +277,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) |
410 | |
411 | if (!gebase) { |
412 | err = -ENOMEM; |
413 | - goto out_free_cpu; |
414 | + goto out_uninit_cpu; |
415 | } |
416 | kvm_debug("Allocated %d bytes for KVM Exception Handlers @ %p\n", |
417 | ALIGN(size, PAGE_SIZE), gebase); |
418 | @@ -341,6 +341,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) |
419 | out_free_gebase: |
420 | kfree(gebase); |
421 | |
422 | +out_uninit_cpu: |
423 | + kvm_vcpu_uninit(vcpu); |
424 | + |
425 | out_free_cpu: |
426 | kfree(vcpu); |
427 | |
428 | diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c |
429 | index 3fc2e6d70c77..a0706fd4ce0a 100644 |
430 | --- a/arch/mips/lantiq/clk.c |
431 | +++ b/arch/mips/lantiq/clk.c |
432 | @@ -99,6 +99,23 @@ int clk_set_rate(struct clk *clk, unsigned long rate) |
433 | } |
434 | EXPORT_SYMBOL(clk_set_rate); |
435 | |
436 | +long clk_round_rate(struct clk *clk, unsigned long rate) |
437 | +{ |
438 | + if (unlikely(!clk_good(clk))) |
439 | + return 0; |
440 | + if (clk->rates && *clk->rates) { |
441 | + unsigned long *r = clk->rates; |
442 | + |
443 | + while (*r && (*r != rate)) |
444 | + r++; |
445 | + if (!*r) { |
446 | + return clk->rate; |
447 | + } |
448 | + } |
449 | + return rate; |
450 | +} |
451 | +EXPORT_SYMBOL(clk_round_rate); |
452 | + |
453 | int clk_enable(struct clk *clk) |
454 | { |
455 | if (unlikely(!clk_good(clk))) |
456 | diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c |
457 | index b745a109bfc1..3dbba9a2bb0f 100644 |
458 | --- a/arch/s390/kvm/interrupt.c |
459 | +++ b/arch/s390/kvm/interrupt.c |
460 | @@ -1054,8 +1054,7 @@ static int __inject_extcall(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq) |
461 | src_id, 0, 2); |
462 | |
463 | /* sending vcpu invalid */ |
464 | - if (src_id >= KVM_MAX_VCPUS || |
465 | - kvm_get_vcpu(vcpu->kvm, src_id) == NULL) |
466 | + if (kvm_get_vcpu_by_id(vcpu->kvm, src_id) == NULL) |
467 | return -EINVAL; |
468 | |
469 | if (sclp_has_sigpif()) |
470 | @@ -1134,6 +1133,10 @@ static int __inject_sigp_emergency(struct kvm_vcpu *vcpu, |
471 | trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_INT_EMERGENCY, |
472 | irq->u.emerg.code, 0, 2); |
473 | |
474 | + /* sending vcpu invalid */ |
475 | + if (kvm_get_vcpu_by_id(vcpu->kvm, irq->u.emerg.code) == NULL) |
476 | + return -EINVAL; |
477 | + |
478 | set_bit(irq->u.emerg.code, li->sigp_emerg_pending); |
479 | set_bit(IRQ_PEND_EXT_EMERGENCY, &li->pending_irqs); |
480 | atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags); |
481 | diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
482 | index 8cd8e7b288c5..c3805cf4b982 100644 |
483 | --- a/arch/s390/kvm/kvm-s390.c |
484 | +++ b/arch/s390/kvm/kvm-s390.c |
485 | @@ -283,12 +283,16 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) |
486 | r = 0; |
487 | break; |
488 | case KVM_CAP_S390_VECTOR_REGISTERS: |
489 | - if (MACHINE_HAS_VX) { |
490 | + mutex_lock(&kvm->lock); |
491 | + if (atomic_read(&kvm->online_vcpus)) { |
492 | + r = -EBUSY; |
493 | + } else if (MACHINE_HAS_VX) { |
494 | set_kvm_facility(kvm->arch.model.fac->mask, 129); |
495 | set_kvm_facility(kvm->arch.model.fac->list, 129); |
496 | r = 0; |
497 | } else |
498 | r = -EINVAL; |
499 | + mutex_unlock(&kvm->lock); |
500 | break; |
501 | case KVM_CAP_S390_USER_STSI: |
502 | kvm->arch.user_stsi = 1; |
503 | @@ -1031,7 +1035,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) |
504 | if (!kvm->arch.sca) |
505 | goto out_err; |
506 | spin_lock(&kvm_lock); |
507 | - sca_offset = (sca_offset + 16) & 0x7f0; |
508 | + sca_offset += 16; |
509 | + if (sca_offset + sizeof(struct sca_block) > PAGE_SIZE) |
510 | + sca_offset = 0; |
511 | kvm->arch.sca = (struct sca_block *) ((char *) kvm->arch.sca + sca_offset); |
512 | spin_unlock(&kvm_lock); |
513 | |
514 | diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c |
515 | index 72e58bd2bee7..7171056fc24d 100644 |
516 | --- a/arch/s390/kvm/sigp.c |
517 | +++ b/arch/s390/kvm/sigp.c |
518 | @@ -294,12 +294,8 @@ static int handle_sigp_dst(struct kvm_vcpu *vcpu, u8 order_code, |
519 | u16 cpu_addr, u32 parameter, u64 *status_reg) |
520 | { |
521 | int rc; |
522 | - struct kvm_vcpu *dst_vcpu; |
523 | + struct kvm_vcpu *dst_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); |
524 | |
525 | - if (cpu_addr >= KVM_MAX_VCPUS) |
526 | - return SIGP_CC_NOT_OPERATIONAL; |
527 | - |
528 | - dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); |
529 | if (!dst_vcpu) |
530 | return SIGP_CC_NOT_OPERATIONAL; |
531 | |
532 | @@ -481,7 +477,7 @@ int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu) |
533 | trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); |
534 | |
535 | if (order_code == SIGP_EXTERNAL_CALL) { |
536 | - dest_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); |
537 | + dest_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); |
538 | BUG_ON(dest_vcpu == NULL); |
539 | |
540 | kvm_s390_vcpu_wakeup(dest_vcpu); |
541 | diff --git a/arch/x86/include/uapi/asm/svm.h b/arch/x86/include/uapi/asm/svm.h |
542 | index b5d7640abc5d..8a4add8e4639 100644 |
543 | --- a/arch/x86/include/uapi/asm/svm.h |
544 | +++ b/arch/x86/include/uapi/asm/svm.h |
545 | @@ -100,6 +100,7 @@ |
546 | { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ |
547 | { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ |
548 | { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ |
549 | + { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ |
550 | { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ |
551 | { SVM_EXIT_INTR, "interrupt" }, \ |
552 | { SVM_EXIT_NMI, "nmi" }, \ |
553 | diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c |
554 | index 205e0f3df501..5732326ec126 100644 |
555 | --- a/arch/x86/kernel/cpu/common.c |
556 | +++ b/arch/x86/kernel/cpu/common.c |
557 | @@ -291,10 +291,9 @@ __setup("nosmap", setup_disable_smap); |
558 | |
559 | static __always_inline void setup_smap(struct cpuinfo_x86 *c) |
560 | { |
561 | - unsigned long eflags; |
562 | + unsigned long eflags = native_save_fl(); |
563 | |
564 | /* This should have been cleared long ago */ |
565 | - raw_local_save_flags(eflags); |
566 | BUG_ON(eflags & X86_EFLAGS_AC); |
567 | |
568 | if (cpu_has(c, X86_FEATURE_SMAP)) { |
569 | diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S |
570 | index 7e5da2cbe59e..174fa035a09a 100644 |
571 | --- a/arch/x86/kernel/head_64.S |
572 | +++ b/arch/x86/kernel/head_64.S |
573 | @@ -65,6 +65,9 @@ startup_64: |
574 | * tables and then reload them. |
575 | */ |
576 | |
577 | + /* Sanitize CPU configuration */ |
578 | + call verify_cpu |
579 | + |
580 | /* |
581 | * Compute the delta between the address I am compiled to run at and the |
582 | * address I am actually running at. |
583 | @@ -174,6 +177,9 @@ ENTRY(secondary_startup_64) |
584 | * after the boot processor executes this code. |
585 | */ |
586 | |
587 | + /* Sanitize CPU configuration */ |
588 | + call verify_cpu |
589 | + |
590 | movq $(init_level4_pgt - __START_KERNEL_map), %rax |
591 | 1: |
592 | |
593 | @@ -288,6 +294,8 @@ ENTRY(secondary_startup_64) |
594 | pushq %rax # target address in negative space |
595 | lretq |
596 | |
597 | +#include "verify_cpu.S" |
598 | + |
599 | #ifdef CONFIG_HOTPLUG_CPU |
600 | /* |
601 | * Boot CPU0 entry point. It's called from play_dead(). Everything has been set |
602 | diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c |
603 | index d74ac33290ae..1473a02e6ccb 100644 |
604 | --- a/arch/x86/kernel/setup.c |
605 | +++ b/arch/x86/kernel/setup.c |
606 | @@ -1194,6 +1194,14 @@ void __init setup_arch(char **cmdline_p) |
607 | clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, |
608 | swapper_pg_dir + KERNEL_PGD_BOUNDARY, |
609 | KERNEL_PGD_PTRS); |
610 | + |
611 | + /* |
612 | + * sync back low identity map too. It is used for example |
613 | + * in the 32-bit EFI stub. |
614 | + */ |
615 | + clone_pgd_range(initial_page_table, |
616 | + swapper_pg_dir + KERNEL_PGD_BOUNDARY, |
617 | + min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); |
618 | #endif |
619 | |
620 | tboot_probe(); |
621 | diff --git a/arch/x86/kernel/verify_cpu.S b/arch/x86/kernel/verify_cpu.S |
622 | index b9242bacbe59..4cf401f581e7 100644 |
623 | --- a/arch/x86/kernel/verify_cpu.S |
624 | +++ b/arch/x86/kernel/verify_cpu.S |
625 | @@ -34,10 +34,11 @@ |
626 | #include <asm/msr-index.h> |
627 | |
628 | verify_cpu: |
629 | - pushfl # Save caller passed flags |
630 | - pushl $0 # Kill any dangerous flags |
631 | - popfl |
632 | + pushf # Save caller passed flags |
633 | + push $0 # Kill any dangerous flags |
634 | + popf |
635 | |
636 | +#ifndef __x86_64__ |
637 | pushfl # standard way to check for cpuid |
638 | popl %eax |
639 | movl %eax,%ebx |
640 | @@ -48,6 +49,7 @@ verify_cpu: |
641 | popl %eax |
642 | cmpl %eax,%ebx |
643 | jz verify_cpu_no_longmode # cpu has no cpuid |
644 | +#endif |
645 | |
646 | movl $0x0,%eax # See if cpuid 1 is implemented |
647 | cpuid |
648 | @@ -130,10 +132,10 @@ verify_cpu_sse_test: |
649 | jmp verify_cpu_sse_test # try again |
650 | |
651 | verify_cpu_no_longmode: |
652 | - popfl # Restore caller passed flags |
653 | + popf # Restore caller passed flags |
654 | movl $1,%eax |
655 | ret |
656 | verify_cpu_sse_ok: |
657 | - popfl # Restore caller passed flags |
658 | + popf # Restore caller passed flags |
659 | xorl %eax, %eax |
660 | ret |
661 | diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c |
662 | index 67d07e051436..7dd9a8d3911a 100644 |
663 | --- a/arch/x86/kvm/lapic.c |
664 | +++ b/arch/x86/kvm/lapic.c |
665 | @@ -339,6 +339,8 @@ void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir) |
666 | struct kvm_lapic *apic = vcpu->arch.apic; |
667 | |
668 | __kvm_apic_update_irr(pir, apic->regs); |
669 | + |
670 | + kvm_make_request(KVM_REQ_EVENT, vcpu); |
671 | } |
672 | EXPORT_SYMBOL_GPL(kvm_apic_update_irr); |
673 | |
674 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
675 | index 7858cd9acfe4..454ccb082e18 100644 |
676 | --- a/arch/x86/kvm/svm.c |
677 | +++ b/arch/x86/kvm/svm.c |
678 | @@ -1105,6 +1105,7 @@ static void init_vmcb(struct vcpu_svm *svm) |
679 | set_exception_intercept(svm, PF_VECTOR); |
680 | set_exception_intercept(svm, UD_VECTOR); |
681 | set_exception_intercept(svm, MC_VECTOR); |
682 | + set_exception_intercept(svm, AC_VECTOR); |
683 | |
684 | set_intercept(svm, INTERCEPT_INTR); |
685 | set_intercept(svm, INTERCEPT_NMI); |
686 | @@ -1791,6 +1792,12 @@ static int ud_interception(struct vcpu_svm *svm) |
687 | return 1; |
688 | } |
689 | |
690 | +static int ac_interception(struct vcpu_svm *svm) |
691 | +{ |
692 | + kvm_queue_exception_e(&svm->vcpu, AC_VECTOR, 0); |
693 | + return 1; |
694 | +} |
695 | + |
696 | static void svm_fpu_activate(struct kvm_vcpu *vcpu) |
697 | { |
698 | struct vcpu_svm *svm = to_svm(vcpu); |
699 | @@ -3361,6 +3368,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = { |
700 | [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, |
701 | [SVM_EXIT_EXCP_BASE + NM_VECTOR] = nm_interception, |
702 | [SVM_EXIT_EXCP_BASE + MC_VECTOR] = mc_interception, |
703 | + [SVM_EXIT_EXCP_BASE + AC_VECTOR] = ac_interception, |
704 | [SVM_EXIT_INTR] = intr_interception, |
705 | [SVM_EXIT_NMI] = nmi_interception, |
706 | [SVM_EXIT_SMI] = nop_on_interception, |
707 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
708 | index bc3041e1abbc..a243854c35d5 100644 |
709 | --- a/arch/x86/kvm/vmx.c |
710 | +++ b/arch/x86/kvm/vmx.c |
711 | @@ -1567,7 +1567,7 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu) |
712 | u32 eb; |
713 | |
714 | eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) | |
715 | - (1u << NM_VECTOR) | (1u << DB_VECTOR); |
716 | + (1u << NM_VECTOR) | (1u << DB_VECTOR) | (1u << AC_VECTOR); |
717 | if ((vcpu->guest_debug & |
718 | (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) == |
719 | (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) |
720 | @@ -5127,6 +5127,9 @@ static int handle_exception(struct kvm_vcpu *vcpu) |
721 | return handle_rmode_exception(vcpu, ex_no, error_code); |
722 | |
723 | switch (ex_no) { |
724 | + case AC_VECTOR: |
725 | + kvm_queue_exception_e(vcpu, AC_VECTOR, error_code); |
726 | + return 1; |
727 | case DB_VECTOR: |
728 | dr6 = vmcs_readl(EXIT_QUALIFICATION); |
729 | if (!(vcpu->guest_debug & |
730 | diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c |
731 | index e527a3e13939..fa893c3ec408 100644 |
732 | --- a/drivers/bluetooth/ath3k.c |
733 | +++ b/drivers/bluetooth/ath3k.c |
734 | @@ -93,6 +93,7 @@ static const struct usb_device_id ath3k_table[] = { |
735 | { USB_DEVICE(0x04CA, 0x300f) }, |
736 | { USB_DEVICE(0x04CA, 0x3010) }, |
737 | { USB_DEVICE(0x0930, 0x0219) }, |
738 | + { USB_DEVICE(0x0930, 0x021c) }, |
739 | { USB_DEVICE(0x0930, 0x0220) }, |
740 | { USB_DEVICE(0x0930, 0x0227) }, |
741 | { USB_DEVICE(0x0b05, 0x17d0) }, |
742 | @@ -104,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = { |
743 | { USB_DEVICE(0x0CF3, 0x311F) }, |
744 | { USB_DEVICE(0x0cf3, 0x3121) }, |
745 | { USB_DEVICE(0x0CF3, 0x817a) }, |
746 | + { USB_DEVICE(0x0CF3, 0x817b) }, |
747 | { USB_DEVICE(0x0cf3, 0xe003) }, |
748 | { USB_DEVICE(0x0CF3, 0xE004) }, |
749 | { USB_DEVICE(0x0CF3, 0xE005) }, |
750 | @@ -153,6 +155,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { |
751 | { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, |
752 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
753 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
754 | + { USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 }, |
755 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
756 | { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, |
757 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
758 | @@ -164,6 +167,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { |
759 | { USB_DEVICE(0x0cf3, 0x311F), .driver_info = BTUSB_ATH3012 }, |
760 | { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, |
761 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
762 | + { USB_DEVICE(0x0CF3, 0x817b), .driver_info = BTUSB_ATH3012 }, |
763 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
764 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
765 | { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, |
766 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
767 | index c65501539224..7bf87d9bfd7d 100644 |
768 | --- a/drivers/bluetooth/btusb.c |
769 | +++ b/drivers/bluetooth/btusb.c |
770 | @@ -191,6 +191,7 @@ static const struct usb_device_id blacklist_table[] = { |
771 | { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, |
772 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
773 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
774 | + { USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 }, |
775 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
776 | { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, |
777 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
778 | @@ -202,6 +203,7 @@ static const struct usb_device_id blacklist_table[] = { |
779 | { USB_DEVICE(0x0cf3, 0x311f), .driver_info = BTUSB_ATH3012 }, |
780 | { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, |
781 | { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
782 | + { USB_DEVICE(0x0cf3, 0x817b), .driver_info = BTUSB_ATH3012 }, |
783 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
784 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
785 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
786 | diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c |
787 | index bc96f103bd7c..9064636a867f 100644 |
788 | --- a/drivers/clk/versatile/clk-icst.c |
789 | +++ b/drivers/clk/versatile/clk-icst.c |
790 | @@ -156,8 +156,10 @@ struct clk *icst_clk_register(struct device *dev, |
791 | icst->lockreg = base + desc->lock_offset; |
792 | |
793 | clk = clk_register(dev, &icst->hw); |
794 | - if (IS_ERR(clk)) |
795 | + if (IS_ERR(clk)) { |
796 | + kfree(pclone); |
797 | kfree(icst); |
798 | + } |
799 | |
800 | return clk; |
801 | } |
802 | diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c |
803 | index c5265c1262c5..6aacd205a774 100644 |
804 | --- a/drivers/mfd/twl6040.c |
805 | +++ b/drivers/mfd/twl6040.c |
806 | @@ -647,6 +647,8 @@ static int twl6040_probe(struct i2c_client *client, |
807 | |
808 | twl6040->clk32k = devm_clk_get(&client->dev, "clk32k"); |
809 | if (IS_ERR(twl6040->clk32k)) { |
810 | + if (PTR_ERR(twl6040->clk32k) == -EPROBE_DEFER) |
811 | + return -EPROBE_DEFER; |
812 | dev_info(&client->dev, "clk32k is not handled\n"); |
813 | twl6040->clk32k = NULL; |
814 | } |
815 | diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c |
816 | index aede704605c6..141c2a42d7ed 100644 |
817 | --- a/drivers/net/can/dev.c |
818 | +++ b/drivers/net/can/dev.c |
819 | @@ -915,7 +915,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) |
820 | nla_put(skb, IFLA_CAN_BITTIMING_CONST, |
821 | sizeof(*priv->bittiming_const), priv->bittiming_const)) || |
822 | |
823 | - nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) || |
824 | + nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) || |
825 | nla_put_u32(skb, IFLA_CAN_STATE, state) || |
826 | nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || |
827 | nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || |
828 | diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c |
829 | index 32bd7f451aa4..0c048e261ee6 100644 |
830 | --- a/drivers/net/can/sja1000/sja1000.c |
831 | +++ b/drivers/net/can/sja1000/sja1000.c |
832 | @@ -218,6 +218,9 @@ static void sja1000_start(struct net_device *dev) |
833 | priv->write_reg(priv, SJA1000_RXERR, 0x0); |
834 | priv->read_reg(priv, SJA1000_ECC); |
835 | |
836 | + /* clear interrupt flags */ |
837 | + priv->read_reg(priv, SJA1000_IR); |
838 | + |
839 | /* leave reset mode */ |
840 | set_normal_mode(dev); |
841 | } |
842 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c |
843 | index 4d608f0117cd..e07afc673d7a 100644 |
844 | --- a/drivers/net/ethernet/marvell/mvneta.c |
845 | +++ b/drivers/net/ethernet/marvell/mvneta.c |
846 | @@ -949,7 +949,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp) |
847 | /* Set CPU queue access map - all CPUs have access to all RX |
848 | * queues and to all TX queues |
849 | */ |
850 | - for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) |
851 | + for_each_present_cpu(cpu) |
852 | mvreg_write(pp, MVNETA_CPU_MAP(cpu), |
853 | (MVNETA_CPU_RXQ_ACCESS_ALL_MASK | |
854 | MVNETA_CPU_TXQ_ACCESS_ALL_MASK)); |
855 | diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c |
856 | index 529ef0594b90..3756e45d8cec 100644 |
857 | --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c |
858 | +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c |
859 | @@ -2382,7 +2382,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev) |
860 | } |
861 | } |
862 | |
863 | - memset(&priv->mfunc.master.cmd_eqe, 0, dev->caps.eqe_size); |
864 | + memset(&priv->mfunc.master.cmd_eqe, 0, sizeof(struct mlx4_eqe)); |
865 | priv->mfunc.master.cmd_eqe.type = MLX4_EVENT_TYPE_CMD; |
866 | INIT_WORK(&priv->mfunc.master.comm_work, |
867 | mlx4_master_comm_channel); |
868 | diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c |
869 | index 983b1d51244d..337811d208bd 100644 |
870 | --- a/drivers/net/ethernet/mellanox/mlx4/eq.c |
871 | +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c |
872 | @@ -185,7 +185,7 @@ static void slave_event(struct mlx4_dev *dev, u8 slave, struct mlx4_eqe *eqe) |
873 | return; |
874 | } |
875 | |
876 | - memcpy(s_eqe, eqe, dev->caps.eqe_size - 1); |
877 | + memcpy(s_eqe, eqe, sizeof(struct mlx4_eqe) - 1); |
878 | s_eqe->slave_id = slave; |
879 | /* ensure all information is written before setting the ownersip bit */ |
880 | dma_wmb(); |
881 | diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c |
882 | index fbb6cfa0f5f1..feca46efa12f 100644 |
883 | --- a/drivers/net/ethernet/sfc/ef10.c |
884 | +++ b/drivers/net/ethernet/sfc/ef10.c |
885 | @@ -1344,7 +1344,9 @@ static void efx_ef10_tx_write(struct efx_tx_queue *tx_queue) |
886 | unsigned int write_ptr; |
887 | efx_qword_t *txd; |
888 | |
889 | - BUG_ON(tx_queue->write_count == tx_queue->insert_count); |
890 | + tx_queue->xmit_more_available = false; |
891 | + if (unlikely(tx_queue->write_count == tx_queue->insert_count)) |
892 | + return; |
893 | |
894 | do { |
895 | write_ptr = tx_queue->write_count & tx_queue->ptr_mask; |
896 | diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c |
897 | index bb89e96a125e..6d4e0047a31d 100644 |
898 | --- a/drivers/net/ethernet/sfc/farch.c |
899 | +++ b/drivers/net/ethernet/sfc/farch.c |
900 | @@ -319,7 +319,9 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue) |
901 | unsigned write_ptr; |
902 | unsigned old_write_count = tx_queue->write_count; |
903 | |
904 | - BUG_ON(tx_queue->write_count == tx_queue->insert_count); |
905 | + tx_queue->xmit_more_available = false; |
906 | + if (unlikely(tx_queue->write_count == tx_queue->insert_count)) |
907 | + return; |
908 | |
909 | do { |
910 | write_ptr = tx_queue->write_count & tx_queue->ptr_mask; |
911 | diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h |
912 | index 325dd94bca46..0bdef4a074dd 100644 |
913 | --- a/drivers/net/ethernet/sfc/net_driver.h |
914 | +++ b/drivers/net/ethernet/sfc/net_driver.h |
915 | @@ -218,6 +218,7 @@ struct efx_tx_buffer { |
916 | * @tso_packets: Number of packets via the TSO xmit path |
917 | * @pushes: Number of times the TX push feature has been used |
918 | * @pio_packets: Number of times the TX PIO feature has been used |
919 | + * @xmit_more_available: Are any packets waiting to be pushed to the NIC |
920 | * @empty_read_count: If the completion path has seen the queue as empty |
921 | * and the transmission path has not yet checked this, the value of |
922 | * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0. |
923 | @@ -250,6 +251,7 @@ struct efx_tx_queue { |
924 | unsigned int tso_packets; |
925 | unsigned int pushes; |
926 | unsigned int pio_packets; |
927 | + bool xmit_more_available; |
928 | /* Statistics to supplement MAC stats */ |
929 | unsigned long tx_packets; |
930 | |
931 | diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c |
932 | index aaf2987512b5..e70edc3dea7e 100644 |
933 | --- a/drivers/net/ethernet/sfc/tx.c |
934 | +++ b/drivers/net/ethernet/sfc/tx.c |
935 | @@ -431,8 +431,20 @@ finish_packet: |
936 | efx_tx_maybe_stop_queue(tx_queue); |
937 | |
938 | /* Pass off to hardware */ |
939 | - if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) |
940 | + if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) { |
941 | + struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue); |
942 | + |
943 | + /* There could be packets left on the partner queue if those |
944 | + * SKBs had skb->xmit_more set. If we do not push those they |
945 | + * could be left for a long time and cause a netdev watchdog. |
946 | + */ |
947 | + if (txq2->xmit_more_available) |
948 | + efx_nic_push_buffers(txq2); |
949 | + |
950 | efx_nic_push_buffers(tx_queue); |
951 | + } else { |
952 | + tx_queue->xmit_more_available = skb->xmit_more; |
953 | + } |
954 | |
955 | tx_queue->tx_packets++; |
956 | |
957 | @@ -721,6 +733,7 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue) |
958 | tx_queue->read_count = 0; |
959 | tx_queue->old_read_count = 0; |
960 | tx_queue->empty_read_count = 0 | EFX_EMPTY_COUNT_VALID; |
961 | + tx_queue->xmit_more_available = false; |
962 | |
963 | /* Set up TX descriptor ring */ |
964 | efx_nic_init_tx(tx_queue); |
965 | @@ -746,6 +759,7 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue) |
966 | |
967 | ++tx_queue->read_count; |
968 | } |
969 | + tx_queue->xmit_more_available = false; |
970 | netdev_tx_reset_queue(tx_queue->core_txq); |
971 | } |
972 | |
973 | @@ -1301,8 +1315,20 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, |
974 | efx_tx_maybe_stop_queue(tx_queue); |
975 | |
976 | /* Pass off to hardware */ |
977 | - if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) |
978 | + if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) { |
979 | + struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue); |
980 | + |
981 | + /* There could be packets left on the partner queue if those |
982 | + * SKBs had skb->xmit_more set. If we do not push those they |
983 | + * could be left for a long time and cause a netdev watchdog. |
984 | + */ |
985 | + if (txq2->xmit_more_available) |
986 | + efx_nic_push_buffers(txq2); |
987 | + |
988 | efx_nic_push_buffers(tx_queue); |
989 | + } else { |
990 | + tx_queue->xmit_more_available = skb->xmit_more; |
991 | + } |
992 | |
993 | tx_queue->tso_bursts++; |
994 | return NETDEV_TX_OK; |
995 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
996 | index 771cda2a48b2..2e51b816a7e8 100644 |
997 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
998 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
999 | @@ -721,10 +721,13 @@ static int stmmac_get_ts_info(struct net_device *dev, |
1000 | { |
1001 | struct stmmac_priv *priv = netdev_priv(dev); |
1002 | |
1003 | - if ((priv->hwts_tx_en) && (priv->hwts_rx_en)) { |
1004 | + if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) { |
1005 | |
1006 | - info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | |
1007 | + info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | |
1008 | + SOF_TIMESTAMPING_TX_HARDWARE | |
1009 | + SOF_TIMESTAMPING_RX_SOFTWARE | |
1010 | SOF_TIMESTAMPING_RX_HARDWARE | |
1011 | + SOF_TIMESTAMPING_SOFTWARE | |
1012 | SOF_TIMESTAMPING_RAW_HARDWARE; |
1013 | |
1014 | if (priv->ptp_clock) |
1015 | diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c |
1016 | index 58858c5589db..4dba5fbc735e 100644 |
1017 | --- a/drivers/net/macvtap.c |
1018 | +++ b/drivers/net/macvtap.c |
1019 | @@ -82,7 +82,7 @@ static const struct proto_ops macvtap_socket_ops; |
1020 | #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ |
1021 | NETIF_F_TSO6 | NETIF_F_UFO) |
1022 | #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) |
1023 | -#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) |
1024 | +#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG | NETIF_F_FRAGLIST) |
1025 | |
1026 | static struct macvlan_dev *macvtap_get_vlan_rcu(const struct net_device *dev) |
1027 | { |
1028 | diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c |
1029 | index db2c3cdf2c40..ab33262ed826 100644 |
1030 | --- a/drivers/net/ppp/pppoe.c |
1031 | +++ b/drivers/net/ppp/pppoe.c |
1032 | @@ -589,7 +589,7 @@ static int pppoe_release(struct socket *sock) |
1033 | |
1034 | po = pppox_sk(sk); |
1035 | |
1036 | - if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { |
1037 | + if (po->pppoe_dev) { |
1038 | dev_put(po->pppoe_dev); |
1039 | po->pppoe_dev = NULL; |
1040 | } |
1041 | diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
1042 | index f603f362504b..4e0470d396a3 100644 |
1043 | --- a/drivers/net/usb/qmi_wwan.c |
1044 | +++ b/drivers/net/usb/qmi_wwan.c |
1045 | @@ -764,6 +764,10 @@ static const struct usb_device_id products[] = { |
1046 | {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ |
1047 | {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, |
1048 | {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ |
1049 | + {QMI_FIXED_INTF(0x1199, 0x9070, 8)}, /* Sierra Wireless MC74xx/EM74xx */ |
1050 | + {QMI_FIXED_INTF(0x1199, 0x9070, 10)}, /* Sierra Wireless MC74xx/EM74xx */ |
1051 | + {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx/EM74xx */ |
1052 | + {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx/EM74xx */ |
1053 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
1054 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ |
1055 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
1056 | diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c |
1057 | index 7fbca37a1adf..237f8e5e493d 100644 |
1058 | --- a/drivers/net/virtio_net.c |
1059 | +++ b/drivers/net/virtio_net.c |
1060 | @@ -1756,9 +1756,9 @@ static int virtnet_probe(struct virtio_device *vdev) |
1061 | /* Do we support "hardware" checksums? */ |
1062 | if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { |
1063 | /* This opens up the world of extra features. */ |
1064 | - dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; |
1065 | + dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
1066 | if (csum) |
1067 | - dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; |
1068 | + dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
1069 | |
1070 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { |
1071 | dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO |
1072 | diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
1073 | index 5e021b0b3f9e..1734cc50ded8 100644 |
1074 | --- a/drivers/net/wireless/ath/ath10k/mac.c |
1075 | +++ b/drivers/net/wireless/ath/ath10k/mac.c |
1076 | @@ -3183,7 +3183,7 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed) |
1077 | |
1078 | static u32 get_nss_from_chainmask(u16 chain_mask) |
1079 | { |
1080 | - if ((chain_mask & 0x15) == 0x15) |
1081 | + if ((chain_mask & 0xf) == 0xf) |
1082 | return 4; |
1083 | else if ((chain_mask & 0x7) == 0x7) |
1084 | return 3; |
1085 | diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c |
1086 | index 8b16949a9cb9..88bf80a942b4 100644 |
1087 | --- a/drivers/net/wireless/iwlwifi/pcie/drv.c |
1088 | +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c |
1089 | @@ -421,14 +421,21 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
1090 | /* 8000 Series */ |
1091 | {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, |
1092 | {IWL_PCI_DEVICE(0x24F3, 0x1010, iwl8260_2ac_cfg)}, |
1093 | + {IWL_PCI_DEVICE(0x24F3, 0x0130, iwl8260_2ac_cfg)}, |
1094 | + {IWL_PCI_DEVICE(0x24F3, 0x1130, iwl8260_2ac_cfg)}, |
1095 | + {IWL_PCI_DEVICE(0x24F3, 0x0132, iwl8260_2ac_cfg)}, |
1096 | + {IWL_PCI_DEVICE(0x24F3, 0x1132, iwl8260_2ac_cfg)}, |
1097 | {IWL_PCI_DEVICE(0x24F3, 0x0110, iwl8260_2ac_cfg)}, |
1098 | + {IWL_PCI_DEVICE(0x24F3, 0x01F0, iwl8260_2ac_cfg)}, |
1099 | + {IWL_PCI_DEVICE(0x24F3, 0x0012, iwl8260_2ac_cfg)}, |
1100 | + {IWL_PCI_DEVICE(0x24F3, 0x1012, iwl8260_2ac_cfg)}, |
1101 | {IWL_PCI_DEVICE(0x24F3, 0x1110, iwl8260_2ac_cfg)}, |
1102 | {IWL_PCI_DEVICE(0x24F3, 0x0050, iwl8260_2ac_cfg)}, |
1103 | {IWL_PCI_DEVICE(0x24F3, 0x0250, iwl8260_2ac_cfg)}, |
1104 | {IWL_PCI_DEVICE(0x24F3, 0x1050, iwl8260_2ac_cfg)}, |
1105 | {IWL_PCI_DEVICE(0x24F3, 0x0150, iwl8260_2ac_cfg)}, |
1106 | + {IWL_PCI_DEVICE(0x24F3, 0x1150, iwl8260_2ac_cfg)}, |
1107 | {IWL_PCI_DEVICE(0x24F4, 0x0030, iwl8260_2ac_cfg)}, |
1108 | - {IWL_PCI_DEVICE(0x24F4, 0x1130, iwl8260_2ac_cfg)}, |
1109 | {IWL_PCI_DEVICE(0x24F4, 0x1030, iwl8260_2ac_cfg)}, |
1110 | {IWL_PCI_DEVICE(0x24F3, 0xC010, iwl8260_2ac_cfg)}, |
1111 | {IWL_PCI_DEVICE(0x24F3, 0xD010, iwl8260_2ac_cfg)}, |
1112 | @@ -437,18 +444,28 @@ static const struct pci_device_id iwl_hw_card_ids[] = { |
1113 | {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, |
1114 | {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, |
1115 | {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, |
1116 | + {IWL_PCI_DEVICE(0x24F3, 0x8110, iwl8260_2ac_cfg)}, |
1117 | {IWL_PCI_DEVICE(0x24F3, 0x9010, iwl8260_2ac_cfg)}, |
1118 | + {IWL_PCI_DEVICE(0x24F3, 0x9110, iwl8260_2ac_cfg)}, |
1119 | {IWL_PCI_DEVICE(0x24F4, 0x8030, iwl8260_2ac_cfg)}, |
1120 | {IWL_PCI_DEVICE(0x24F4, 0x9030, iwl8260_2ac_cfg)}, |
1121 | + {IWL_PCI_DEVICE(0x24F3, 0x8130, iwl8260_2ac_cfg)}, |
1122 | + {IWL_PCI_DEVICE(0x24F3, 0x9130, iwl8260_2ac_cfg)}, |
1123 | + {IWL_PCI_DEVICE(0x24F3, 0x8132, iwl8260_2ac_cfg)}, |
1124 | + {IWL_PCI_DEVICE(0x24F3, 0x9132, iwl8260_2ac_cfg)}, |
1125 | {IWL_PCI_DEVICE(0x24F3, 0x8050, iwl8260_2ac_cfg)}, |
1126 | + {IWL_PCI_DEVICE(0x24F3, 0x8150, iwl8260_2ac_cfg)}, |
1127 | {IWL_PCI_DEVICE(0x24F3, 0x9050, iwl8260_2ac_cfg)}, |
1128 | + {IWL_PCI_DEVICE(0x24F3, 0x9150, iwl8260_2ac_cfg)}, |
1129 | {IWL_PCI_DEVICE(0x24F3, 0x0004, iwl8260_2n_cfg)}, |
1130 | + {IWL_PCI_DEVICE(0x24F3, 0x0044, iwl8260_2n_cfg)}, |
1131 | {IWL_PCI_DEVICE(0x24F5, 0x0010, iwl4165_2ac_cfg)}, |
1132 | {IWL_PCI_DEVICE(0x24F6, 0x0030, iwl4165_2ac_cfg)}, |
1133 | {IWL_PCI_DEVICE(0x24F3, 0x0810, iwl8260_2ac_cfg)}, |
1134 | {IWL_PCI_DEVICE(0x24F3, 0x0910, iwl8260_2ac_cfg)}, |
1135 | {IWL_PCI_DEVICE(0x24F3, 0x0850, iwl8260_2ac_cfg)}, |
1136 | {IWL_PCI_DEVICE(0x24F3, 0x0950, iwl8260_2ac_cfg)}, |
1137 | + {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)}, |
1138 | #endif /* CONFIG_IWLMVM */ |
1139 | |
1140 | {0} |
1141 | diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c |
1142 | index 699a4802835f..1de80a8e357a 100644 |
1143 | --- a/drivers/net/wireless/iwlwifi/pcie/trans.c |
1144 | +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c |
1145 | @@ -572,10 +572,8 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) |
1146 | |
1147 | do { |
1148 | ret = iwl_pcie_set_hw_ready(trans); |
1149 | - if (ret >= 0) { |
1150 | - ret = 0; |
1151 | - goto out; |
1152 | - } |
1153 | + if (ret >= 0) |
1154 | + return 0; |
1155 | |
1156 | usleep_range(200, 1000); |
1157 | t += 200; |
1158 | @@ -585,10 +583,6 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) |
1159 | |
1160 | IWL_ERR(trans, "Couldn't prepare the card\n"); |
1161 | |
1162 | -out: |
1163 | - iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, |
1164 | - CSR_RESET_LINK_PWR_MGMT_DISABLED); |
1165 | - |
1166 | return ret; |
1167 | } |
1168 | |
1169 | diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c |
1170 | index 1fb329dc6744..24e48bddf186 100644 |
1171 | --- a/drivers/net/wireless/mwifiex/debugfs.c |
1172 | +++ b/drivers/net/wireless/mwifiex/debugfs.c |
1173 | @@ -593,7 +593,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, |
1174 | (struct mwifiex_private *) file->private_data; |
1175 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
1176 | char *buf = (char *) addr; |
1177 | - int pos = 0, ret = 0, i; |
1178 | + int pos, ret, i; |
1179 | u8 value[MAX_EEPROM_DATA]; |
1180 | |
1181 | if (!buf) |
1182 | @@ -601,7 +601,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, |
1183 | |
1184 | if (saved_offset == -1) { |
1185 | /* No command has been given */ |
1186 | - pos += snprintf(buf, PAGE_SIZE, "0"); |
1187 | + pos = snprintf(buf, PAGE_SIZE, "0"); |
1188 | goto done; |
1189 | } |
1190 | |
1191 | @@ -610,17 +610,17 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, |
1192 | (u16) saved_bytes, value); |
1193 | if (ret) { |
1194 | ret = -EINVAL; |
1195 | - goto done; |
1196 | + goto out_free; |
1197 | } |
1198 | |
1199 | - pos += snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes); |
1200 | + pos = snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes); |
1201 | |
1202 | for (i = 0; i < saved_bytes; i++) |
1203 | - pos += snprintf(buf + strlen(buf), PAGE_SIZE, "%d ", value[i]); |
1204 | - |
1205 | - ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); |
1206 | + pos += scnprintf(buf + pos, PAGE_SIZE - pos, "%d ", value[i]); |
1207 | |
1208 | done: |
1209 | + ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); |
1210 | +out_free: |
1211 | free_page(addr); |
1212 | return ret; |
1213 | } |
1214 | diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h |
1215 | index 0038d29a37fe..a470e32c49c1 100644 |
1216 | --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h |
1217 | +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h |
1218 | @@ -874,7 +874,7 @@ void lnet_debug_peer(lnet_nid_t nid); |
1219 | |
1220 | static inline void lnet_peer_set_alive(lnet_peer_t *lp) |
1221 | { |
1222 | - lp->lp_last_alive = lp->lp_last_query = get_seconds(); |
1223 | + lp->lp_last_alive = lp->lp_last_query = jiffies; |
1224 | if (!lp->lp_alive) |
1225 | lnet_notify_locked(lp, 0, 1, lp->lp_last_alive); |
1226 | } |
1227 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
1228 | index f8b5b332e7c3..943a0e204532 100644 |
1229 | --- a/drivers/staging/rtl8712/usb_intf.c |
1230 | +++ b/drivers/staging/rtl8712/usb_intf.c |
1231 | @@ -144,6 +144,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { |
1232 | {USB_DEVICE(0x0DF6, 0x0058)}, |
1233 | {USB_DEVICE(0x0DF6, 0x0049)}, |
1234 | {USB_DEVICE(0x0DF6, 0x004C)}, |
1235 | + {USB_DEVICE(0x0DF6, 0x006C)}, |
1236 | {USB_DEVICE(0x0DF6, 0x0064)}, |
1237 | /* Skyworth */ |
1238 | {USB_DEVICE(0x14b2, 0x3300)}, |
1239 | diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c |
1240 | index 6b6c6606af5f..e5edf45e9d4c 100644 |
1241 | --- a/drivers/tty/n_tty.c |
1242 | +++ b/drivers/tty/n_tty.c |
1243 | @@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty, |
1244 | { |
1245 | struct n_tty_data *ldata = tty->disc_data; |
1246 | |
1247 | - tty_audit_add_data(tty, to, n, ldata->icanon); |
1248 | + tty_audit_add_data(tty, from, n, ldata->icanon); |
1249 | return copy_to_user(to, from, n); |
1250 | } |
1251 | |
1252 | diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c |
1253 | index 90ca082935f6..3d245cd3d8e6 100644 |
1254 | --- a/drivers/tty/tty_audit.c |
1255 | +++ b/drivers/tty/tty_audit.c |
1256 | @@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty, |
1257 | * |
1258 | * Audit @data of @size from @tty, if necessary. |
1259 | */ |
1260 | -void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, |
1261 | +void tty_audit_add_data(struct tty_struct *tty, const void *data, |
1262 | size_t size, unsigned icanon) |
1263 | { |
1264 | struct tty_audit_buf *buf; |
1265 | diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
1266 | index 21837f14a403..5a5c1ab5a375 100644 |
1267 | --- a/drivers/tty/tty_io.c |
1268 | +++ b/drivers/tty/tty_io.c |
1269 | @@ -1287,18 +1287,22 @@ int tty_send_xchar(struct tty_struct *tty, char ch) |
1270 | int was_stopped = tty->stopped; |
1271 | |
1272 | if (tty->ops->send_xchar) { |
1273 | + down_read(&tty->termios_rwsem); |
1274 | tty->ops->send_xchar(tty, ch); |
1275 | + up_read(&tty->termios_rwsem); |
1276 | return 0; |
1277 | } |
1278 | |
1279 | if (tty_write_lock(tty, 0) < 0) |
1280 | return -ERESTARTSYS; |
1281 | |
1282 | + down_read(&tty->termios_rwsem); |
1283 | if (was_stopped) |
1284 | start_tty(tty); |
1285 | tty->ops->write(tty, &ch, 1); |
1286 | if (was_stopped) |
1287 | stop_tty(tty); |
1288 | + up_read(&tty->termios_rwsem); |
1289 | tty_write_unlock(tty); |
1290 | return 0; |
1291 | } |
1292 | diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c |
1293 | index 8e53fe469664..7bbf86b94716 100644 |
1294 | --- a/drivers/tty/tty_ioctl.c |
1295 | +++ b/drivers/tty/tty_ioctl.c |
1296 | @@ -1144,16 +1144,12 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, |
1297 | spin_unlock_irq(&tty->flow_lock); |
1298 | break; |
1299 | case TCIOFF: |
1300 | - down_read(&tty->termios_rwsem); |
1301 | if (STOP_CHAR(tty) != __DISABLED_CHAR) |
1302 | retval = tty_send_xchar(tty, STOP_CHAR(tty)); |
1303 | - up_read(&tty->termios_rwsem); |
1304 | break; |
1305 | case TCION: |
1306 | - down_read(&tty->termios_rwsem); |
1307 | if (START_CHAR(tty) != __DISABLED_CHAR) |
1308 | retval = tty_send_xchar(tty, START_CHAR(tty)); |
1309 | - up_read(&tty->termios_rwsem); |
1310 | break; |
1311 | default: |
1312 | return -EINVAL; |
1313 | diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c |
1314 | index fa774323ebda..846ceb91ec14 100644 |
1315 | --- a/drivers/usb/chipidea/ci_hdrc_imx.c |
1316 | +++ b/drivers/usb/chipidea/ci_hdrc_imx.c |
1317 | @@ -68,6 +68,12 @@ struct ci_hdrc_imx_data { |
1318 | struct imx_usbmisc_data *usbmisc_data; |
1319 | bool supports_runtime_pm; |
1320 | bool in_lpm; |
1321 | + /* SoC before i.mx6 (except imx23/imx28) needs three clks */ |
1322 | + bool need_three_clks; |
1323 | + struct clk *clk_ipg; |
1324 | + struct clk *clk_ahb; |
1325 | + struct clk *clk_per; |
1326 | + /* --------------------------------- */ |
1327 | }; |
1328 | |
1329 | /* Common functions shared by usbmisc drivers */ |
1330 | @@ -119,6 +125,102 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) |
1331 | } |
1332 | |
1333 | /* End of common functions shared by usbmisc drivers*/ |
1334 | +static int imx_get_clks(struct device *dev) |
1335 | +{ |
1336 | + struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); |
1337 | + int ret = 0; |
1338 | + |
1339 | + data->clk_ipg = devm_clk_get(dev, "ipg"); |
1340 | + if (IS_ERR(data->clk_ipg)) { |
1341 | + /* If the platform only needs one clocks */ |
1342 | + data->clk = devm_clk_get(dev, NULL); |
1343 | + if (IS_ERR(data->clk)) { |
1344 | + ret = PTR_ERR(data->clk); |
1345 | + dev_err(dev, |
1346 | + "Failed to get clks, err=%ld,%ld\n", |
1347 | + PTR_ERR(data->clk), PTR_ERR(data->clk_ipg)); |
1348 | + return ret; |
1349 | + } |
1350 | + return ret; |
1351 | + } |
1352 | + |
1353 | + data->clk_ahb = devm_clk_get(dev, "ahb"); |
1354 | + if (IS_ERR(data->clk_ahb)) { |
1355 | + ret = PTR_ERR(data->clk_ahb); |
1356 | + dev_err(dev, |
1357 | + "Failed to get ahb clock, err=%d\n", ret); |
1358 | + return ret; |
1359 | + } |
1360 | + |
1361 | + data->clk_per = devm_clk_get(dev, "per"); |
1362 | + if (IS_ERR(data->clk_per)) { |
1363 | + ret = PTR_ERR(data->clk_per); |
1364 | + dev_err(dev, |
1365 | + "Failed to get per clock, err=%d\n", ret); |
1366 | + return ret; |
1367 | + } |
1368 | + |
1369 | + data->need_three_clks = true; |
1370 | + return ret; |
1371 | +} |
1372 | + |
1373 | +static int imx_prepare_enable_clks(struct device *dev) |
1374 | +{ |
1375 | + struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); |
1376 | + int ret = 0; |
1377 | + |
1378 | + if (data->need_three_clks) { |
1379 | + ret = clk_prepare_enable(data->clk_ipg); |
1380 | + if (ret) { |
1381 | + dev_err(dev, |
1382 | + "Failed to prepare/enable ipg clk, err=%d\n", |
1383 | + ret); |
1384 | + return ret; |
1385 | + } |
1386 | + |
1387 | + ret = clk_prepare_enable(data->clk_ahb); |
1388 | + if (ret) { |
1389 | + dev_err(dev, |
1390 | + "Failed to prepare/enable ahb clk, err=%d\n", |
1391 | + ret); |
1392 | + clk_disable_unprepare(data->clk_ipg); |
1393 | + return ret; |
1394 | + } |
1395 | + |
1396 | + ret = clk_prepare_enable(data->clk_per); |
1397 | + if (ret) { |
1398 | + dev_err(dev, |
1399 | + "Failed to prepare/enable per clk, err=%d\n", |
1400 | + ret); |
1401 | + clk_disable_unprepare(data->clk_ahb); |
1402 | + clk_disable_unprepare(data->clk_ipg); |
1403 | + return ret; |
1404 | + } |
1405 | + } else { |
1406 | + ret = clk_prepare_enable(data->clk); |
1407 | + if (ret) { |
1408 | + dev_err(dev, |
1409 | + "Failed to prepare/enable clk, err=%d\n", |
1410 | + ret); |
1411 | + return ret; |
1412 | + } |
1413 | + } |
1414 | + |
1415 | + return ret; |
1416 | +} |
1417 | + |
1418 | +static void imx_disable_unprepare_clks(struct device *dev) |
1419 | +{ |
1420 | + struct ci_hdrc_imx_data *data = dev_get_drvdata(dev); |
1421 | + |
1422 | + if (data->need_three_clks) { |
1423 | + clk_disable_unprepare(data->clk_per); |
1424 | + clk_disable_unprepare(data->clk_ahb); |
1425 | + clk_disable_unprepare(data->clk_ipg); |
1426 | + } else { |
1427 | + clk_disable_unprepare(data->clk); |
1428 | + } |
1429 | +} |
1430 | |
1431 | static int ci_hdrc_imx_probe(struct platform_device *pdev) |
1432 | { |
1433 | @@ -137,23 +239,18 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
1434 | if (!data) |
1435 | return -ENOMEM; |
1436 | |
1437 | + platform_set_drvdata(pdev, data); |
1438 | data->usbmisc_data = usbmisc_get_init_data(&pdev->dev); |
1439 | if (IS_ERR(data->usbmisc_data)) |
1440 | return PTR_ERR(data->usbmisc_data); |
1441 | |
1442 | - data->clk = devm_clk_get(&pdev->dev, NULL); |
1443 | - if (IS_ERR(data->clk)) { |
1444 | - dev_err(&pdev->dev, |
1445 | - "Failed to get clock, err=%ld\n", PTR_ERR(data->clk)); |
1446 | - return PTR_ERR(data->clk); |
1447 | - } |
1448 | + ret = imx_get_clks(&pdev->dev); |
1449 | + if (ret) |
1450 | + return ret; |
1451 | |
1452 | - ret = clk_prepare_enable(data->clk); |
1453 | - if (ret) { |
1454 | - dev_err(&pdev->dev, |
1455 | - "Failed to prepare or enable clock, err=%d\n", ret); |
1456 | + ret = imx_prepare_enable_clks(&pdev->dev); |
1457 | + if (ret) |
1458 | return ret; |
1459 | - } |
1460 | |
1461 | data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0); |
1462 | if (IS_ERR(data->phy)) { |
1463 | @@ -196,8 +293,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
1464 | goto disable_device; |
1465 | } |
1466 | |
1467 | - platform_set_drvdata(pdev, data); |
1468 | - |
1469 | if (data->supports_runtime_pm) { |
1470 | pm_runtime_set_active(&pdev->dev); |
1471 | pm_runtime_enable(&pdev->dev); |
1472 | @@ -210,7 +305,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) |
1473 | disable_device: |
1474 | ci_hdrc_remove_device(data->ci_pdev); |
1475 | err_clk: |
1476 | - clk_disable_unprepare(data->clk); |
1477 | + imx_disable_unprepare_clks(&pdev->dev); |
1478 | return ret; |
1479 | } |
1480 | |
1481 | @@ -224,7 +319,7 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev) |
1482 | pm_runtime_put_noidle(&pdev->dev); |
1483 | } |
1484 | ci_hdrc_remove_device(data->ci_pdev); |
1485 | - clk_disable_unprepare(data->clk); |
1486 | + imx_disable_unprepare_clks(&pdev->dev); |
1487 | |
1488 | return 0; |
1489 | } |
1490 | @@ -236,7 +331,7 @@ static int imx_controller_suspend(struct device *dev) |
1491 | |
1492 | dev_dbg(dev, "at %s\n", __func__); |
1493 | |
1494 | - clk_disable_unprepare(data->clk); |
1495 | + imx_disable_unprepare_clks(dev); |
1496 | data->in_lpm = true; |
1497 | |
1498 | return 0; |
1499 | @@ -254,7 +349,7 @@ static int imx_controller_resume(struct device *dev) |
1500 | return 0; |
1501 | } |
1502 | |
1503 | - ret = clk_prepare_enable(data->clk); |
1504 | + ret = imx_prepare_enable_clks(dev); |
1505 | if (ret) |
1506 | return ret; |
1507 | |
1508 | @@ -269,7 +364,7 @@ static int imx_controller_resume(struct device *dev) |
1509 | return 0; |
1510 | |
1511 | clk_disable: |
1512 | - clk_disable_unprepare(data->clk); |
1513 | + imx_disable_unprepare_clks(dev); |
1514 | return ret; |
1515 | } |
1516 | |
1517 | diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c |
1518 | index 6e53c24fa1cb..92937c14f818 100644 |
1519 | --- a/drivers/usb/chipidea/udc.c |
1520 | +++ b/drivers/usb/chipidea/udc.c |
1521 | @@ -1730,6 +1730,22 @@ static int ci_udc_start(struct usb_gadget *gadget, |
1522 | return retval; |
1523 | } |
1524 | |
1525 | +static void ci_udc_stop_for_otg_fsm(struct ci_hdrc *ci) |
1526 | +{ |
1527 | + if (!ci_otg_is_fsm_mode(ci)) |
1528 | + return; |
1529 | + |
1530 | + mutex_lock(&ci->fsm.lock); |
1531 | + if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { |
1532 | + ci->fsm.a_bidl_adis_tmout = 1; |
1533 | + ci_hdrc_otg_fsm_start(ci); |
1534 | + } else if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { |
1535 | + ci->fsm.protocol = PROTO_UNDEF; |
1536 | + ci->fsm.otg->state = OTG_STATE_UNDEFINED; |
1537 | + } |
1538 | + mutex_unlock(&ci->fsm.lock); |
1539 | +} |
1540 | + |
1541 | /** |
1542 | * ci_udc_stop: unregister a gadget driver |
1543 | */ |
1544 | @@ -1754,6 +1770,7 @@ static int ci_udc_stop(struct usb_gadget *gadget) |
1545 | ci->driver = NULL; |
1546 | spin_unlock_irqrestore(&ci->lock, flags); |
1547 | |
1548 | + ci_udc_stop_for_otg_fsm(ci); |
1549 | return 0; |
1550 | } |
1551 | |
1552 | diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c |
1553 | index 0924ee40a966..b9adc2ec49dd 100644 |
1554 | --- a/drivers/usb/class/usblp.c |
1555 | +++ b/drivers/usb/class/usblp.c |
1556 | @@ -869,11 +869,11 @@ static int usblp_wwait(struct usblp *usblp, int nonblock) |
1557 | |
1558 | add_wait_queue(&usblp->wwait, &waita); |
1559 | for (;;) { |
1560 | - set_current_state(TASK_INTERRUPTIBLE); |
1561 | if (mutex_lock_interruptible(&usblp->mut)) { |
1562 | rc = -EINTR; |
1563 | break; |
1564 | } |
1565 | + set_current_state(TASK_INTERRUPTIBLE); |
1566 | rc = usblp_wtest(usblp, nonblock); |
1567 | mutex_unlock(&usblp->mut); |
1568 | if (rc <= 0) |
1569 | diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
1570 | index 2bbab3d86fff..8e9518fe7763 100644 |
1571 | --- a/drivers/usb/dwc3/core.c |
1572 | +++ b/drivers/usb/dwc3/core.c |
1573 | @@ -445,12 +445,18 @@ static int dwc3_core_init(struct dwc3 *dwc) |
1574 | |
1575 | reg = dwc3_readl(dwc->regs, DWC3_GSNPSID); |
1576 | /* This should read as U3 followed by revision number */ |
1577 | - if ((reg & DWC3_GSNPSID_MASK) != 0x55330000) { |
1578 | + if ((reg & DWC3_GSNPSID_MASK) == 0x55330000) { |
1579 | + /* Detected DWC_usb3 IP */ |
1580 | + dwc->revision = reg; |
1581 | + } else if ((reg & DWC3_GSNPSID_MASK) == 0x33310000) { |
1582 | + /* Detected DWC_usb31 IP */ |
1583 | + dwc->revision = dwc3_readl(dwc->regs, DWC3_VER_NUMBER); |
1584 | + dwc->revision |= DWC3_REVISION_IS_DWC31; |
1585 | + } else { |
1586 | dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); |
1587 | ret = -ENODEV; |
1588 | goto err0; |
1589 | } |
1590 | - dwc->revision = reg; |
1591 | |
1592 | /* |
1593 | * Write Linux Version Code to our GUID register so it's easy to figure |
1594 | diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h |
1595 | index c0eafa6fd403..173edd4ca20e 100644 |
1596 | --- a/drivers/usb/dwc3/core.h |
1597 | +++ b/drivers/usb/dwc3/core.h |
1598 | @@ -107,6 +107,9 @@ |
1599 | #define DWC3_GPRTBIMAP_FS0 0xc188 |
1600 | #define DWC3_GPRTBIMAP_FS1 0xc18c |
1601 | |
1602 | +#define DWC3_VER_NUMBER 0xc1a0 |
1603 | +#define DWC3_VER_TYPE 0xc1a4 |
1604 | + |
1605 | #define DWC3_GUSB2PHYCFG(n) (0xc200 + (n * 0x04)) |
1606 | #define DWC3_GUSB2I2CCTL(n) (0xc240 + (n * 0x04)) |
1607 | |
1608 | @@ -752,6 +755,14 @@ struct dwc3 { |
1609 | u32 num_event_buffers; |
1610 | u32 u1u2; |
1611 | u32 maximum_speed; |
1612 | + |
1613 | + /* |
1614 | + * All 3.1 IP version constants are greater than the 3.0 IP |
1615 | + * version constants. This works for most version checks in |
1616 | + * dwc3. However, in the future, this may not apply as |
1617 | + * features may be developed on newer versions of the 3.0 IP |
1618 | + * that are not in the 3.1 IP. |
1619 | + */ |
1620 | u32 revision; |
1621 | |
1622 | #define DWC3_REVISION_173A 0x5533173a |
1623 | @@ -774,6 +785,13 @@ struct dwc3 { |
1624 | #define DWC3_REVISION_270A 0x5533270a |
1625 | #define DWC3_REVISION_280A 0x5533280a |
1626 | |
1627 | +/* |
1628 | + * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really |
1629 | + * just so dwc31 revisions are always larger than dwc3. |
1630 | + */ |
1631 | +#define DWC3_REVISION_IS_DWC31 0x80000000 |
1632 | +#define DWC3_USB31_REVISION_110A (0x3131302a | DWC3_REVISION_IS_USB31) |
1633 | + |
1634 | enum dwc3_ep0_next ep0_next_event; |
1635 | enum dwc3_ep0_state ep0state; |
1636 | enum dwc3_link_state link_state; |
1637 | diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c |
1638 | index b773fb53d6a7..830f020230c4 100644 |
1639 | --- a/drivers/usb/dwc3/dwc3-pci.c |
1640 | +++ b/drivers/usb/dwc3/dwc3-pci.c |
1641 | @@ -25,6 +25,8 @@ |
1642 | #include "platform_data.h" |
1643 | |
1644 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd |
1645 | +#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce |
1646 | +#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 0xabcf |
1647 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 |
1648 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e |
1649 | #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 |
1650 | @@ -65,6 +67,21 @@ static int dwc3_pci_quirks(struct pci_dev *pdev) |
1651 | sizeof(pdata)); |
1652 | } |
1653 | |
1654 | + if (pdev->vendor == PCI_VENDOR_ID_SYNOPSYS && |
1655 | + (pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 || |
1656 | + pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI || |
1657 | + pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31)) { |
1658 | + |
1659 | + struct dwc3_platform_data pdata; |
1660 | + |
1661 | + memset(&pdata, 0, sizeof(pdata)); |
1662 | + pdata.usb3_lpm_capable = true; |
1663 | + pdata.has_lpm_erratum = true; |
1664 | + |
1665 | + return platform_device_add_data(pci_get_drvdata(pdev), &pdata, |
1666 | + sizeof(pdata)); |
1667 | + } |
1668 | + |
1669 | return 0; |
1670 | } |
1671 | |
1672 | @@ -136,6 +153,14 @@ static const struct pci_device_id dwc3_pci_id_table[] = { |
1673 | PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
1674 | PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), |
1675 | }, |
1676 | + { |
1677 | + PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
1678 | + PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI), |
1679 | + }, |
1680 | + { |
1681 | + PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
1682 | + PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31), |
1683 | + }, |
1684 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, |
1685 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, |
1686 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, |
1687 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1688 | index 333a7c0078fc..6fbf461d523c 100644 |
1689 | --- a/drivers/usb/dwc3/gadget.c |
1690 | +++ b/drivers/usb/dwc3/gadget.c |
1691 | @@ -1859,27 +1859,32 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, |
1692 | unsigned int i; |
1693 | int ret; |
1694 | |
1695 | - req = next_request(&dep->req_queued); |
1696 | - if (!req) { |
1697 | - WARN_ON_ONCE(1); |
1698 | - return 1; |
1699 | - } |
1700 | - i = 0; |
1701 | do { |
1702 | - slot = req->start_slot + i; |
1703 | - if ((slot == DWC3_TRB_NUM - 1) && |
1704 | + req = next_request(&dep->req_queued); |
1705 | + if (!req) { |
1706 | + WARN_ON_ONCE(1); |
1707 | + return 1; |
1708 | + } |
1709 | + i = 0; |
1710 | + do { |
1711 | + slot = req->start_slot + i; |
1712 | + if ((slot == DWC3_TRB_NUM - 1) && |
1713 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) |
1714 | - slot++; |
1715 | - slot %= DWC3_TRB_NUM; |
1716 | - trb = &dep->trb_pool[slot]; |
1717 | + slot++; |
1718 | + slot %= DWC3_TRB_NUM; |
1719 | + trb = &dep->trb_pool[slot]; |
1720 | + |
1721 | + ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, |
1722 | + event, status); |
1723 | + if (ret) |
1724 | + break; |
1725 | + } while (++i < req->request.num_mapped_sgs); |
1726 | + |
1727 | + dwc3_gadget_giveback(dep, req, status); |
1728 | |
1729 | - ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, |
1730 | - event, status); |
1731 | if (ret) |
1732 | break; |
1733 | - } while (++i < req->request.num_mapped_sgs); |
1734 | - |
1735 | - dwc3_gadget_giveback(dep, req, status); |
1736 | + } while (1); |
1737 | |
1738 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
1739 | list_empty(&dep->req_queued)) { |
1740 | @@ -2709,12 +2714,34 @@ int dwc3_gadget_init(struct dwc3 *dwc) |
1741 | } |
1742 | |
1743 | dwc->gadget.ops = &dwc3_gadget_ops; |
1744 | - dwc->gadget.max_speed = USB_SPEED_SUPER; |
1745 | dwc->gadget.speed = USB_SPEED_UNKNOWN; |
1746 | dwc->gadget.sg_supported = true; |
1747 | dwc->gadget.name = "dwc3-gadget"; |
1748 | |
1749 | /* |
1750 | + * FIXME We might be setting max_speed to <SUPER, however versions |
1751 | + * <2.20a of dwc3 have an issue with metastability (documented |
1752 | + * elsewhere in this driver) which tells us we can't set max speed to |
1753 | + * anything lower than SUPER. |
1754 | + * |
1755 | + * Because gadget.max_speed is only used by composite.c and function |
1756 | + * drivers (i.e. it won't go into dwc3's registers) we are allowing this |
1757 | + * to happen so we avoid sending SuperSpeed Capability descriptor |
1758 | + * together with our BOS descriptor as that could confuse host into |
1759 | + * thinking we can handle super speed. |
1760 | + * |
1761 | + * Note that, in fact, we won't even support GetBOS requests when speed |
1762 | + * is less than super speed because we don't have means, yet, to tell |
1763 | + * composite.c that we are USB 2.0 + LPM ECN. |
1764 | + */ |
1765 | + if (dwc->revision < DWC3_REVISION_220A) |
1766 | + dwc3_trace(trace_dwc3_gadget, |
1767 | + "Changing max_speed on rev %08x\n", |
1768 | + dwc->revision); |
1769 | + |
1770 | + dwc->gadget.max_speed = dwc->maximum_speed; |
1771 | + |
1772 | + /* |
1773 | * Per databook, DWC3 needs buffer size to be aligned to MaxPacketSize |
1774 | * on ep out. |
1775 | */ |
1776 | diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c |
1777 | index 351d48550c33..d6ca3697d3c8 100644 |
1778 | --- a/drivers/usb/gadget/udc/atmel_usba_udc.c |
1779 | +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c |
1780 | @@ -1634,7 +1634,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) |
1781 | spin_lock(&udc->lock); |
1782 | |
1783 | int_enb = usba_int_enb_get(udc); |
1784 | - status = usba_readl(udc, INT_STA) & int_enb; |
1785 | + status = usba_readl(udc, INT_STA) & (int_enb | USBA_HIGH_SPEED); |
1786 | DBG(DBG_INT, "irq, status=%#08x\n", status); |
1787 | |
1788 | if (status & USBA_DET_SUSPEND) { |
1789 | diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c |
1790 | index bfcbb9aa8816..ee8d5faa0194 100644 |
1791 | --- a/drivers/usb/host/ehci-orion.c |
1792 | +++ b/drivers/usb/host/ehci-orion.c |
1793 | @@ -224,7 +224,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) |
1794 | priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); |
1795 | if (IS_ERR(priv->phy)) { |
1796 | err = PTR_ERR(priv->phy); |
1797 | - goto err_phy_get; |
1798 | + if (err != -ENOSYS) |
1799 | + goto err_phy_get; |
1800 | } else { |
1801 | err = phy_init(priv->phy); |
1802 | if (err) |
1803 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
1804 | index 26f62b2b33f8..1e6d7579709e 100644 |
1805 | --- a/drivers/usb/host/xhci.c |
1806 | +++ b/drivers/usb/host/xhci.c |
1807 | @@ -175,6 +175,16 @@ int xhci_reset(struct xhci_hcd *xhci) |
1808 | command |= CMD_RESET; |
1809 | writel(command, &xhci->op_regs->command); |
1810 | |
1811 | + /* Existing Intel xHCI controllers require a delay of 1 mS, |
1812 | + * after setting the CMD_RESET bit, and before accessing any |
1813 | + * HC registers. This allows the HC to complete the |
1814 | + * reset operation and be ready for HC register access. |
1815 | + * Without this delay, the subsequent HC register access, |
1816 | + * may result in a system hang very rarely. |
1817 | + */ |
1818 | + if (xhci->quirks & XHCI_INTEL_HOST) |
1819 | + udelay(1000); |
1820 | + |
1821 | ret = xhci_handshake(&xhci->op_regs->command, |
1822 | CMD_RESET, 0, 10 * 1000 * 1000); |
1823 | if (ret) |
1824 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
1825 | index 6dca3d794ced..9f65d8477372 100644 |
1826 | --- a/drivers/usb/musb/musb_core.c |
1827 | +++ b/drivers/usb/musb/musb_core.c |
1828 | @@ -132,7 +132,7 @@ static inline struct musb *dev_to_musb(struct device *dev) |
1829 | /*-------------------------------------------------------------------------*/ |
1830 | |
1831 | #ifndef CONFIG_BLACKFIN |
1832 | -static int musb_ulpi_read(struct usb_phy *phy, u32 offset) |
1833 | +static int musb_ulpi_read(struct usb_phy *phy, u32 reg) |
1834 | { |
1835 | void __iomem *addr = phy->io_priv; |
1836 | int i = 0; |
1837 | @@ -151,7 +151,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) |
1838 | * ULPICarKitControlDisableUTMI after clearing POWER_SUSPENDM. |
1839 | */ |
1840 | |
1841 | - musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); |
1842 | + musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg); |
1843 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, |
1844 | MUSB_ULPI_REG_REQ | MUSB_ULPI_RDN_WR); |
1845 | |
1846 | @@ -176,7 +176,7 @@ out: |
1847 | return ret; |
1848 | } |
1849 | |
1850 | -static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
1851 | +static int musb_ulpi_write(struct usb_phy *phy, u32 val, u32 reg) |
1852 | { |
1853 | void __iomem *addr = phy->io_priv; |
1854 | int i = 0; |
1855 | @@ -191,8 +191,8 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
1856 | power &= ~MUSB_POWER_SUSPENDM; |
1857 | musb_writeb(addr, MUSB_POWER, power); |
1858 | |
1859 | - musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); |
1860 | - musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)data); |
1861 | + musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg); |
1862 | + musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)val); |
1863 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, MUSB_ULPI_REG_REQ); |
1864 | |
1865 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
1866 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
1867 | index 7c8eb4c4c175..4021846139c9 100644 |
1868 | --- a/drivers/usb/serial/option.c |
1869 | +++ b/drivers/usb/serial/option.c |
1870 | @@ -162,6 +162,7 @@ static void option_instat_callback(struct urb *urb); |
1871 | #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001 |
1872 | #define NOVATELWIRELESS_PRODUCT_E362 0x9010 |
1873 | #define NOVATELWIRELESS_PRODUCT_E371 0x9011 |
1874 | +#define NOVATELWIRELESS_PRODUCT_U620L 0x9022 |
1875 | #define NOVATELWIRELESS_PRODUCT_G2 0xA010 |
1876 | #define NOVATELWIRELESS_PRODUCT_MC551 0xB001 |
1877 | |
1878 | @@ -357,6 +358,7 @@ static void option_instat_callback(struct urb *urb); |
1879 | /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * |
1880 | * It seems to contain a Qualcomm QSC6240/6290 chipset */ |
1881 | #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 |
1882 | +#define FOUR_G_SYSTEMS_PRODUCT_W100 0x9b01 |
1883 | |
1884 | /* iBall 3.5G connect wireless modem */ |
1885 | #define IBALL_3_5G_CONNECT 0x9605 |
1886 | @@ -522,6 +524,11 @@ static const struct option_blacklist_info four_g_w14_blacklist = { |
1887 | .sendsetup = BIT(0) | BIT(1), |
1888 | }; |
1889 | |
1890 | +static const struct option_blacklist_info four_g_w100_blacklist = { |
1891 | + .sendsetup = BIT(1) | BIT(2), |
1892 | + .reserved = BIT(3), |
1893 | +}; |
1894 | + |
1895 | static const struct option_blacklist_info alcatel_x200_blacklist = { |
1896 | .sendsetup = BIT(0) | BIT(1), |
1897 | .reserved = BIT(4), |
1898 | @@ -1060,6 +1067,7 @@ static const struct usb_device_id option_ids[] = { |
1899 | { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, |
1900 | { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) }, |
1901 | { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) }, |
1902 | + { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U620L, 0xff, 0x00, 0x00) }, |
1903 | |
1904 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, |
1905 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, |
1906 | @@ -1653,6 +1661,9 @@ static const struct usb_device_id option_ids[] = { |
1907 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
1908 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
1909 | }, |
1910 | + { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100), |
1911 | + .driver_info = (kernel_ulong_t)&four_g_w100_blacklist |
1912 | + }, |
1913 | { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, |
1914 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
1915 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
1916 | diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
1917 | index f49d262e926b..514fa91cf74e 100644 |
1918 | --- a/drivers/usb/serial/qcserial.c |
1919 | +++ b/drivers/usb/serial/qcserial.c |
1920 | @@ -22,6 +22,8 @@ |
1921 | #define DRIVER_AUTHOR "Qualcomm Inc" |
1922 | #define DRIVER_DESC "Qualcomm USB Serial driver" |
1923 | |
1924 | +#define QUECTEL_EC20_PID 0x9215 |
1925 | + |
1926 | /* standard device layouts supported by this driver */ |
1927 | enum qcserial_layouts { |
1928 | QCSERIAL_G2K = 0, /* Gobi 2000 */ |
1929 | @@ -169,6 +171,38 @@ static const struct usb_device_id id_table[] = { |
1930 | }; |
1931 | MODULE_DEVICE_TABLE(usb, id_table); |
1932 | |
1933 | +static int handle_quectel_ec20(struct device *dev, int ifnum) |
1934 | +{ |
1935 | + int altsetting = 0; |
1936 | + |
1937 | + /* |
1938 | + * Quectel EC20 Mini PCIe LTE module layout: |
1939 | + * 0: DM/DIAG (use libqcdm from ModemManager for communication) |
1940 | + * 1: NMEA |
1941 | + * 2: AT-capable modem port |
1942 | + * 3: Modem interface |
1943 | + * 4: NDIS |
1944 | + */ |
1945 | + switch (ifnum) { |
1946 | + case 0: |
1947 | + dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); |
1948 | + break; |
1949 | + case 1: |
1950 | + dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); |
1951 | + break; |
1952 | + case 2: |
1953 | + case 3: |
1954 | + dev_dbg(dev, "Quectel EC20 Modem port found\n"); |
1955 | + break; |
1956 | + case 4: |
1957 | + /* Don't claim the QMI/net interface */ |
1958 | + altsetting = -1; |
1959 | + break; |
1960 | + } |
1961 | + |
1962 | + return altsetting; |
1963 | +} |
1964 | + |
1965 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
1966 | { |
1967 | struct usb_host_interface *intf = serial->interface->cur_altsetting; |
1968 | @@ -178,6 +212,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
1969 | __u8 ifnum; |
1970 | int altsetting = -1; |
1971 | |
1972 | + /* we only support vendor specific functions */ |
1973 | + if (intf->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) |
1974 | + goto done; |
1975 | + |
1976 | nintf = serial->dev->actconfig->desc.bNumInterfaces; |
1977 | dev_dbg(dev, "Num Interfaces = %d\n", nintf); |
1978 | ifnum = intf->desc.bInterfaceNumber; |
1979 | @@ -237,6 +275,12 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
1980 | altsetting = -1; |
1981 | break; |
1982 | case QCSERIAL_G2K: |
1983 | + /* handle non-standard layouts */ |
1984 | + if (nintf == 5 && id->idProduct == QUECTEL_EC20_PID) { |
1985 | + altsetting = handle_quectel_ec20(dev, ifnum); |
1986 | + goto done; |
1987 | + } |
1988 | + |
1989 | /* |
1990 | * Gobi 2K+ USB layout: |
1991 | * 0: QMI/net |
1992 | @@ -297,29 +341,39 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
1993 | break; |
1994 | case QCSERIAL_HWI: |
1995 | /* |
1996 | - * Huawei layout: |
1997 | - * 0: AT-capable modem port |
1998 | - * 1: DM/DIAG |
1999 | - * 2: AT-capable modem port |
2000 | - * 3: CCID-compatible PCSC interface |
2001 | - * 4: QMI/net |
2002 | - * 5: NMEA |
2003 | + * Huawei devices map functions by subclass + protocol |
2004 | + * instead of interface numbers. The protocol identify |
2005 | + * a specific function, while the subclass indicate a |
2006 | + * specific firmware source |
2007 | + * |
2008 | + * This is a blacklist of functions known to be |
2009 | + * non-serial. The rest are assumed to be serial and |
2010 | + * will be handled by this driver |
2011 | */ |
2012 | - switch (ifnum) { |
2013 | - case 0: |
2014 | - case 2: |
2015 | - dev_dbg(dev, "Modem port found\n"); |
2016 | - break; |
2017 | - case 1: |
2018 | - dev_dbg(dev, "DM/DIAG interface found\n"); |
2019 | - break; |
2020 | - case 5: |
2021 | - dev_dbg(dev, "NMEA GPS interface found\n"); |
2022 | - break; |
2023 | - default: |
2024 | - /* don't claim any unsupported interface */ |
2025 | + switch (intf->desc.bInterfaceProtocol) { |
2026 | + /* QMI combined (qmi_wwan) */ |
2027 | + case 0x07: |
2028 | + case 0x37: |
2029 | + case 0x67: |
2030 | + /* QMI data (qmi_wwan) */ |
2031 | + case 0x08: |
2032 | + case 0x38: |
2033 | + case 0x68: |
2034 | + /* QMI control (qmi_wwan) */ |
2035 | + case 0x09: |
2036 | + case 0x39: |
2037 | + case 0x69: |
2038 | + /* NCM like (huawei_cdc_ncm) */ |
2039 | + case 0x16: |
2040 | + case 0x46: |
2041 | + case 0x76: |
2042 | altsetting = -1; |
2043 | break; |
2044 | + default: |
2045 | + dev_dbg(dev, "Huawei type serial port found (%02x/%02x/%02x)\n", |
2046 | + intf->desc.bInterfaceClass, |
2047 | + intf->desc.bInterfaceSubClass, |
2048 | + intf->desc.bInterfaceProtocol); |
2049 | } |
2050 | break; |
2051 | default: |
2052 | diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c |
2053 | index e9da41d9fe7f..2694df2f4559 100644 |
2054 | --- a/drivers/usb/serial/ti_usb_3410_5052.c |
2055 | +++ b/drivers/usb/serial/ti_usb_3410_5052.c |
2056 | @@ -159,6 +159,7 @@ static const struct usb_device_id ti_id_table_3410[] = { |
2057 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) }, |
2058 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, |
2059 | { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, |
2060 | + { USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) }, |
2061 | { } /* terminator */ |
2062 | }; |
2063 | |
2064 | @@ -191,6 +192,7 @@ static const struct usb_device_id ti_id_table_combined[] = { |
2065 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, |
2066 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, |
2067 | { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, |
2068 | + { USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) }, |
2069 | { } /* terminator */ |
2070 | }; |
2071 | |
2072 | diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h |
2073 | index 4a2423e84d55..98f35c656c02 100644 |
2074 | --- a/drivers/usb/serial/ti_usb_3410_5052.h |
2075 | +++ b/drivers/usb/serial/ti_usb_3410_5052.h |
2076 | @@ -56,6 +56,10 @@ |
2077 | #define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID |
2078 | #define ABBOTT_STRIP_PORT_ID 0x3420 |
2079 | |
2080 | +/* Honeywell vendor and product IDs */ |
2081 | +#define HONEYWELL_VENDOR_ID 0x10ac |
2082 | +#define HONEYWELL_HGI80_PRODUCT_ID 0x0102 /* Honeywell HGI80 */ |
2083 | + |
2084 | /* Commands */ |
2085 | #define TI_GET_VERSION 0x01 |
2086 | #define TI_GET_PORT_STATUS 0x02 |
2087 | diff --git a/fs/proc/array.c b/fs/proc/array.c |
2088 | index fd02a9ebfc30..70f9c4cba31f 100644 |
2089 | --- a/fs/proc/array.c |
2090 | +++ b/fs/proc/array.c |
2091 | @@ -364,7 +364,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, |
2092 | static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, |
2093 | struct pid *pid, struct task_struct *task, int whole) |
2094 | { |
2095 | - unsigned long vsize, eip, esp, wchan = ~0UL; |
2096 | + unsigned long vsize, eip, esp, wchan = 0; |
2097 | int priority, nice; |
2098 | int tty_pgrp = -1, tty_nr = 0; |
2099 | sigset_t sigign, sigcatch; |
2100 | @@ -496,7 +496,19 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, |
2101 | seq_put_decimal_ull(m, ' ', task->blocked.sig[0] & 0x7fffffffUL); |
2102 | seq_put_decimal_ull(m, ' ', sigign.sig[0] & 0x7fffffffUL); |
2103 | seq_put_decimal_ull(m, ' ', sigcatch.sig[0] & 0x7fffffffUL); |
2104 | - seq_put_decimal_ull(m, ' ', wchan); |
2105 | + |
2106 | + /* |
2107 | + * We used to output the absolute kernel address, but that's an |
2108 | + * information leak - so instead we show a 0/1 flag here, to signal |
2109 | + * to user-space whether there's a wchan field in /proc/PID/wchan. |
2110 | + * |
2111 | + * This works with older implementations of procps as well. |
2112 | + */ |
2113 | + if (wchan) |
2114 | + seq_puts(m, " 1"); |
2115 | + else |
2116 | + seq_puts(m, " 0"); |
2117 | + |
2118 | seq_put_decimal_ull(m, ' ', 0); |
2119 | seq_put_decimal_ull(m, ' ', 0); |
2120 | seq_put_decimal_ll(m, ' ', task->exit_signal); |
2121 | diff --git a/fs/proc/base.c b/fs/proc/base.c |
2122 | index 093ca14f5701..fcdeb1eb3921 100644 |
2123 | --- a/fs/proc/base.c |
2124 | +++ b/fs/proc/base.c |
2125 | @@ -238,13 +238,10 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, |
2126 | |
2127 | wchan = get_wchan(task); |
2128 | |
2129 | - if (lookup_symbol_name(wchan, symname) < 0) { |
2130 | - if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
2131 | - return 0; |
2132 | - seq_printf(m, "%lu", wchan); |
2133 | - } else { |
2134 | + if (wchan && ptrace_may_access(task, PTRACE_MODE_READ) && !lookup_symbol_name(wchan, symname)) |
2135 | seq_printf(m, "%s", symname); |
2136 | - } |
2137 | + else |
2138 | + seq_putc(m, '0'); |
2139 | |
2140 | return 0; |
2141 | } |
2142 | diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
2143 | index ad45054309a0..29a57a5b7cee 100644 |
2144 | --- a/include/linux/kvm_host.h |
2145 | +++ b/include/linux/kvm_host.h |
2146 | @@ -423,6 +423,17 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) |
2147 | (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ |
2148 | idx++) |
2149 | |
2150 | +static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) |
2151 | +{ |
2152 | + struct kvm_vcpu *vcpu; |
2153 | + int i; |
2154 | + |
2155 | + kvm_for_each_vcpu(i, vcpu, kvm) |
2156 | + if (vcpu->vcpu_id == id) |
2157 | + return vcpu; |
2158 | + return NULL; |
2159 | +} |
2160 | + |
2161 | #define kvm_for_each_memslot(memslot, slots) \ |
2162 | for (memslot = &slots->memslots[0]; \ |
2163 | memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\ |
2164 | diff --git a/include/linux/tty.h b/include/linux/tty.h |
2165 | index d76631f615c2..9580c09afdbe 100644 |
2166 | --- a/include/linux/tty.h |
2167 | +++ b/include/linux/tty.h |
2168 | @@ -605,7 +605,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); |
2169 | |
2170 | /* tty_audit.c */ |
2171 | #ifdef CONFIG_AUDIT |
2172 | -extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, |
2173 | +extern void tty_audit_add_data(struct tty_struct *tty, const void *data, |
2174 | size_t size, unsigned icanon); |
2175 | extern void tty_audit_exit(void); |
2176 | extern void tty_audit_fork(struct signal_struct *sig); |
2177 | @@ -613,8 +613,8 @@ extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); |
2178 | extern void tty_audit_push(struct tty_struct *tty); |
2179 | extern int tty_audit_push_current(void); |
2180 | #else |
2181 | -static inline void tty_audit_add_data(struct tty_struct *tty, |
2182 | - unsigned char *data, size_t size, unsigned icanon) |
2183 | +static inline void tty_audit_add_data(struct tty_struct *tty, const void *data, |
2184 | + size_t size, unsigned icanon) |
2185 | { |
2186 | } |
2187 | static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) |
2188 | diff --git a/include/net/inet_common.h b/include/net/inet_common.h |
2189 | index 4a92423eefa5..82669da2540c 100644 |
2190 | --- a/include/net/inet_common.h |
2191 | +++ b/include/net/inet_common.h |
2192 | @@ -41,7 +41,8 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, |
2193 | |
2194 | static inline void inet_ctl_sock_destroy(struct sock *sk) |
2195 | { |
2196 | - sk_release_kernel(sk); |
2197 | + if (sk) |
2198 | + sk_release_kernel(sk); |
2199 | } |
2200 | |
2201 | #endif |
2202 | diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c |
2203 | index 9070dfd6b4ad..4a0015e16d4f 100644 |
2204 | --- a/net/bluetooth/hidp/core.c |
2205 | +++ b/net/bluetooth/hidp/core.c |
2206 | @@ -401,6 +401,20 @@ static void hidp_idle_timeout(unsigned long arg) |
2207 | { |
2208 | struct hidp_session *session = (struct hidp_session *) arg; |
2209 | |
2210 | + /* The HIDP user-space API only contains calls to add and remove |
2211 | + * devices. There is no way to forward events of any kind. Therefore, |
2212 | + * we have to forcefully disconnect a device on idle-timeouts. This is |
2213 | + * unfortunate and weird API design, but it is spec-compliant and |
2214 | + * required for backwards-compatibility. Hence, on idle-timeout, we |
2215 | + * signal driver-detach events, so poll() will be woken up with an |
2216 | + * error-condition on both sockets. |
2217 | + */ |
2218 | + |
2219 | + session->intr_sock->sk->sk_err = EUNATCH; |
2220 | + session->ctrl_sock->sk->sk_err = EUNATCH; |
2221 | + wake_up_interruptible(sk_sleep(session->intr_sock->sk)); |
2222 | + wake_up_interruptible(sk_sleep(session->ctrl_sock->sk)); |
2223 | + |
2224 | hidp_session_terminate(session); |
2225 | } |
2226 | |
2227 | diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c |
2228 | index 7fd87e7135b5..58d60cbbc33f 100644 |
2229 | --- a/net/bluetooth/mgmt.c |
2230 | +++ b/net/bluetooth/mgmt.c |
2231 | @@ -2962,6 +2962,11 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, |
2232 | } else { |
2233 | u8 addr_type; |
2234 | |
2235 | + if (cp->addr.type == BDADDR_LE_PUBLIC) |
2236 | + addr_type = ADDR_LE_DEV_PUBLIC; |
2237 | + else |
2238 | + addr_type = ADDR_LE_DEV_RANDOM; |
2239 | + |
2240 | conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, |
2241 | &cp->addr.bdaddr); |
2242 | if (conn) { |
2243 | @@ -2977,13 +2982,10 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, |
2244 | */ |
2245 | if (!cp->disconnect) |
2246 | conn = NULL; |
2247 | + } else { |
2248 | + hci_conn_params_del(hdev, &cp->addr.bdaddr, addr_type); |
2249 | } |
2250 | |
2251 | - if (cp->addr.type == BDADDR_LE_PUBLIC) |
2252 | - addr_type = ADDR_LE_DEV_PUBLIC; |
2253 | - else |
2254 | - addr_type = ADDR_LE_DEV_RANDOM; |
2255 | - |
2256 | hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type); |
2257 | |
2258 | err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type); |
2259 | diff --git a/net/core/dst.c b/net/core/dst.c |
2260 | index e956ce6d1378..f8db4032d45a 100644 |
2261 | --- a/net/core/dst.c |
2262 | +++ b/net/core/dst.c |
2263 | @@ -285,7 +285,7 @@ void dst_release(struct dst_entry *dst) |
2264 | |
2265 | newrefcnt = atomic_dec_return(&dst->__refcnt); |
2266 | WARN_ON(newrefcnt < 0); |
2267 | - if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) |
2268 | + if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE)) |
2269 | call_rcu(&dst->rcu_head, dst_destroy_rcu); |
2270 | } |
2271 | } |
2272 | diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c |
2273 | index 0ca933db1b41..93b802984819 100644 |
2274 | --- a/net/ipv4/fib_trie.c |
2275 | +++ b/net/ipv4/fib_trie.c |
2276 | @@ -1547,7 +1547,7 @@ static struct key_vector *leaf_walk_rcu(struct key_vector **tn, t_key key) |
2277 | do { |
2278 | /* record parent and next child index */ |
2279 | pn = n; |
2280 | - cindex = key ? get_index(key, pn) : 0; |
2281 | + cindex = (key > pn->key) ? get_index(key, pn) : 0; |
2282 | |
2283 | if (cindex >> pn->bits) |
2284 | break; |
2285 | diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c |
2286 | index 5aa46d4b44ef..5a8ee3282550 100644 |
2287 | --- a/net/ipv4/gre_offload.c |
2288 | +++ b/net/ipv4/gre_offload.c |
2289 | @@ -36,7 +36,8 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, |
2290 | SKB_GSO_TCP_ECN | |
2291 | SKB_GSO_GRE | |
2292 | SKB_GSO_GRE_CSUM | |
2293 | - SKB_GSO_IPIP))) |
2294 | + SKB_GSO_IPIP | |
2295 | + SKB_GSO_SIT))) |
2296 | goto out; |
2297 | |
2298 | if (!skb->encapsulation) |
2299 | diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c |
2300 | index 3a2c0162c3ba..df28693f32e1 100644 |
2301 | --- a/net/ipv4/ipmr.c |
2302 | +++ b/net/ipv4/ipmr.c |
2303 | @@ -1683,8 +1683,8 @@ static inline int ipmr_forward_finish(struct sock *sk, struct sk_buff *skb) |
2304 | { |
2305 | struct ip_options *opt = &(IPCB(skb)->opt); |
2306 | |
2307 | - IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); |
2308 | - IP_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len); |
2309 | + IP_INC_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); |
2310 | + IP_ADD_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len); |
2311 | |
2312 | if (unlikely(opt->optlen)) |
2313 | ip_forward_options(skb); |
2314 | @@ -1746,7 +1746,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, |
2315 | * to blackhole. |
2316 | */ |
2317 | |
2318 | - IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_FRAGFAILS); |
2319 | + IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); |
2320 | ip_rt_put(rt); |
2321 | goto out_free; |
2322 | } |
2323 | diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c |
2324 | index c3852a7ff3c7..f0e829735968 100644 |
2325 | --- a/net/ipv4/sysctl_net_ipv4.c |
2326 | +++ b/net/ipv4/sysctl_net_ipv4.c |
2327 | @@ -45,10 +45,10 @@ static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; |
2328 | /* Update system visible IP port range */ |
2329 | static void set_local_port_range(struct net *net, int range[2]) |
2330 | { |
2331 | - write_seqlock(&net->ipv4.ip_local_ports.lock); |
2332 | + write_seqlock_bh(&net->ipv4.ip_local_ports.lock); |
2333 | net->ipv4.ip_local_ports.range[0] = range[0]; |
2334 | net->ipv4.ip_local_ports.range[1] = range[1]; |
2335 | - write_sequnlock(&net->ipv4.ip_local_ports.lock); |
2336 | + write_sequnlock_bh(&net->ipv4.ip_local_ports.lock); |
2337 | } |
2338 | |
2339 | /* Validate changes from /proc interface. */ |
2340 | diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
2341 | index 37b70e82bff8..fd3aa6148dd1 100644 |
2342 | --- a/net/ipv6/addrconf.c |
2343 | +++ b/net/ipv6/addrconf.c |
2344 | @@ -411,6 +411,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) |
2345 | if (err) { |
2346 | ipv6_mc_destroy_dev(ndev); |
2347 | del_timer(&ndev->regen_timer); |
2348 | + snmp6_unregister_dev(ndev); |
2349 | goto err_release; |
2350 | } |
2351 | /* protected by rtnl_lock */ |
2352 | diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c |
2353 | index ac35a28599be..85c4b2fff504 100644 |
2354 | --- a/net/ipv6/sit.c |
2355 | +++ b/net/ipv6/sit.c |
2356 | @@ -1394,34 +1394,20 @@ static int ipip6_tunnel_init(struct net_device *dev) |
2357 | return 0; |
2358 | } |
2359 | |
2360 | -static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) |
2361 | +static void __net_init ipip6_fb_tunnel_init(struct net_device *dev) |
2362 | { |
2363 | struct ip_tunnel *tunnel = netdev_priv(dev); |
2364 | struct iphdr *iph = &tunnel->parms.iph; |
2365 | struct net *net = dev_net(dev); |
2366 | struct sit_net *sitn = net_generic(net, sit_net_id); |
2367 | |
2368 | - tunnel->dev = dev; |
2369 | - tunnel->net = dev_net(dev); |
2370 | - |
2371 | iph->version = 4; |
2372 | iph->protocol = IPPROTO_IPV6; |
2373 | iph->ihl = 5; |
2374 | iph->ttl = 64; |
2375 | |
2376 | - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
2377 | - if (!dev->tstats) |
2378 | - return -ENOMEM; |
2379 | - |
2380 | - tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst); |
2381 | - if (!tunnel->dst_cache) { |
2382 | - free_percpu(dev->tstats); |
2383 | - return -ENOMEM; |
2384 | - } |
2385 | - |
2386 | dev_hold(dev); |
2387 | rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); |
2388 | - return 0; |
2389 | } |
2390 | |
2391 | static int ipip6_validate(struct nlattr *tb[], struct nlattr *data[]) |
2392 | @@ -1831,23 +1817,19 @@ static int __net_init sit_init_net(struct net *net) |
2393 | */ |
2394 | sitn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; |
2395 | |
2396 | - err = ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); |
2397 | - if (err) |
2398 | - goto err_dev_free; |
2399 | - |
2400 | - ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); |
2401 | err = register_netdev(sitn->fb_tunnel_dev); |
2402 | if (err) |
2403 | goto err_reg_dev; |
2404 | |
2405 | + ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); |
2406 | + ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); |
2407 | + |
2408 | t = netdev_priv(sitn->fb_tunnel_dev); |
2409 | |
2410 | strcpy(t->parms.name, sitn->fb_tunnel_dev->name); |
2411 | return 0; |
2412 | |
2413 | err_reg_dev: |
2414 | - dev_put(sitn->fb_tunnel_dev); |
2415 | -err_dev_free: |
2416 | ipip6_dev_free(sitn->fb_tunnel_dev); |
2417 | err_alloc_dev: |
2418 | return err; |
2419 | diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c |
2420 | index a26c401ef4a4..43964594aa12 100644 |
2421 | --- a/net/irda/irlmp.c |
2422 | +++ b/net/irda/irlmp.c |
2423 | @@ -1839,7 +1839,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off) |
2424 | for (element = hashbin_get_first(iter->hashbin); |
2425 | element != NULL; |
2426 | element = hashbin_get_next(iter->hashbin)) { |
2427 | - if (!off || *off-- == 0) { |
2428 | + if (!off || (*off)-- == 0) { |
2429 | /* NB: hashbin left locked */ |
2430 | return element; |
2431 | } |
2432 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
2433 | index 26053bf2faa8..a93906103f8b 100644 |
2434 | --- a/net/mac80211/mlme.c |
2435 | +++ b/net/mac80211/mlme.c |
2436 | @@ -3340,7 +3340,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, |
2437 | |
2438 | if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && |
2439 | ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { |
2440 | - int sig = ifmgd->ave_beacon_signal; |
2441 | + int sig = ifmgd->ave_beacon_signal / 16; |
2442 | int last_sig = ifmgd->last_ave_beacon_signal; |
2443 | struct ieee80211_event event = { |
2444 | .type = RSSI_EVENT, |
2445 | @@ -4946,6 +4946,25 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, |
2446 | return 0; |
2447 | } |
2448 | |
2449 | + if (ifmgd->assoc_data && |
2450 | + ether_addr_equal(ifmgd->assoc_data->bss->bssid, req->bssid)) { |
2451 | + sdata_info(sdata, |
2452 | + "aborting association with %pM by local choice (Reason: %u=%s)\n", |
2453 | + req->bssid, req->reason_code, |
2454 | + ieee80211_get_reason_code_string(req->reason_code)); |
2455 | + |
2456 | + drv_mgd_prepare_tx(sdata->local, sdata); |
2457 | + ieee80211_send_deauth_disassoc(sdata, req->bssid, |
2458 | + IEEE80211_STYPE_DEAUTH, |
2459 | + req->reason_code, tx, |
2460 | + frame_buf); |
2461 | + ieee80211_destroy_assoc_data(sdata, false); |
2462 | + ieee80211_report_disconnect(sdata, frame_buf, |
2463 | + sizeof(frame_buf), true, |
2464 | + req->reason_code); |
2465 | + return 0; |
2466 | + } |
2467 | + |
2468 | if (ifmgd->associated && |
2469 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { |
2470 | sdata_info(sdata, |
2471 | diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
2472 | index 4c2e7690226a..ab19f3c2104d 100644 |
2473 | --- a/net/mac80211/trace.h |
2474 | +++ b/net/mac80211/trace.h |
2475 | @@ -33,11 +33,11 @@ |
2476 | __field(u32, chan_width) \ |
2477 | __field(u32, center_freq1) \ |
2478 | __field(u32, center_freq2) |
2479 | -#define CHANDEF_ASSIGN(c) \ |
2480 | - __entry->control_freq = (c)->chan ? (c)->chan->center_freq : 0; \ |
2481 | - __entry->chan_width = (c)->width; \ |
2482 | - __entry->center_freq1 = (c)->center_freq1; \ |
2483 | - __entry->center_freq2 = (c)->center_freq2; |
2484 | +#define CHANDEF_ASSIGN(c) \ |
2485 | + __entry->control_freq = (c) ? ((c)->chan ? (c)->chan->center_freq : 0) : 0; \ |
2486 | + __entry->chan_width = (c) ? (c)->width : 0; \ |
2487 | + __entry->center_freq1 = (c) ? (c)->center_freq1 : 0; \ |
2488 | + __entry->center_freq2 = (c) ? (c)->center_freq2 : 0; |
2489 | #define CHANDEF_PR_FMT " control:%d MHz width:%d center: %d/%d MHz" |
2490 | #define CHANDEF_PR_ARG __entry->control_freq, __entry->chan_width, \ |
2491 | __entry->center_freq1, __entry->center_freq2 |
2492 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
2493 | index b864ebc6ab8f..67fec9ba97fc 100644 |
2494 | --- a/net/mac80211/util.c |
2495 | +++ b/net/mac80211/util.c |
2496 | @@ -2984,6 +2984,13 @@ ieee80211_extend_noa_desc(struct ieee80211_noa_data *data, u32 tsf, int i) |
2497 | if (end > 0) |
2498 | return false; |
2499 | |
2500 | + /* One shot NOA */ |
2501 | + if (data->count[i] == 1) |
2502 | + return false; |
2503 | + |
2504 | + if (data->desc[i].interval == 0) |
2505 | + return false; |
2506 | + |
2507 | /* End time is in the past, check for repetitions */ |
2508 | skip = DIV_ROUND_UP(-end, data->desc[i].interval); |
2509 | if (data->count[i] < 255) { |
2510 | diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
2511 | index d139c43ac6e5..0d6038c87bef 100644 |
2512 | --- a/net/netlink/af_netlink.c |
2513 | +++ b/net/netlink/af_netlink.c |
2514 | @@ -1118,6 +1118,7 @@ static int netlink_insert(struct sock *sk, u32 portid) |
2515 | if (err == -EEXIST) |
2516 | err = -EADDRINUSE; |
2517 | sock_put(sk); |
2518 | + goto err; |
2519 | } |
2520 | |
2521 | /* We need to ensure that the socket is hashed and visible. */ |
2522 | diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c |
2523 | index b33fed6d1584..91ecbd1c2ec1 100644 |
2524 | --- a/net/nfc/nci/hci.c |
2525 | +++ b/net/nfc/nci/hci.c |
2526 | @@ -101,6 +101,20 @@ struct nci_hcp_packet { |
2527 | #define NCI_HCP_MSG_GET_CMD(header) (header & 0x3f) |
2528 | #define NCI_HCP_MSG_GET_PIPE(header) (header & 0x7f) |
2529 | |
2530 | +static int nci_hci_result_to_errno(u8 result) |
2531 | +{ |
2532 | + switch (result) { |
2533 | + case NCI_HCI_ANY_OK: |
2534 | + return 0; |
2535 | + case NCI_HCI_ANY_E_REG_PAR_UNKNOWN: |
2536 | + return -EOPNOTSUPP; |
2537 | + case NCI_HCI_ANY_E_TIMEOUT: |
2538 | + return -ETIME; |
2539 | + default: |
2540 | + return -1; |
2541 | + } |
2542 | +} |
2543 | + |
2544 | /* HCI core */ |
2545 | static void nci_hci_reset_pipes(struct nci_hci_dev *hdev) |
2546 | { |
2547 | @@ -146,18 +160,18 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, |
2548 | if (!conn_info) |
2549 | return -EPROTO; |
2550 | |
2551 | - skb = nci_skb_alloc(ndev, 2 + conn_info->max_pkt_payload_len + |
2552 | + i = 0; |
2553 | + skb = nci_skb_alloc(ndev, conn_info->max_pkt_payload_len + |
2554 | NCI_DATA_HDR_SIZE, GFP_KERNEL); |
2555 | if (!skb) |
2556 | return -ENOMEM; |
2557 | |
2558 | - skb_reserve(skb, 2 + NCI_DATA_HDR_SIZE); |
2559 | + skb_reserve(skb, NCI_DATA_HDR_SIZE + 2); |
2560 | *skb_push(skb, 1) = data_type; |
2561 | |
2562 | - i = 0; |
2563 | - len = conn_info->max_pkt_payload_len; |
2564 | - |
2565 | do { |
2566 | + len = conn_info->max_pkt_payload_len; |
2567 | + |
2568 | /* If last packet add NCI_HFP_NO_CHAINING */ |
2569 | if (i + conn_info->max_pkt_payload_len - |
2570 | (skb->len + 1) >= data_len) { |
2571 | @@ -177,9 +191,15 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, |
2572 | return r; |
2573 | |
2574 | i += len; |
2575 | + |
2576 | if (i < data_len) { |
2577 | - skb_trim(skb, 0); |
2578 | - skb_pull(skb, len); |
2579 | + skb = nci_skb_alloc(ndev, |
2580 | + conn_info->max_pkt_payload_len + |
2581 | + NCI_DATA_HDR_SIZE, GFP_KERNEL); |
2582 | + if (!skb) |
2583 | + return -ENOMEM; |
2584 | + |
2585 | + skb_reserve(skb, NCI_DATA_HDR_SIZE + 1); |
2586 | } |
2587 | } while (i < data_len); |
2588 | |
2589 | @@ -212,7 +232,8 @@ int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, u8 cmd, |
2590 | const u8 *param, size_t param_len, |
2591 | struct sk_buff **skb) |
2592 | { |
2593 | - struct nci_conn_info *conn_info; |
2594 | + struct nci_hcp_message *message; |
2595 | + struct nci_conn_info *conn_info; |
2596 | struct nci_data data; |
2597 | int r; |
2598 | u8 pipe = ndev->hci_dev->gate2pipe[gate]; |
2599 | @@ -232,9 +253,15 @@ int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, u8 cmd, |
2600 | |
2601 | r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, |
2602 | msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
2603 | - |
2604 | - if (r == NCI_STATUS_OK && skb) |
2605 | - *skb = conn_info->rx_skb; |
2606 | + if (r == NCI_STATUS_OK) { |
2607 | + message = (struct nci_hcp_message *)conn_info->rx_skb->data; |
2608 | + r = nci_hci_result_to_errno( |
2609 | + NCI_HCP_MSG_GET_CMD(message->header)); |
2610 | + skb_pull(conn_info->rx_skb, NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
2611 | + |
2612 | + if (!r && skb) |
2613 | + *skb = conn_info->rx_skb; |
2614 | + } |
2615 | |
2616 | return r; |
2617 | } |
2618 | @@ -328,9 +355,6 @@ static void nci_hci_resp_received(struct nci_dev *ndev, u8 pipe, |
2619 | struct nci_conn_info *conn_info; |
2620 | u8 status = result; |
2621 | |
2622 | - if (result != NCI_HCI_ANY_OK) |
2623 | - goto exit; |
2624 | - |
2625 | conn_info = ndev->hci_dev->conn_info; |
2626 | if (!conn_info) { |
2627 | status = NCI_STATUS_REJECTED; |
2628 | @@ -340,7 +364,7 @@ static void nci_hci_resp_received(struct nci_dev *ndev, u8 pipe, |
2629 | conn_info->rx_skb = skb; |
2630 | |
2631 | exit: |
2632 | - nci_req_complete(ndev, status); |
2633 | + nci_req_complete(ndev, NCI_STATUS_OK); |
2634 | } |
2635 | |
2636 | /* Receive hcp message for pipe, with type and cmd. |
2637 | @@ -378,7 +402,7 @@ static void nci_hci_msg_rx_work(struct work_struct *work) |
2638 | u8 pipe, type, instruction; |
2639 | |
2640 | while ((skb = skb_dequeue(&hdev->msg_rx_queue)) != NULL) { |
2641 | - pipe = skb->data[0]; |
2642 | + pipe = NCI_HCP_MSG_GET_PIPE(skb->data[0]); |
2643 | skb_pull(skb, NCI_HCI_HCP_PACKET_HEADER_LEN); |
2644 | message = (struct nci_hcp_message *)skb->data; |
2645 | type = NCI_HCP_MSG_GET_TYPE(message->header); |
2646 | @@ -395,7 +419,7 @@ void nci_hci_data_received_cb(void *context, |
2647 | { |
2648 | struct nci_dev *ndev = (struct nci_dev *)context; |
2649 | struct nci_hcp_packet *packet; |
2650 | - u8 pipe, type, instruction; |
2651 | + u8 pipe, type; |
2652 | struct sk_buff *hcp_skb; |
2653 | struct sk_buff *frag_skb; |
2654 | int msg_len; |
2655 | @@ -415,7 +439,7 @@ void nci_hci_data_received_cb(void *context, |
2656 | |
2657 | /* it's the last fragment. Does it need re-aggregation? */ |
2658 | if (skb_queue_len(&ndev->hci_dev->rx_hcp_frags)) { |
2659 | - pipe = packet->header & NCI_HCI_FRAGMENT; |
2660 | + pipe = NCI_HCP_MSG_GET_PIPE(packet->header); |
2661 | skb_queue_tail(&ndev->hci_dev->rx_hcp_frags, skb); |
2662 | |
2663 | msg_len = 0; |
2664 | @@ -434,7 +458,7 @@ void nci_hci_data_received_cb(void *context, |
2665 | *skb_put(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN) = pipe; |
2666 | |
2667 | skb_queue_walk(&ndev->hci_dev->rx_hcp_frags, frag_skb) { |
2668 | - msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; |
2669 | + msg_len = frag_skb->len - NCI_HCI_HCP_PACKET_HEADER_LEN; |
2670 | memcpy(skb_put(hcp_skb, msg_len), frag_skb->data + |
2671 | NCI_HCI_HCP_PACKET_HEADER_LEN, msg_len); |
2672 | } |
2673 | @@ -452,11 +476,10 @@ void nci_hci_data_received_cb(void *context, |
2674 | packet = (struct nci_hcp_packet *)hcp_skb->data; |
2675 | type = NCI_HCP_MSG_GET_TYPE(packet->message.header); |
2676 | if (type == NCI_HCI_HCP_RESPONSE) { |
2677 | - pipe = packet->header; |
2678 | - instruction = NCI_HCP_MSG_GET_CMD(packet->message.header); |
2679 | - skb_pull(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN + |
2680 | - NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
2681 | - nci_hci_hcp_message_rx(ndev, pipe, type, instruction, hcp_skb); |
2682 | + pipe = NCI_HCP_MSG_GET_PIPE(packet->header); |
2683 | + skb_pull(hcp_skb, NCI_HCI_HCP_PACKET_HEADER_LEN); |
2684 | + nci_hci_hcp_message_rx(ndev, pipe, type, |
2685 | + NCI_STATUS_OK, hcp_skb); |
2686 | } else { |
2687 | skb_queue_tail(&ndev->hci_dev->msg_rx_queue, hcp_skb); |
2688 | schedule_work(&ndev->hci_dev->msg_rx_work); |
2689 | @@ -488,6 +511,7 @@ EXPORT_SYMBOL(nci_hci_open_pipe); |
2690 | int nci_hci_set_param(struct nci_dev *ndev, u8 gate, u8 idx, |
2691 | const u8 *param, size_t param_len) |
2692 | { |
2693 | + struct nci_hcp_message *message; |
2694 | struct nci_conn_info *conn_info; |
2695 | struct nci_data data; |
2696 | int r; |
2697 | @@ -520,6 +544,12 @@ int nci_hci_set_param(struct nci_dev *ndev, u8 gate, u8 idx, |
2698 | r = nci_request(ndev, nci_hci_send_data_req, |
2699 | (unsigned long)&data, |
2700 | msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
2701 | + if (r == NCI_STATUS_OK) { |
2702 | + message = (struct nci_hcp_message *)conn_info->rx_skb->data; |
2703 | + r = nci_hci_result_to_errno( |
2704 | + NCI_HCP_MSG_GET_CMD(message->header)); |
2705 | + skb_pull(conn_info->rx_skb, NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
2706 | + } |
2707 | |
2708 | kfree(tmp); |
2709 | return r; |
2710 | @@ -529,6 +559,7 @@ EXPORT_SYMBOL(nci_hci_set_param); |
2711 | int nci_hci_get_param(struct nci_dev *ndev, u8 gate, u8 idx, |
2712 | struct sk_buff **skb) |
2713 | { |
2714 | + struct nci_hcp_message *message; |
2715 | struct nci_conn_info *conn_info; |
2716 | struct nci_data data; |
2717 | int r; |
2718 | @@ -553,8 +584,15 @@ int nci_hci_get_param(struct nci_dev *ndev, u8 gate, u8 idx, |
2719 | r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data, |
2720 | msecs_to_jiffies(NCI_DATA_TIMEOUT)); |
2721 | |
2722 | - if (r == NCI_STATUS_OK) |
2723 | - *skb = conn_info->rx_skb; |
2724 | + if (r == NCI_STATUS_OK) { |
2725 | + message = (struct nci_hcp_message *)conn_info->rx_skb->data; |
2726 | + r = nci_hci_result_to_errno( |
2727 | + NCI_HCP_MSG_GET_CMD(message->header)); |
2728 | + skb_pull(conn_info->rx_skb, NCI_HCI_HCP_MESSAGE_HEADER_LEN); |
2729 | + |
2730 | + if (!r && skb) |
2731 | + *skb = conn_info->rx_skb; |
2732 | + } |
2733 | |
2734 | return r; |
2735 | } |
2736 | diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
2737 | index e1ea5d43b01e..686e60187401 100644 |
2738 | --- a/net/packet/af_packet.c |
2739 | +++ b/net/packet/af_packet.c |
2740 | @@ -2686,22 +2686,40 @@ static int packet_release(struct socket *sock) |
2741 | * Attach a packet hook. |
2742 | */ |
2743 | |
2744 | -static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
2745 | +static int packet_do_bind(struct sock *sk, const char *name, int ifindex, |
2746 | + __be16 proto) |
2747 | { |
2748 | struct packet_sock *po = pkt_sk(sk); |
2749 | struct net_device *dev_curr; |
2750 | __be16 proto_curr; |
2751 | bool need_rehook; |
2752 | + struct net_device *dev = NULL; |
2753 | + int ret = 0; |
2754 | + bool unlisted = false; |
2755 | |
2756 | - if (po->fanout) { |
2757 | - if (dev) |
2758 | - dev_put(dev); |
2759 | - |
2760 | + if (po->fanout) |
2761 | return -EINVAL; |
2762 | - } |
2763 | |
2764 | lock_sock(sk); |
2765 | spin_lock(&po->bind_lock); |
2766 | + rcu_read_lock(); |
2767 | + |
2768 | + if (name) { |
2769 | + dev = dev_get_by_name_rcu(sock_net(sk), name); |
2770 | + if (!dev) { |
2771 | + ret = -ENODEV; |
2772 | + goto out_unlock; |
2773 | + } |
2774 | + } else if (ifindex) { |
2775 | + dev = dev_get_by_index_rcu(sock_net(sk), ifindex); |
2776 | + if (!dev) { |
2777 | + ret = -ENODEV; |
2778 | + goto out_unlock; |
2779 | + } |
2780 | + } |
2781 | + |
2782 | + if (dev) |
2783 | + dev_hold(dev); |
2784 | |
2785 | proto_curr = po->prot_hook.type; |
2786 | dev_curr = po->prot_hook.dev; |
2787 | @@ -2709,14 +2727,29 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
2788 | need_rehook = proto_curr != proto || dev_curr != dev; |
2789 | |
2790 | if (need_rehook) { |
2791 | - unregister_prot_hook(sk, true); |
2792 | + if (po->running) { |
2793 | + rcu_read_unlock(); |
2794 | + __unregister_prot_hook(sk, true); |
2795 | + rcu_read_lock(); |
2796 | + dev_curr = po->prot_hook.dev; |
2797 | + if (dev) |
2798 | + unlisted = !dev_get_by_index_rcu(sock_net(sk), |
2799 | + dev->ifindex); |
2800 | + } |
2801 | |
2802 | po->num = proto; |
2803 | po->prot_hook.type = proto; |
2804 | - po->prot_hook.dev = dev; |
2805 | |
2806 | - po->ifindex = dev ? dev->ifindex : 0; |
2807 | - packet_cached_dev_assign(po, dev); |
2808 | + if (unlikely(unlisted)) { |
2809 | + dev_put(dev); |
2810 | + po->prot_hook.dev = NULL; |
2811 | + po->ifindex = -1; |
2812 | + packet_cached_dev_reset(po); |
2813 | + } else { |
2814 | + po->prot_hook.dev = dev; |
2815 | + po->ifindex = dev ? dev->ifindex : 0; |
2816 | + packet_cached_dev_assign(po, dev); |
2817 | + } |
2818 | } |
2819 | if (dev_curr) |
2820 | dev_put(dev_curr); |
2821 | @@ -2724,7 +2757,7 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
2822 | if (proto == 0 || !need_rehook) |
2823 | goto out_unlock; |
2824 | |
2825 | - if (!dev || (dev->flags & IFF_UP)) { |
2826 | + if (!unlisted && (!dev || (dev->flags & IFF_UP))) { |
2827 | register_prot_hook(sk); |
2828 | } else { |
2829 | sk->sk_err = ENETDOWN; |
2830 | @@ -2733,9 +2766,10 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) |
2831 | } |
2832 | |
2833 | out_unlock: |
2834 | + rcu_read_unlock(); |
2835 | spin_unlock(&po->bind_lock); |
2836 | release_sock(sk); |
2837 | - return 0; |
2838 | + return ret; |
2839 | } |
2840 | |
2841 | /* |
2842 | @@ -2747,8 +2781,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, |
2843 | { |
2844 | struct sock *sk = sock->sk; |
2845 | char name[15]; |
2846 | - struct net_device *dev; |
2847 | - int err = -ENODEV; |
2848 | |
2849 | /* |
2850 | * Check legality |
2851 | @@ -2758,19 +2790,13 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, |
2852 | return -EINVAL; |
2853 | strlcpy(name, uaddr->sa_data, sizeof(name)); |
2854 | |
2855 | - dev = dev_get_by_name(sock_net(sk), name); |
2856 | - if (dev) |
2857 | - err = packet_do_bind(sk, dev, pkt_sk(sk)->num); |
2858 | - return err; |
2859 | + return packet_do_bind(sk, name, 0, pkt_sk(sk)->num); |
2860 | } |
2861 | |
2862 | static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
2863 | { |
2864 | struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr; |
2865 | struct sock *sk = sock->sk; |
2866 | - struct net_device *dev = NULL; |
2867 | - int err; |
2868 | - |
2869 | |
2870 | /* |
2871 | * Check legality |
2872 | @@ -2781,16 +2807,8 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len |
2873 | if (sll->sll_family != AF_PACKET) |
2874 | return -EINVAL; |
2875 | |
2876 | - if (sll->sll_ifindex) { |
2877 | - err = -ENODEV; |
2878 | - dev = dev_get_by_index(sock_net(sk), sll->sll_ifindex); |
2879 | - if (dev == NULL) |
2880 | - goto out; |
2881 | - } |
2882 | - err = packet_do_bind(sk, dev, sll->sll_protocol ? : pkt_sk(sk)->num); |
2883 | - |
2884 | -out: |
2885 | - return err; |
2886 | + return packet_do_bind(sk, NULL, sll->sll_ifindex, |
2887 | + sll->sll_protocol ? : pkt_sk(sk)->num); |
2888 | } |
2889 | |
2890 | static struct proto packet_proto = { |
2891 | diff --git a/net/rds/connection.c b/net/rds/connection.c |
2892 | index da6da57e5f36..9d66705f9d41 100644 |
2893 | --- a/net/rds/connection.c |
2894 | +++ b/net/rds/connection.c |
2895 | @@ -187,6 +187,12 @@ new_conn: |
2896 | } |
2897 | } |
2898 | |
2899 | + if (trans == NULL) { |
2900 | + kmem_cache_free(rds_conn_slab, conn); |
2901 | + conn = ERR_PTR(-ENODEV); |
2902 | + goto out; |
2903 | + } |
2904 | + |
2905 | conn->c_trans = trans; |
2906 | |
2907 | ret = trans->conn_alloc(conn, gfp); |
2908 | diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c |
2909 | index fbc5ef88bc0e..27a992154804 100644 |
2910 | --- a/net/rds/tcp_recv.c |
2911 | +++ b/net/rds/tcp_recv.c |
2912 | @@ -214,8 +214,15 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb, |
2913 | } |
2914 | |
2915 | to_copy = min(tc->t_tinc_data_rem, left); |
2916 | - pskb_pull(clone, offset); |
2917 | - pskb_trim(clone, to_copy); |
2918 | + if (!pskb_pull(clone, offset) || |
2919 | + pskb_trim(clone, to_copy)) { |
2920 | + pr_warn("rds_tcp_data_recv: pull/trim failed " |
2921 | + "left %zu data_rem %zu skb_len %d\n", |
2922 | + left, tc->t_tinc_data_rem, skb->len); |
2923 | + kfree_skb(clone); |
2924 | + desc->error = -ENOMEM; |
2925 | + goto out; |
2926 | + } |
2927 | skb_queue_tail(&tinc->ti_skb_list, clone); |
2928 | |
2929 | rdsdebug("skb %p data %p len %d off %u to_copy %zu -> " |
2930 | diff --git a/net/tipc/msg.c b/net/tipc/msg.c |
2931 | index c3e96e815418..e9333147d6f1 100644 |
2932 | --- a/net/tipc/msg.c |
2933 | +++ b/net/tipc/msg.c |
2934 | @@ -121,7 +121,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) |
2935 | { |
2936 | struct sk_buff *head = *headbuf; |
2937 | struct sk_buff *frag = *buf; |
2938 | - struct sk_buff *tail; |
2939 | + struct sk_buff *tail = NULL; |
2940 | struct tipc_msg *msg; |
2941 | u32 fragid; |
2942 | int delta; |
2943 | @@ -141,9 +141,15 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) |
2944 | if (unlikely(skb_unclone(frag, GFP_ATOMIC))) |
2945 | goto err; |
2946 | head = *headbuf = frag; |
2947 | - skb_frag_list_init(head); |
2948 | - TIPC_SKB_CB(head)->tail = NULL; |
2949 | *buf = NULL; |
2950 | + TIPC_SKB_CB(head)->tail = NULL; |
2951 | + if (skb_is_nonlinear(head)) { |
2952 | + skb_walk_frags(head, tail) { |
2953 | + TIPC_SKB_CB(head)->tail = tail; |
2954 | + } |
2955 | + } else { |
2956 | + skb_frag_list_init(head); |
2957 | + } |
2958 | return 0; |
2959 | } |
2960 | |
2961 | diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c |
2962 | index 66deebc66aa1..f8dfee5072c0 100644 |
2963 | --- a/net/tipc/udp_media.c |
2964 | +++ b/net/tipc/udp_media.c |
2965 | @@ -48,6 +48,7 @@ |
2966 | #include <linux/tipc_netlink.h> |
2967 | #include "core.h" |
2968 | #include "bearer.h" |
2969 | +#include "msg.h" |
2970 | |
2971 | /* IANA assigned UDP port */ |
2972 | #define UDP_PORT_DEFAULT 6118 |
2973 | @@ -216,6 +217,10 @@ static int tipc_udp_recv(struct sock *sk, struct sk_buff *skb) |
2974 | { |
2975 | struct udp_bearer *ub; |
2976 | struct tipc_bearer *b; |
2977 | + int usr = msg_user(buf_msg(skb)); |
2978 | + |
2979 | + if ((usr == LINK_PROTOCOL) || (usr == NAME_DISTRIBUTOR)) |
2980 | + skb_linearize(skb); |
2981 | |
2982 | ub = rcu_dereference_sk_user_data(sk); |
2983 | if (!ub) { |
2984 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
2985 | index dd78445c7d50..04b6f3f6ee0b 100644 |
2986 | --- a/net/wireless/nl80211.c |
2987 | +++ b/net/wireless/nl80211.c |
2988 | @@ -3407,12 +3407,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) |
2989 | wdev->iftype)) |
2990 | return -EINVAL; |
2991 | |
2992 | - if (info->attrs[NL80211_ATTR_ACL_POLICY]) { |
2993 | - params.acl = parse_acl_data(&rdev->wiphy, info); |
2994 | - if (IS_ERR(params.acl)) |
2995 | - return PTR_ERR(params.acl); |
2996 | - } |
2997 | - |
2998 | if (info->attrs[NL80211_ATTR_SMPS_MODE]) { |
2999 | params.smps_mode = |
3000 | nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]); |
3001 | @@ -3436,6 +3430,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) |
3002 | params.smps_mode = NL80211_SMPS_OFF; |
3003 | } |
3004 | |
3005 | + if (info->attrs[NL80211_ATTR_ACL_POLICY]) { |
3006 | + params.acl = parse_acl_data(&rdev->wiphy, info); |
3007 | + if (IS_ERR(params.acl)) |
3008 | + return PTR_ERR(params.acl); |
3009 | + } |
3010 | + |
3011 | wdev_lock(wdev); |
3012 | err = rdev_start_ap(rdev, dev, ¶ms); |
3013 | if (!err) { |
3014 | diff --git a/sound/usb/midi.c b/sound/usb/midi.c |
3015 | index 417ebb11cf48..bec63e0d2605 100644 |
3016 | --- a/sound/usb/midi.c |
3017 | +++ b/sound/usb/midi.c |
3018 | @@ -174,6 +174,8 @@ struct snd_usb_midi_in_endpoint { |
3019 | u8 running_status_length; |
3020 | } ports[0x10]; |
3021 | u8 seen_f5; |
3022 | + bool in_sysex; |
3023 | + u8 last_cin; |
3024 | u8 error_resubmit; |
3025 | int current_port; |
3026 | }; |
3027 | @@ -468,6 +470,39 @@ static void snd_usbmidi_maudio_broken_running_status_input( |
3028 | } |
3029 | |
3030 | /* |
3031 | + * QinHeng CH345 is buggy: every second packet inside a SysEx has not CIN 4 |
3032 | + * but the previously seen CIN, but still with three data bytes. |
3033 | + */ |
3034 | +static void ch345_broken_sysex_input(struct snd_usb_midi_in_endpoint *ep, |
3035 | + uint8_t *buffer, int buffer_length) |
3036 | +{ |
3037 | + unsigned int i, cin, length; |
3038 | + |
3039 | + for (i = 0; i + 3 < buffer_length; i += 4) { |
3040 | + if (buffer[i] == 0 && i > 0) |
3041 | + break; |
3042 | + cin = buffer[i] & 0x0f; |
3043 | + if (ep->in_sysex && |
3044 | + cin == ep->last_cin && |
3045 | + (buffer[i + 1 + (cin == 0x6)] & 0x80) == 0) |
3046 | + cin = 0x4; |
3047 | +#if 0 |
3048 | + if (buffer[i + 1] == 0x90) { |
3049 | + /* |
3050 | + * Either a corrupted running status or a real note-on |
3051 | + * message; impossible to detect reliably. |
3052 | + */ |
3053 | + } |
3054 | +#endif |
3055 | + length = snd_usbmidi_cin_length[cin]; |
3056 | + snd_usbmidi_input_data(ep, 0, &buffer[i + 1], length); |
3057 | + ep->in_sysex = cin == 0x4; |
3058 | + if (!ep->in_sysex) |
3059 | + ep->last_cin = cin; |
3060 | + } |
3061 | +} |
3062 | + |
3063 | +/* |
3064 | * CME protocol: like the standard protocol, but SysEx commands are sent as a |
3065 | * single USB packet preceded by a 0x0F byte. |
3066 | */ |
3067 | @@ -660,6 +695,12 @@ static struct usb_protocol_ops snd_usbmidi_cme_ops = { |
3068 | .output_packet = snd_usbmidi_output_standard_packet, |
3069 | }; |
3070 | |
3071 | +static struct usb_protocol_ops snd_usbmidi_ch345_broken_sysex_ops = { |
3072 | + .input = ch345_broken_sysex_input, |
3073 | + .output = snd_usbmidi_standard_output, |
3074 | + .output_packet = snd_usbmidi_output_standard_packet, |
3075 | +}; |
3076 | + |
3077 | /* |
3078 | * AKAI MPD16 protocol: |
3079 | * |
3080 | @@ -1341,6 +1382,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi, |
3081 | * Various chips declare a packet size larger than 4 bytes, but |
3082 | * do not actually work with larger packets: |
3083 | */ |
3084 | + case USB_ID(0x0a67, 0x5011): /* Medeli DD305 */ |
3085 | case USB_ID(0x0a92, 0x1020): /* ESI M4U */ |
3086 | case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */ |
3087 | case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */ |
3088 | @@ -2375,6 +2417,10 @@ int snd_usbmidi_create(struct snd_card *card, |
3089 | |
3090 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
3091 | break; |
3092 | + case QUIRK_MIDI_CH345: |
3093 | + umidi->usb_protocol_ops = &snd_usbmidi_ch345_broken_sysex_ops; |
3094 | + err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
3095 | + break; |
3096 | default: |
3097 | dev_err(&umidi->dev->dev, "invalid quirk type %d\n", |
3098 | quirk->type); |
3099 | diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
3100 | index e4756651a52c..ecc2a4ea014d 100644 |
3101 | --- a/sound/usb/quirks-table.h |
3102 | +++ b/sound/usb/quirks-table.h |
3103 | @@ -2820,6 +2820,17 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
3104 | .idProduct = 0x1020, |
3105 | }, |
3106 | |
3107 | +/* QinHeng devices */ |
3108 | +{ |
3109 | + USB_DEVICE(0x1a86, 0x752d), |
3110 | + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
3111 | + .vendor_name = "QinHeng", |
3112 | + .product_name = "CH345", |
3113 | + .ifnum = 1, |
3114 | + .type = QUIRK_MIDI_CH345 |
3115 | + } |
3116 | +}, |
3117 | + |
3118 | /* KeithMcMillen Stringport */ |
3119 | { |
3120 | USB_DEVICE(0x1f38, 0x0001), |
3121 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
3122 | index 00ebc0ca008e..eef9b8e4b949 100644 |
3123 | --- a/sound/usb/quirks.c |
3124 | +++ b/sound/usb/quirks.c |
3125 | @@ -535,6 +535,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, |
3126 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
3127 | [QUIRK_MIDI_AKAI] = create_any_midi_quirk, |
3128 | [QUIRK_MIDI_FTDI] = create_any_midi_quirk, |
3129 | + [QUIRK_MIDI_CH345] = create_any_midi_quirk, |
3130 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3131 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3132 | [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, |
3133 | @@ -1271,6 +1272,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, |
3134 | case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */ |
3135 | case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ |
3136 | case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */ |
3137 | + case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ |
3138 | if (fp->altsetting == 3) |
3139 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
3140 | break; |
3141 | diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h |
3142 | index 91d0380431b4..991aa84491cd 100644 |
3143 | --- a/sound/usb/usbaudio.h |
3144 | +++ b/sound/usb/usbaudio.h |
3145 | @@ -94,6 +94,7 @@ enum quirk_type { |
3146 | QUIRK_MIDI_AKAI, |
3147 | QUIRK_MIDI_US122L, |
3148 | QUIRK_MIDI_FTDI, |
3149 | + QUIRK_MIDI_CH345, |
3150 | QUIRK_AUDIO_STANDARD_INTERFACE, |
3151 | QUIRK_AUDIO_FIXED_ENDPOINT, |
3152 | QUIRK_AUDIO_EDIROL_UAXX, |