1 |
commit: e0701e63021b694dec18a287ba21057a87325fb2 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 27 11:42:12 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 27 11:42:12 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e0701e63 |
7 |
|
8 |
Linuxpatch 4.4.300 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1299_linux-4.4.300.patch | 2516 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2520 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 78fe6059..53822338 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -1239,6 +1239,10 @@ Patch: 1298_linux-4.4.299.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.4.299 |
23 |
|
24 |
+Patch: 1299_linux-4.4.300.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.4.300 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1299_linux-4.4.300.patch b/1299_linux-4.4.300.patch |
33 |
new file mode 100644 |
34 |
index 00000000..a72d0f75 |
35 |
--- /dev/null |
36 |
+++ b/1299_linux-4.4.300.patch |
37 |
@@ -0,0 +1,2516 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index ad9236cc29e49..29bb2f87dd2ad 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 4 |
45 |
+-SUBLEVEL = 299 |
46 |
++SUBLEVEL = 300 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Blurry Fish Butt |
49 |
+ |
50 |
+diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
51 |
+index 8d184ff196429..5cac11e6ba4b4 100644 |
52 |
+--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi |
53 |
++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi |
54 |
+@@ -25,8 +25,8 @@ |
55 |
+ #size-cells = <2>; |
56 |
+ |
57 |
+ aliases { |
58 |
+- sdhc1 = &sdhc_1; /* SDC1 eMMC slot */ |
59 |
+- sdhc2 = &sdhc_2; /* SDC2 SD card slot */ |
60 |
++ mmc0 = &sdhc_1; /* SDC1 eMMC slot */ |
61 |
++ mmc1 = &sdhc_2; /* SDC2 SD card slot */ |
62 |
+ }; |
63 |
+ |
64 |
+ chosen { }; |
65 |
+diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c |
66 |
+index ef268c9aac80d..fe90c1c86a600 100644 |
67 |
+--- a/arch/mips/bcm63xx/clk.c |
68 |
++++ b/arch/mips/bcm63xx/clk.c |
69 |
+@@ -339,6 +339,12 @@ struct clk *clk_get_parent(struct clk *clk) |
70 |
+ } |
71 |
+ EXPORT_SYMBOL(clk_get_parent); |
72 |
+ |
73 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
74 |
++{ |
75 |
++ return 0; |
76 |
++} |
77 |
++EXPORT_SYMBOL(clk_set_parent); |
78 |
++ |
79 |
+ unsigned long clk_get_rate(struct clk *clk) |
80 |
+ { |
81 |
+ return clk->rate; |
82 |
+diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
83 |
+index d92cf59bdae63..bc414657601c4 100644 |
84 |
+--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
85 |
++++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h |
86 |
+@@ -303,7 +303,7 @@ enum cvmx_chip_types_enum { |
87 |
+ |
88 |
+ /* Functions to return string based on type */ |
89 |
+ #define ENUM_BRD_TYPE_CASE(x) \ |
90 |
+- case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ |
91 |
++ case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ |
92 |
+ static inline const char *cvmx_board_type_to_string(enum |
93 |
+ cvmx_board_types_enum type) |
94 |
+ { |
95 |
+@@ -392,7 +392,7 @@ static inline const char *cvmx_board_type_to_string(enum |
96 |
+ } |
97 |
+ |
98 |
+ #define ENUM_CHIP_TYPE_CASE(x) \ |
99 |
+- case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ |
100 |
++ case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ |
101 |
+ static inline const char *cvmx_chip_type_to_string(enum |
102 |
+ cvmx_chip_types_enum type) |
103 |
+ { |
104 |
+diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c |
105 |
+index a0706fd4ce0a0..80bdcb26ef8a3 100644 |
106 |
+--- a/arch/mips/lantiq/clk.c |
107 |
++++ b/arch/mips/lantiq/clk.c |
108 |
+@@ -165,6 +165,12 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) |
109 |
+ return NULL; |
110 |
+ } |
111 |
+ |
112 |
++int clk_set_parent(struct clk *clk, struct clk *parent) |
113 |
++{ |
114 |
++ return 0; |
115 |
++} |
116 |
++EXPORT_SYMBOL(clk_set_parent); |
117 |
++ |
118 |
+ static inline u32 get_counter_resolution(void) |
119 |
+ { |
120 |
+ u32 res; |
121 |
+diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c |
122 |
+index 6f61a17e2485a..55e7ba06511df 100644 |
123 |
+--- a/arch/parisc/kernel/traps.c |
124 |
++++ b/arch/parisc/kernel/traps.c |
125 |
+@@ -796,7 +796,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) |
126 |
+ * unless pagefault_disable() was called before. |
127 |
+ */ |
128 |
+ |
129 |
+- if (fault_space == 0 && !faulthandler_disabled()) |
130 |
++ if (faulthandler_disabled() || fault_space == 0) |
131 |
+ { |
132 |
+ /* Clean up and return if in exception table. */ |
133 |
+ if (fixup_exception(regs)) |
134 |
+diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
135 |
+index 7f60b60601764..39b1c1fa0c81f 100644 |
136 |
+--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
137 |
++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi |
138 |
+@@ -78,6 +78,7 @@ fman0: fman@400000 { |
139 |
+ #size-cells = <0>; |
140 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
141 |
+ reg = <0xfc000 0x1000>; |
142 |
++ fsl,erratum-a009885; |
143 |
+ }; |
144 |
+ |
145 |
+ xmdio0: mdio@fd000 { |
146 |
+@@ -85,6 +86,7 @@ fman0: fman@400000 { |
147 |
+ #size-cells = <0>; |
148 |
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; |
149 |
+ reg = <0xfd000 0x1000>; |
150 |
++ fsl,erratum-a009885; |
151 |
+ }; |
152 |
+ |
153 |
+ ptp_timer0: ptp-timer@fe000 { |
154 |
+diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c |
155 |
+index 41c011cb60706..8d05ef26dea9d 100644 |
156 |
+--- a/arch/powerpc/kernel/btext.c |
157 |
++++ b/arch/powerpc/kernel/btext.c |
158 |
+@@ -257,8 +257,10 @@ int __init btext_find_display(int allow_nonstdout) |
159 |
+ rc = btext_initialize(np); |
160 |
+ printk("result: %d\n", rc); |
161 |
+ } |
162 |
+- if (rc == 0) |
163 |
++ if (rc == 0) { |
164 |
++ of_node_put(np); |
165 |
+ break; |
166 |
++ } |
167 |
+ } |
168 |
+ return rc; |
169 |
+ } |
170 |
+diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c |
171 |
+index 3139533640fc8..204e44cc896ec 100644 |
172 |
+--- a/arch/powerpc/kernel/prom_init.c |
173 |
++++ b/arch/powerpc/kernel/prom_init.c |
174 |
+@@ -2526,7 +2526,7 @@ static void __init fixup_device_tree_efika_add_phy(void) |
175 |
+ |
176 |
+ /* Check if the phy-handle property exists - bail if it does */ |
177 |
+ rv = prom_getprop(node, "phy-handle", prop, sizeof(prop)); |
178 |
+- if (!rv) |
179 |
++ if (rv <= 0) |
180 |
+ return; |
181 |
+ |
182 |
+ /* |
183 |
+diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c |
184 |
+index ec9ec2058d2d3..19ba60ab18073 100644 |
185 |
+--- a/arch/powerpc/kernel/smp.c |
186 |
++++ b/arch/powerpc/kernel/smp.c |
187 |
+@@ -732,10 +732,12 @@ void start_secondary(void *unused) |
188 |
+ BUG(); |
189 |
+ } |
190 |
+ |
191 |
++#ifdef CONFIG_PROFILING |
192 |
+ int setup_profiling_timer(unsigned int multiplier) |
193 |
+ { |
194 |
+ return 0; |
195 |
+ } |
196 |
++#endif |
197 |
+ |
198 |
+ #ifdef CONFIG_SCHED_SMT |
199 |
+ /* cpumask of CPUs with asymetric SMT dependancy */ |
200 |
+diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c |
201 |
+index 14a582b212745..4edceff5791ad 100644 |
202 |
+--- a/arch/powerpc/platforms/cell/iommu.c |
203 |
++++ b/arch/powerpc/platforms/cell/iommu.c |
204 |
+@@ -1107,6 +1107,7 @@ static int __init cell_iommu_fixed_mapping_init(void) |
205 |
+ if (hbase < dbase || (hend > (dbase + dsize))) { |
206 |
+ pr_debug("iommu: hash window doesn't fit in" |
207 |
+ "real DMA window\n"); |
208 |
++ of_node_put(np); |
209 |
+ return -1; |
210 |
+ } |
211 |
+ } |
212 |
+diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
213 |
+index 9485f1024d46c..b3bcdce89c3bb 100644 |
214 |
+--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
215 |
++++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c |
216 |
+@@ -220,6 +220,7 @@ void hlwd_pic_probe(void) |
217 |
+ irq_set_chained_handler(cascade_virq, |
218 |
+ hlwd_pic_irq_cascade); |
219 |
+ hlwd_irq_host = host; |
220 |
++ of_node_put(np); |
221 |
+ break; |
222 |
+ } |
223 |
+ } |
224 |
+diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c |
225 |
+index e4169d68cb328..d28c4a9269c38 100644 |
226 |
+--- a/arch/powerpc/platforms/powernv/opal-lpc.c |
227 |
++++ b/arch/powerpc/platforms/powernv/opal-lpc.c |
228 |
+@@ -401,6 +401,7 @@ void opal_lpc_init(void) |
229 |
+ if (!of_get_property(np, "primary", NULL)) |
230 |
+ continue; |
231 |
+ opal_lpc_chip_id = of_get_ibm_chip_id(np); |
232 |
++ of_node_put(np); |
233 |
+ break; |
234 |
+ } |
235 |
+ if (opal_lpc_chip_id < 0) |
236 |
+diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h |
237 |
+index f5b76355ad71a..089f979e112e3 100644 |
238 |
+--- a/arch/um/include/shared/registers.h |
239 |
++++ b/arch/um/include/shared/registers.h |
240 |
+@@ -14,8 +14,8 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs); |
241 |
+ extern int save_fpx_registers(int pid, unsigned long *fp_regs); |
242 |
+ extern int restore_fpx_registers(int pid, unsigned long *fp_regs); |
243 |
+ extern int save_registers(int pid, struct uml_pt_regs *regs); |
244 |
+-extern int restore_registers(int pid, struct uml_pt_regs *regs); |
245 |
+-extern int init_registers(int pid); |
246 |
++extern int restore_pid_registers(int pid, struct uml_pt_regs *regs); |
247 |
++extern int init_pid_registers(int pid); |
248 |
+ extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs); |
249 |
+ extern unsigned long get_thread_reg(int reg, jmp_buf *buf); |
250 |
+ extern int get_fp_registers(int pid, unsigned long *regs); |
251 |
+diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c |
252 |
+index 2ff8d4fe83c4f..34a5963bd7efd 100644 |
253 |
+--- a/arch/um/os-Linux/registers.c |
254 |
++++ b/arch/um/os-Linux/registers.c |
255 |
+@@ -21,7 +21,7 @@ int save_registers(int pid, struct uml_pt_regs *regs) |
256 |
+ return 0; |
257 |
+ } |
258 |
+ |
259 |
+-int restore_registers(int pid, struct uml_pt_regs *regs) |
260 |
++int restore_pid_registers(int pid, struct uml_pt_regs *regs) |
261 |
+ { |
262 |
+ int err; |
263 |
+ |
264 |
+@@ -36,7 +36,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs) |
265 |
+ static unsigned long exec_regs[MAX_REG_NR]; |
266 |
+ static unsigned long exec_fp_regs[FP_SIZE]; |
267 |
+ |
268 |
+-int init_registers(int pid) |
269 |
++int init_pid_registers(int pid) |
270 |
+ { |
271 |
+ int err; |
272 |
+ |
273 |
+diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c |
274 |
+index 22a358ef1b0cd..dc06933ba63d9 100644 |
275 |
+--- a/arch/um/os-Linux/start_up.c |
276 |
++++ b/arch/um/os-Linux/start_up.c |
277 |
+@@ -334,7 +334,7 @@ void __init os_early_checks(void) |
278 |
+ check_tmpexec(); |
279 |
+ |
280 |
+ pid = start_ptraced_child(); |
281 |
+- if (init_registers(pid)) |
282 |
++ if (init_pid_registers(pid)) |
283 |
+ fatal("Failed to initialize default registers"); |
284 |
+ stop_ptraced_child(pid, 1, 1); |
285 |
+ } |
286 |
+diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c |
287 |
+index e6552275320bc..40ecacb2c54b3 100644 |
288 |
+--- a/arch/x86/um/syscalls_64.c |
289 |
++++ b/arch/x86/um/syscalls_64.c |
290 |
+@@ -9,6 +9,7 @@ |
291 |
+ #include <linux/uaccess.h> |
292 |
+ #include <asm/prctl.h> /* XXX This should get the constants from libc */ |
293 |
+ #include <os.h> |
294 |
++#include <registers.h> |
295 |
+ |
296 |
+ long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) |
297 |
+ { |
298 |
+@@ -32,7 +33,7 @@ long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) |
299 |
+ switch (code) { |
300 |
+ case ARCH_SET_FS: |
301 |
+ case ARCH_SET_GS: |
302 |
+- ret = restore_registers(pid, ¤t->thread.regs.regs); |
303 |
++ ret = restore_pid_registers(pid, ¤t->thread.regs.regs); |
304 |
+ if (ret) |
305 |
+ return ret; |
306 |
+ break; |
307 |
+diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c |
308 |
+index 77930683ab7dd..c20b7dfec7b20 100644 |
309 |
+--- a/drivers/acpi/acpica/exoparg1.c |
310 |
++++ b/drivers/acpi/acpica/exoparg1.c |
311 |
+@@ -1016,7 +1016,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) |
312 |
+ (walk_state, return_desc, |
313 |
+ &temp_desc); |
314 |
+ if (ACPI_FAILURE(status)) { |
315 |
+- goto cleanup; |
316 |
++ return_ACPI_STATUS |
317 |
++ (status); |
318 |
+ } |
319 |
+ |
320 |
+ return_desc = temp_desc; |
321 |
+diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c |
322 |
+index 9f8b088e21d7e..d90b2cf310fb1 100644 |
323 |
+--- a/drivers/acpi/acpica/utdelete.c |
324 |
++++ b/drivers/acpi/acpica/utdelete.c |
325 |
+@@ -439,6 +439,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
326 |
+ ACPI_WARNING((AE_INFO, |
327 |
+ "Obj %p, Reference Count is already zero, cannot decrement\n", |
328 |
+ object)); |
329 |
++ return; |
330 |
+ } |
331 |
+ |
332 |
+ ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
333 |
+diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c |
334 |
+index 40c251ef175db..373dab29addf2 100644 |
335 |
+--- a/drivers/block/floppy.c |
336 |
++++ b/drivers/block/floppy.c |
337 |
+@@ -994,7 +994,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn); |
338 |
+ static void cancel_activity(void) |
339 |
+ { |
340 |
+ do_floppy = NULL; |
341 |
+- cancel_delayed_work_sync(&fd_timer); |
342 |
++ cancel_delayed_work(&fd_timer); |
343 |
+ cancel_work_sync(&floppy_work); |
344 |
+ } |
345 |
+ |
346 |
+@@ -3116,6 +3116,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) |
347 |
+ } |
348 |
+ } |
349 |
+ |
350 |
++#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) |
351 |
++ |
352 |
+ static int raw_cmd_copyin(int cmd, void __user *param, |
353 |
+ struct floppy_raw_cmd **rcmd) |
354 |
+ { |
355 |
+@@ -3153,7 +3155,7 @@ loop: |
356 |
+ ptr->resultcode = 0; |
357 |
+ |
358 |
+ if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { |
359 |
+- if (ptr->length <= 0) |
360 |
++ if (ptr->length <= 0 || ptr->length >= MAX_LEN) |
361 |
+ return -EINVAL; |
362 |
+ ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); |
363 |
+ fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); |
364 |
+diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c |
365 |
+index 616ec2ac1b22f..eac9eeec3a53f 100644 |
366 |
+--- a/drivers/bluetooth/bfusb.c |
367 |
++++ b/drivers/bluetooth/bfusb.c |
368 |
+@@ -645,6 +645,9 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i |
369 |
+ data->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress; |
370 |
+ data->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize); |
371 |
+ |
372 |
++ if (!data->bulk_pkt_size) |
373 |
++ goto done; |
374 |
++ |
375 |
+ rwlock_init(&data->lock); |
376 |
+ |
377 |
+ data->reassembly = NULL; |
378 |
+diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h |
379 |
+index fba6ab1160ce8..b167163b18277 100644 |
380 |
+--- a/drivers/char/mwave/3780i.h |
381 |
++++ b/drivers/char/mwave/3780i.h |
382 |
+@@ -68,7 +68,7 @@ typedef struct { |
383 |
+ unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ |
384 |
+ unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ |
385 |
+ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ |
386 |
+- unsigned char Reserved:5; /* 0: Reserved */ |
387 |
++ unsigned short Reserved:13; /* 0: Reserved */ |
388 |
+ } DSP_ISA_SLAVE_CONTROL; |
389 |
+ |
390 |
+ |
391 |
+diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c |
392 |
+index 0c9973ec80ebd..da2e4c193953a 100644 |
393 |
+--- a/drivers/crypto/qce/sha.c |
394 |
++++ b/drivers/crypto/qce/sha.c |
395 |
+@@ -539,8 +539,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def, |
396 |
+ |
397 |
+ ret = crypto_register_ahash(alg); |
398 |
+ if (ret) { |
399 |
+- kfree(tmpl); |
400 |
+ dev_err(qce->dev, "%s registration failed\n", base->cra_name); |
401 |
++ kfree(tmpl); |
402 |
+ return ret; |
403 |
+ } |
404 |
+ |
405 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
406 |
+index 2d87018069ca0..d0e85c65d1467 100644 |
407 |
+--- a/drivers/dma/at_xdmac.c |
408 |
++++ b/drivers/dma/at_xdmac.c |
409 |
+@@ -100,6 +100,7 @@ |
410 |
+ #define AT_XDMAC_CNDC_NDE (0x1 << 0) /* Channel x Next Descriptor Enable */ |
411 |
+ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1) /* Channel x Next Descriptor Source Update */ |
412 |
+ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2) /* Channel x Next Descriptor Destination Update */ |
413 |
++#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27) |
414 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3) /* Channel x Next Descriptor View 0 */ |
415 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3) /* Channel x Next Descriptor View 1 */ |
416 |
+ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3) /* Channel x Next Descriptor View 2 */ |
417 |
+@@ -232,15 +233,15 @@ struct at_xdmac { |
418 |
+ |
419 |
+ /* Linked List Descriptor */ |
420 |
+ struct at_xdmac_lld { |
421 |
+- dma_addr_t mbr_nda; /* Next Descriptor Member */ |
422 |
+- u32 mbr_ubc; /* Microblock Control Member */ |
423 |
+- dma_addr_t mbr_sa; /* Source Address Member */ |
424 |
+- dma_addr_t mbr_da; /* Destination Address Member */ |
425 |
+- u32 mbr_cfg; /* Configuration Register */ |
426 |
+- u32 mbr_bc; /* Block Control Register */ |
427 |
+- u32 mbr_ds; /* Data Stride Register */ |
428 |
+- u32 mbr_sus; /* Source Microblock Stride Register */ |
429 |
+- u32 mbr_dus; /* Destination Microblock Stride Register */ |
430 |
++ u32 mbr_nda; /* Next Descriptor Member */ |
431 |
++ u32 mbr_ubc; /* Microblock Control Member */ |
432 |
++ u32 mbr_sa; /* Source Address Member */ |
433 |
++ u32 mbr_da; /* Destination Address Member */ |
434 |
++ u32 mbr_cfg; /* Configuration Register */ |
435 |
++ u32 mbr_bc; /* Block Control Register */ |
436 |
++ u32 mbr_ds; /* Data Stride Register */ |
437 |
++ u32 mbr_sus; /* Source Microblock Stride Register */ |
438 |
++ u32 mbr_dus; /* Destination Microblock Stride Register */ |
439 |
+ }; |
440 |
+ |
441 |
+ /* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */ |
442 |
+@@ -345,9 +346,6 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
443 |
+ |
444 |
+ dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, first); |
445 |
+ |
446 |
+- if (at_xdmac_chan_is_enabled(atchan)) |
447 |
+- return; |
448 |
+- |
449 |
+ /* Set transfer as active to not try to start it again. */ |
450 |
+ first->active_xfer = true; |
451 |
+ |
452 |
+@@ -363,7 +361,8 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, |
453 |
+ */ |
454 |
+ if (at_xdmac_chan_is_cyclic(atchan)) |
455 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV1; |
456 |
+- else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) |
457 |
++ else if ((first->lld.mbr_ubc & |
458 |
++ AT_XDMAC_CNDC_NDVIEW_MASK) == AT_XDMAC_MBR_UBC_NDV3) |
459 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV3; |
460 |
+ else |
461 |
+ reg = AT_XDMAC_CNDC_NDVIEW_NDV2; |
462 |
+@@ -428,13 +427,12 @@ static dma_cookie_t at_xdmac_tx_submit(struct dma_async_tx_descriptor *tx) |
463 |
+ spin_lock_irqsave(&atchan->lock, irqflags); |
464 |
+ cookie = dma_cookie_assign(tx); |
465 |
+ |
466 |
++ list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
467 |
++ spin_unlock_irqrestore(&atchan->lock, irqflags); |
468 |
++ |
469 |
+ dev_vdbg(chan2dev(tx->chan), "%s: atchan 0x%p, add desc 0x%p to xfers_list\n", |
470 |
+ __func__, atchan, desc); |
471 |
+- list_add_tail(&desc->xfer_node, &atchan->xfers_list); |
472 |
+- if (list_is_singular(&atchan->xfers_list)) |
473 |
+- at_xdmac_start_xfer(atchan, desc); |
474 |
+ |
475 |
+- spin_unlock_irqrestore(&atchan->lock, irqflags); |
476 |
+ return cookie; |
477 |
+ } |
478 |
+ |
479 |
+diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c |
480 |
+index e39457f13d4dd..548600ce6cc87 100644 |
481 |
+--- a/drivers/dma/mmp_pdma.c |
482 |
++++ b/drivers/dma/mmp_pdma.c |
483 |
+@@ -723,12 +723,6 @@ static int mmp_pdma_config(struct dma_chan *dchan, |
484 |
+ |
485 |
+ chan->dir = cfg->direction; |
486 |
+ chan->dev_addr = addr; |
487 |
+- /* FIXME: drivers should be ported over to use the filter |
488 |
+- * function. Once that's done, the following two lines can |
489 |
+- * be removed. |
490 |
+- */ |
491 |
+- if (cfg->slave_id) |
492 |
+- chan->drcmr = cfg->slave_id; |
493 |
+ |
494 |
+ return 0; |
495 |
+ } |
496 |
+diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c |
497 |
+index 4251e9ac0373c..ff2e28137a7b1 100644 |
498 |
+--- a/drivers/dma/pxa_dma.c |
499 |
++++ b/drivers/dma/pxa_dma.c |
500 |
+@@ -959,13 +959,6 @@ static void pxad_get_config(struct pxad_chan *chan, |
501 |
+ *dcmd |= PXA_DCMD_BURST16; |
502 |
+ else if (maxburst == 32) |
503 |
+ *dcmd |= PXA_DCMD_BURST32; |
504 |
+- |
505 |
+- /* FIXME: drivers should be ported over to use the filter |
506 |
+- * function. Once that's done, the following two lines can |
507 |
+- * be removed. |
508 |
+- */ |
509 |
+- if (chan->cfg.slave_id) |
510 |
+- chan->drcmr = chan->cfg.slave_id; |
511 |
+ } |
512 |
+ |
513 |
+ static struct dma_async_tx_descriptor * |
514 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
515 |
+index e1d4115bd6732..80e3b41294e5f 100644 |
516 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
517 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |
518 |
+@@ -404,6 +404,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
519 |
+ native_mode->vdisplay != 0 && |
520 |
+ native_mode->clock != 0) { |
521 |
+ mode = drm_mode_duplicate(dev, native_mode); |
522 |
++ if (!mode) |
523 |
++ return NULL; |
524 |
++ |
525 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
526 |
+ drm_mode_set_name(mode); |
527 |
+ |
528 |
+@@ -418,6 +421,9 @@ amdgpu_connector_lcd_native_mode(struct drm_encoder *encoder) |
529 |
+ * simpler. |
530 |
+ */ |
531 |
+ mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); |
532 |
++ if (!mode) |
533 |
++ return NULL; |
534 |
++ |
535 |
+ mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
536 |
+ DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name); |
537 |
+ } |
538 |
+diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
539 |
+index 81bd84f9156ba..3e107e103d357 100644 |
540 |
+--- a/drivers/gpu/drm/i915/intel_pm.c |
541 |
++++ b/drivers/gpu/drm/i915/intel_pm.c |
542 |
+@@ -2245,9 +2245,9 @@ static void snb_wm_latency_quirk(struct drm_device *dev) |
543 |
+ * The BIOS provided WM memory latency values are often |
544 |
+ * inadequate for high resolution displays. Adjust them. |
545 |
+ */ |
546 |
+- changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12) | |
547 |
+- ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12) | |
548 |
+- ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12); |
549 |
++ changed = ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_latency, 12); |
550 |
++ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latency, 12); |
551 |
++ changed |= ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latency, 12); |
552 |
+ |
553 |
+ if (!changed) |
554 |
+ return; |
555 |
+diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
556 |
+index cbcaf5e8c624a..2cfcabe1d3b98 100644 |
557 |
+--- a/drivers/hid/uhid.c |
558 |
++++ b/drivers/hid/uhid.c |
559 |
+@@ -33,11 +33,22 @@ |
560 |
+ |
561 |
+ struct uhid_device { |
562 |
+ struct mutex devlock; |
563 |
++ |
564 |
++ /* This flag tracks whether the HID device is usable for commands from |
565 |
++ * userspace. The flag is already set before hid_add_device(), which |
566 |
++ * runs in workqueue context, to allow hid_add_device() to communicate |
567 |
++ * with userspace. |
568 |
++ * However, if hid_add_device() fails, the flag is cleared without |
569 |
++ * holding devlock. |
570 |
++ * We guarantee that if @running changes from true to false while you're |
571 |
++ * holding @devlock, it's still fine to access @hid. |
572 |
++ */ |
573 |
+ bool running; |
574 |
+ |
575 |
+ __u8 *rd_data; |
576 |
+ uint rd_size; |
577 |
+ |
578 |
++ /* When this is NULL, userspace may use UHID_CREATE/UHID_CREATE2. */ |
579 |
+ struct hid_device *hid; |
580 |
+ struct uhid_event input_buf; |
581 |
+ |
582 |
+@@ -68,9 +79,18 @@ static void uhid_device_add_worker(struct work_struct *work) |
583 |
+ if (ret) { |
584 |
+ hid_err(uhid->hid, "Cannot register HID device: error %d\n", ret); |
585 |
+ |
586 |
+- hid_destroy_device(uhid->hid); |
587 |
+- uhid->hid = NULL; |
588 |
++ /* We used to call hid_destroy_device() here, but that's really |
589 |
++ * messy to get right because we have to coordinate with |
590 |
++ * concurrent writes from userspace that might be in the middle |
591 |
++ * of using uhid->hid. |
592 |
++ * Just leave uhid->hid as-is for now, and clean it up when |
593 |
++ * userspace tries to close or reinitialize the uhid instance. |
594 |
++ * |
595 |
++ * However, we do have to clear the ->running flag and do a |
596 |
++ * wakeup to make sure userspace knows that the device is gone. |
597 |
++ */ |
598 |
+ uhid->running = false; |
599 |
++ wake_up_interruptible(&uhid->report_wait); |
600 |
+ } |
601 |
+ } |
602 |
+ |
603 |
+@@ -479,7 +499,7 @@ static int uhid_dev_create2(struct uhid_device *uhid, |
604 |
+ void *rd_data; |
605 |
+ int ret; |
606 |
+ |
607 |
+- if (uhid->running) |
608 |
++ if (uhid->hid) |
609 |
+ return -EALREADY; |
610 |
+ |
611 |
+ rd_size = ev->u.create2.rd_size; |
612 |
+@@ -560,7 +580,7 @@ static int uhid_dev_create(struct uhid_device *uhid, |
613 |
+ |
614 |
+ static int uhid_dev_destroy(struct uhid_device *uhid) |
615 |
+ { |
616 |
+- if (!uhid->running) |
617 |
++ if (!uhid->hid) |
618 |
+ return -EINVAL; |
619 |
+ |
620 |
+ uhid->running = false; |
621 |
+@@ -569,6 +589,7 @@ static int uhid_dev_destroy(struct uhid_device *uhid) |
622 |
+ cancel_work_sync(&uhid->worker); |
623 |
+ |
624 |
+ hid_destroy_device(uhid->hid); |
625 |
++ uhid->hid = NULL; |
626 |
+ kfree(uhid->rd_data); |
627 |
+ |
628 |
+ return 0; |
629 |
+diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c |
630 |
+index 55e36fcd7ff35..e1080f005a19e 100644 |
631 |
+--- a/drivers/hsi/hsi.c |
632 |
++++ b/drivers/hsi/hsi.c |
633 |
+@@ -115,6 +115,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port, |
634 |
+ if (device_register(&cl->device) < 0) { |
635 |
+ pr_err("hsi: failed to register client: %s\n", info->name); |
636 |
+ put_device(&cl->device); |
637 |
++ goto err; |
638 |
+ } |
639 |
+ |
640 |
+ return cl; |
641 |
+diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c |
642 |
+index 1543d35d228df..6831883741215 100644 |
643 |
+--- a/drivers/i2c/busses/i2c-designware-pcidrv.c |
644 |
++++ b/drivers/i2c/busses/i2c-designware-pcidrv.c |
645 |
+@@ -53,10 +53,10 @@ enum dw_pci_ctl_id_t { |
646 |
+ }; |
647 |
+ |
648 |
+ struct dw_scl_sda_cfg { |
649 |
+- u32 ss_hcnt; |
650 |
+- u32 fs_hcnt; |
651 |
+- u32 ss_lcnt; |
652 |
+- u32 fs_lcnt; |
653 |
++ u16 ss_hcnt; |
654 |
++ u16 fs_hcnt; |
655 |
++ u16 ss_lcnt; |
656 |
++ u16 fs_lcnt; |
657 |
+ u32 sda_hold; |
658 |
+ }; |
659 |
+ |
660 |
+diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c |
661 |
+index 4399016a6caba..73026c00220c2 100644 |
662 |
+--- a/drivers/i2c/busses/i2c-i801.c |
663 |
++++ b/drivers/i2c/busses/i2c-i801.c |
664 |
+@@ -669,6 +669,11 @@ static int i801_block_transaction(struct i801_priv *priv, |
665 |
+ int result = 0; |
666 |
+ unsigned char hostc; |
667 |
+ |
668 |
++ if (read_write == I2C_SMBUS_READ && command == I2C_SMBUS_BLOCK_DATA) |
669 |
++ data->block[0] = I2C_SMBUS_BLOCK_MAX; |
670 |
++ else if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) |
671 |
++ return -EPROTO; |
672 |
++ |
673 |
+ if (command == I2C_SMBUS_I2C_BLOCK_DATA) { |
674 |
+ if (read_write == I2C_SMBUS_WRITE) { |
675 |
+ /* set I2C_EN bit in configuration register */ |
676 |
+@@ -682,16 +687,6 @@ static int i801_block_transaction(struct i801_priv *priv, |
677 |
+ } |
678 |
+ } |
679 |
+ |
680 |
+- if (read_write == I2C_SMBUS_WRITE |
681 |
+- || command == I2C_SMBUS_I2C_BLOCK_DATA) { |
682 |
+- if (data->block[0] < 1) |
683 |
+- data->block[0] = 1; |
684 |
+- if (data->block[0] > I2C_SMBUS_BLOCK_MAX) |
685 |
+- data->block[0] = I2C_SMBUS_BLOCK_MAX; |
686 |
+- } else { |
687 |
+- data->block[0] = 32; /* max for SMBus block reads */ |
688 |
+- } |
689 |
+- |
690 |
+ /* Experience has shown that the block buffer can only be used for |
691 |
+ SMBus (not I2C) block transactions, even though the datasheet |
692 |
+ doesn't mention this limitation. */ |
693 |
+diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c |
694 |
+index 2e083a71c2215..988ea9df6654c 100644 |
695 |
+--- a/drivers/i2c/busses/i2c-mpc.c |
696 |
++++ b/drivers/i2c/busses/i2c-mpc.c |
697 |
+@@ -107,23 +107,30 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) |
698 |
+ /* Sometimes 9th clock pulse isn't generated, and slave doesn't release |
699 |
+ * the bus, because it wants to send ACK. |
700 |
+ * Following sequence of enabling/disabling and sending start/stop generates |
701 |
+- * the 9 pulses, so it's all OK. |
702 |
++ * the 9 pulses, each with a START then ending with STOP, so it's all OK. |
703 |
+ */ |
704 |
+ static void mpc_i2c_fixup(struct mpc_i2c *i2c) |
705 |
+ { |
706 |
+ int k; |
707 |
+- u32 delay_val = 1000000 / i2c->real_clk + 1; |
708 |
+- |
709 |
+- if (delay_val < 2) |
710 |
+- delay_val = 2; |
711 |
++ unsigned long flags; |
712 |
+ |
713 |
+ for (k = 9; k; k--) { |
714 |
+ writeccr(i2c, 0); |
715 |
+- writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); |
716 |
++ writeb(0, i2c->base + MPC_I2C_SR); /* clear any status bits */ |
717 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA); /* START */ |
718 |
++ readb(i2c->base + MPC_I2C_DR); /* init xfer */ |
719 |
++ udelay(15); /* let it hit the bus */ |
720 |
++ local_irq_save(flags); /* should not be delayed further */ |
721 |
++ writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSTA); /* delay SDA */ |
722 |
+ readb(i2c->base + MPC_I2C_DR); |
723 |
+- writeccr(i2c, CCR_MEN); |
724 |
+- udelay(delay_val << 1); |
725 |
++ if (k != 1) |
726 |
++ udelay(5); |
727 |
++ local_irq_restore(flags); |
728 |
+ } |
729 |
++ writeccr(i2c, CCR_MEN); /* Initiate STOP */ |
730 |
++ readb(i2c->base + MPC_I2C_DR); |
731 |
++ udelay(15); /* Let STOP propagate */ |
732 |
++ writeccr(i2c, 0); |
733 |
+ } |
734 |
+ |
735 |
+ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) |
736 |
+diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c |
737 |
+index 179e8134d57fc..a14a3ec99ffe1 100644 |
738 |
+--- a/drivers/infiniband/core/device.c |
739 |
++++ b/drivers/infiniband/core/device.c |
740 |
+@@ -848,7 +848,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, |
741 |
+ for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) { |
742 |
+ ret = ib_query_gid(device, port, i, &tmp_gid, NULL); |
743 |
+ if (ret) |
744 |
+- return ret; |
745 |
++ continue; |
746 |
++ |
747 |
+ if (!memcmp(&tmp_gid, gid, sizeof *gid)) { |
748 |
+ *port_num = port; |
749 |
+ if (index) |
750 |
+diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c |
751 |
+index 67e4002bd776e..31a8119685114 100644 |
752 |
+--- a/drivers/infiniband/hw/cxgb4/qp.c |
753 |
++++ b/drivers/infiniband/hw/cxgb4/qp.c |
754 |
+@@ -1896,6 +1896,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
755 |
+ memset(attr, 0, sizeof *attr); |
756 |
+ memset(init_attr, 0, sizeof *init_attr); |
757 |
+ attr->qp_state = to_ib_qp_state(qhp->attr.state); |
758 |
++ attr->cur_qp_state = to_ib_qp_state(qhp->attr.state); |
759 |
+ init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; |
760 |
+ init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; |
761 |
+ init_attr->cap.max_send_sge = qhp->attr.sq_max_sges; |
762 |
+diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c |
763 |
+index fa9039a53ae5c..23b1d22f693c1 100644 |
764 |
+--- a/drivers/md/persistent-data/dm-btree.c |
765 |
++++ b/drivers/md/persistent-data/dm-btree.c |
766 |
+@@ -83,14 +83,16 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
767 |
+ } |
768 |
+ |
769 |
+ static int insert_at(size_t value_size, struct btree_node *node, unsigned index, |
770 |
+- uint64_t key, void *value) |
771 |
+- __dm_written_to_disk(value) |
772 |
++ uint64_t key, void *value) |
773 |
++ __dm_written_to_disk(value) |
774 |
+ { |
775 |
+ uint32_t nr_entries = le32_to_cpu(node->header.nr_entries); |
776 |
++ uint32_t max_entries = le32_to_cpu(node->header.max_entries); |
777 |
+ __le64 key_le = cpu_to_le64(key); |
778 |
+ |
779 |
+ if (index > nr_entries || |
780 |
+- index >= le32_to_cpu(node->header.max_entries)) { |
781 |
++ index >= max_entries || |
782 |
++ nr_entries >= max_entries) { |
783 |
+ DMERR("too many entries in btree node for insert"); |
784 |
+ __dm_unbless_for_disk(value); |
785 |
+ return -ENOMEM; |
786 |
+diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c |
787 |
+index ca09ad2a639c4..6fa4a68e78b0d 100644 |
788 |
+--- a/drivers/md/persistent-data/dm-space-map-common.c |
789 |
++++ b/drivers/md/persistent-data/dm-space-map-common.c |
790 |
+@@ -279,6 +279,11 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result) |
791 |
+ struct disk_index_entry ie_disk; |
792 |
+ struct dm_block *blk; |
793 |
+ |
794 |
++ if (b >= ll->nr_blocks) { |
795 |
++ DMERR_LIMIT("metadata block out of bounds"); |
796 |
++ return -EINVAL; |
797 |
++ } |
798 |
++ |
799 |
+ b = do_div(index, ll->entries_per_block); |
800 |
+ r = ll->load_ie(ll, index, &ie_disk); |
801 |
+ if (r < 0) |
802 |
+diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c |
803 |
+index df1e8c975cd82..6d0a0b08853b4 100644 |
804 |
+--- a/drivers/media/common/saa7146/saa7146_fops.c |
805 |
++++ b/drivers/media/common/saa7146/saa7146_fops.c |
806 |
+@@ -524,7 +524,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) |
807 |
+ ERR("out of memory. aborting.\n"); |
808 |
+ kfree(vv); |
809 |
+ v4l2_ctrl_handler_free(hdl); |
810 |
+- return -1; |
811 |
++ return -ENOMEM; |
812 |
+ } |
813 |
+ |
814 |
+ saa7146_video_uops.init(dev,vv); |
815 |
+diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c |
816 |
+index 94c26270fff0e..b8af5a3c707f8 100644 |
817 |
+--- a/drivers/media/dvb-frontends/dib8000.c |
818 |
++++ b/drivers/media/dvb-frontends/dib8000.c |
819 |
+@@ -4461,8 +4461,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad |
820 |
+ |
821 |
+ state->timf_default = cfg->pll->timf; |
822 |
+ |
823 |
+- if (dib8000_identify(&state->i2c) == 0) |
824 |
++ if (dib8000_identify(&state->i2c) == 0) { |
825 |
++ kfree(fe); |
826 |
+ goto error; |
827 |
++ } |
828 |
+ |
829 |
+ dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, state->i2c.addr); |
830 |
+ |
831 |
+diff --git a/drivers/media/pci/b2c2/flexcop-pci.c b/drivers/media/pci/b2c2/flexcop-pci.c |
832 |
+index 8b5e0b3a92a0c..2f496c05a3316 100644 |
833 |
+--- a/drivers/media/pci/b2c2/flexcop-pci.c |
834 |
++++ b/drivers/media/pci/b2c2/flexcop-pci.c |
835 |
+@@ -184,6 +184,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
836 |
+ dma_addr_t cur_addr = |
837 |
+ fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; |
838 |
+ u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; |
839 |
++ if (cur_pos > fc_pci->dma[0].size * 2) |
840 |
++ goto error; |
841 |
+ |
842 |
+ deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, " |
843 |
+ "last_cur_pos: %08x ", |
844 |
+@@ -225,6 +227,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) |
845 |
+ ret = IRQ_NONE; |
846 |
+ } |
847 |
+ |
848 |
++error: |
849 |
+ spin_unlock_irqrestore(&fc_pci->irq_lock, flags); |
850 |
+ return ret; |
851 |
+ } |
852 |
+diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c |
853 |
+index 343cd75fcd8d1..f09f311a316f5 100644 |
854 |
+--- a/drivers/media/pci/saa7146/hexium_gemini.c |
855 |
++++ b/drivers/media/pci/saa7146/hexium_gemini.c |
856 |
+@@ -296,7 +296,12 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d |
857 |
+ hexium_set_input(hexium, 0); |
858 |
+ hexium->cur_input = 0; |
859 |
+ |
860 |
+- saa7146_vv_init(dev, &vv_data); |
861 |
++ ret = saa7146_vv_init(dev, &vv_data); |
862 |
++ if (ret) { |
863 |
++ i2c_del_adapter(&hexium->i2c_adapter); |
864 |
++ kfree(hexium); |
865 |
++ return ret; |
866 |
++ } |
867 |
+ |
868 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
869 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
870 |
+diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c |
871 |
+index 214396b1ca73c..2f3b4e01ff289 100644 |
872 |
+--- a/drivers/media/pci/saa7146/hexium_orion.c |
873 |
++++ b/drivers/media/pci/saa7146/hexium_orion.c |
874 |
+@@ -366,10 +366,16 @@ static struct saa7146_ext_vv vv_data; |
875 |
+ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
876 |
+ { |
877 |
+ struct hexium *hexium = (struct hexium *) dev->ext_priv; |
878 |
++ int ret; |
879 |
+ |
880 |
+ DEB_EE("\n"); |
881 |
+ |
882 |
+- saa7146_vv_init(dev, &vv_data); |
883 |
++ ret = saa7146_vv_init(dev, &vv_data); |
884 |
++ if (ret) { |
885 |
++ pr_err("Error in saa7146_vv_init()\n"); |
886 |
++ return ret; |
887 |
++ } |
888 |
++ |
889 |
+ vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; |
890 |
+ vv_data.vid_ops.vidioc_g_input = vidioc_g_input; |
891 |
+ vv_data.vid_ops.vidioc_s_input = vidioc_s_input; |
892 |
+diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c |
893 |
+index 868af73c5536a..56691a79ef08f 100644 |
894 |
+--- a/drivers/media/pci/saa7146/mxb.c |
895 |
++++ b/drivers/media/pci/saa7146/mxb.c |
896 |
+@@ -694,10 +694,16 @@ static struct saa7146_ext_vv vv_data; |
897 |
+ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) |
898 |
+ { |
899 |
+ struct mxb *mxb; |
900 |
++ int ret; |
901 |
+ |
902 |
+ DEB_EE("dev:%p\n", dev); |
903 |
+ |
904 |
+- saa7146_vv_init(dev, &vv_data); |
905 |
++ ret = saa7146_vv_init(dev, &vv_data); |
906 |
++ if (ret) { |
907 |
++ ERR("Error in saa7146_vv_init()"); |
908 |
++ return ret; |
909 |
++ } |
910 |
++ |
911 |
+ if (mxb_probe(dev)) { |
912 |
+ saa7146_vv_release(dev); |
913 |
+ return -1; |
914 |
+diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c |
915 |
+index b36e51576f8e4..645ea00c472ab 100644 |
916 |
+--- a/drivers/media/rc/igorplugusb.c |
917 |
++++ b/drivers/media/rc/igorplugusb.c |
918 |
+@@ -73,9 +73,11 @@ static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len) |
919 |
+ if (start >= len) { |
920 |
+ dev_err(ir->dev, "receive overflow invalid: %u", overflow); |
921 |
+ } else { |
922 |
+- if (overflow > 0) |
923 |
++ if (overflow > 0) { |
924 |
+ dev_warn(ir->dev, "receive overflow, at least %u lost", |
925 |
+ overflow); |
926 |
++ ir_raw_event_reset(ir->rc); |
927 |
++ } |
928 |
+ |
929 |
+ do { |
930 |
+ rawir.duration = ir->buf_in[i] * 85333; |
931 |
+diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c |
932 |
+index 7b9800d3446cf..71e6d4d935c9e 100644 |
933 |
+--- a/drivers/media/rc/mceusb.c |
934 |
++++ b/drivers/media/rc/mceusb.c |
935 |
+@@ -1118,7 +1118,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
936 |
+ */ |
937 |
+ ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), |
938 |
+ USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, |
939 |
+- data, USB_CTRL_MSG_SZ, HZ * 3); |
940 |
++ data, USB_CTRL_MSG_SZ, 3000); |
941 |
+ dev_dbg(dev, "set address - ret = %d", ret); |
942 |
+ dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", |
943 |
+ data[0], data[1]); |
944 |
+@@ -1126,20 +1126,20 @@ static void mceusb_gen1_init(struct mceusb_dev *ir) |
945 |
+ /* set feature: bit rate 38400 bps */ |
946 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
947 |
+ USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, |
948 |
+- 0xc04e, 0x0000, NULL, 0, HZ * 3); |
949 |
++ 0xc04e, 0x0000, NULL, 0, 3000); |
950 |
+ |
951 |
+ dev_dbg(dev, "set feature - ret = %d", ret); |
952 |
+ |
953 |
+ /* bRequest 4: set char length to 8 bits */ |
954 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
955 |
+ 4, USB_TYPE_VENDOR, |
956 |
+- 0x0808, 0x0000, NULL, 0, HZ * 3); |
957 |
++ 0x0808, 0x0000, NULL, 0, 3000); |
958 |
+ dev_dbg(dev, "set char length - retB = %d", ret); |
959 |
+ |
960 |
+ /* bRequest 2: set handshaking to use DTR/DSR */ |
961 |
+ ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), |
962 |
+ 2, USB_TYPE_VENDOR, |
963 |
+- 0x0000, 0x0100, NULL, 0, HZ * 3); |
964 |
++ 0x0000, 0x0100, NULL, 0, 3000); |
965 |
+ dev_dbg(dev, "set handshake - retC = %d", ret); |
966 |
+ |
967 |
+ /* device resume */ |
968 |
+diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c |
969 |
+index 3a12ef35682b5..64d98517f470f 100644 |
970 |
+--- a/drivers/media/tuners/msi001.c |
971 |
++++ b/drivers/media/tuners/msi001.c |
972 |
+@@ -464,6 +464,13 @@ static int msi001_probe(struct spi_device *spi) |
973 |
+ V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); |
974 |
+ dev->bandwidth = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
975 |
+ V4L2_CID_RF_TUNER_BANDWIDTH, 200000, 8000000, 1, 200000); |
976 |
++ if (dev->hdl.error) { |
977 |
++ ret = dev->hdl.error; |
978 |
++ dev_err(&spi->dev, "Could not initialize controls\n"); |
979 |
++ /* control init failed, free handler */ |
980 |
++ goto err_ctrl_handler_free; |
981 |
++ } |
982 |
++ |
983 |
+ v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); |
984 |
+ dev->lna_gain = v4l2_ctrl_new_std(&dev->hdl, &msi001_ctrl_ops, |
985 |
+ V4L2_CID_RF_TUNER_LNA_GAIN, 0, 1, 1, 1); |
986 |
+diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c |
987 |
+index 49dd3ea2947dc..ee784041f0904 100644 |
988 |
+--- a/drivers/media/usb/dvb-usb/dib0700_core.c |
989 |
++++ b/drivers/media/usb/dvb-usb/dib0700_core.c |
990 |
+@@ -583,8 +583,6 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
991 |
+ deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->fe_adap[0].stream.props.endpoint); |
992 |
+ if (onoff) |
993 |
+ st->channel_state |= 1 << (adap->id); |
994 |
+- else |
995 |
+- st->channel_state |= 1 << ~(adap->id); |
996 |
+ } else { |
997 |
+ if (onoff) |
998 |
+ st->channel_state |= 1 << (adap->fe_adap[0].stream.props.endpoint-2); |
999 |
+diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c |
1000 |
+index eafc5c82467f4..5b806779e2106 100644 |
1001 |
+--- a/drivers/media/usb/dvb-usb/m920x.c |
1002 |
++++ b/drivers/media/usb/dvb-usb/m920x.c |
1003 |
+@@ -284,6 +284,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
1004 |
+ /* Should check for ack here, if we knew how. */ |
1005 |
+ } |
1006 |
+ if (msg[i].flags & I2C_M_RD) { |
1007 |
++ char *read = kmalloc(1, GFP_KERNEL); |
1008 |
++ if (!read) { |
1009 |
++ ret = -ENOMEM; |
1010 |
++ kfree(read); |
1011 |
++ goto unlock; |
1012 |
++ } |
1013 |
++ |
1014 |
+ for (j = 0; j < msg[i].len; j++) { |
1015 |
+ /* Last byte of transaction? |
1016 |
+ * Send STOP, otherwise send ACK. */ |
1017 |
+@@ -291,9 +298,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu |
1018 |
+ |
1019 |
+ if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, |
1020 |
+ 0x20 | stop, |
1021 |
+- &msg[i].buf[j], 1)) != 0) |
1022 |
++ read, 1)) != 0) |
1023 |
+ goto unlock; |
1024 |
++ msg[i].buf[j] = read[0]; |
1025 |
+ } |
1026 |
++ |
1027 |
++ kfree(read); |
1028 |
+ } else { |
1029 |
+ for (j = 0; j < msg[i].len; j++) { |
1030 |
+ /* Last byte of transaction? Then send STOP. */ |
1031 |
+diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c |
1032 |
+index 37456079f490d..f9c6274921215 100644 |
1033 |
+--- a/drivers/media/usb/em28xx/em28xx-core.c |
1034 |
++++ b/drivers/media/usb/em28xx/em28xx-core.c |
1035 |
+@@ -99,7 +99,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, |
1036 |
+ mutex_lock(&dev->ctrl_urb_lock); |
1037 |
+ ret = usb_control_msg(dev->udev, pipe, req, |
1038 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
1039 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
1040 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
1041 |
+ if (ret < 0) { |
1042 |
+ if (reg_debug) |
1043 |
+ printk(" failed!\n"); |
1044 |
+@@ -182,7 +182,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, |
1045 |
+ memcpy(dev->urb_buf, buf, len); |
1046 |
+ ret = usb_control_msg(dev->udev, pipe, req, |
1047 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
1048 |
+- 0x0000, reg, dev->urb_buf, len, HZ); |
1049 |
++ 0x0000, reg, dev->urb_buf, len, 1000); |
1050 |
+ mutex_unlock(&dev->ctrl_urb_lock); |
1051 |
+ |
1052 |
+ if (ret < 0) |
1053 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
1054 |
+index ba3b0141538d6..1d0787f0b9a2a 100644 |
1055 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
1056 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
1057 |
+@@ -1488,7 +1488,7 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) |
1058 |
+ for (address = 0; address < fwsize; address += 0x800) { |
1059 |
+ memcpy(fw_ptr, fw_entry->data + address, 0x800); |
1060 |
+ ret += usb_control_msg(hdw->usb_dev, pipe, 0xa0, 0x40, address, |
1061 |
+- 0, fw_ptr, 0x800, HZ); |
1062 |
++ 0, fw_ptr, 0x800, 1000); |
1063 |
+ } |
1064 |
+ |
1065 |
+ trace_firmware("Upload done, releasing device's CPU"); |
1066 |
+@@ -1627,7 +1627,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) |
1067 |
+ ((u32 *)fw_ptr)[icnt] = swab32(((u32 *)fw_ptr)[icnt]); |
1068 |
+ |
1069 |
+ ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt, |
1070 |
+- &actual_length, HZ); |
1071 |
++ &actual_length, 1000); |
1072 |
+ ret |= (actual_length != bcnt); |
1073 |
+ if (ret) break; |
1074 |
+ fw_done += bcnt; |
1075 |
+@@ -3491,7 +3491,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, |
1076 |
+ 0xa0,0xc0, |
1077 |
+ address,0, |
1078 |
+ hdw->fw_buffer+address, |
1079 |
+- 0x800,HZ); |
1080 |
++ 0x800,1000); |
1081 |
+ if (ret < 0) break; |
1082 |
+ } |
1083 |
+ |
1084 |
+@@ -4017,7 +4017,7 @@ void pvr2_hdw_cpureset_assert(struct pvr2_hdw *hdw,int val) |
1085 |
+ /* Write the CPUCS register on the 8051. The lsb of the register |
1086 |
+ is the reset bit; a 1 asserts reset while a 0 clears it. */ |
1087 |
+ pipe = usb_sndctrlpipe(hdw->usb_dev, 0); |
1088 |
+- ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,HZ); |
1089 |
++ ret = usb_control_msg(hdw->usb_dev,pipe,0xa0,0x40,0xe600,0,da,1,1000); |
1090 |
+ if (ret < 0) { |
1091 |
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
1092 |
+ "cpureset_assert(%d) error=%d",val,ret); |
1093 |
+diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c |
1094 |
+index 1b6836f15370d..bc120c4e59f6f 100644 |
1095 |
+--- a/drivers/media/usb/stk1160/stk1160-core.c |
1096 |
++++ b/drivers/media/usb/stk1160/stk1160-core.c |
1097 |
+@@ -76,7 +76,7 @@ int stk1160_read_reg(struct stk1160 *dev, u16 reg, u8 *value) |
1098 |
+ return -ENOMEM; |
1099 |
+ ret = usb_control_msg(dev->udev, pipe, 0x00, |
1100 |
+ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
1101 |
+- 0x00, reg, buf, sizeof(u8), HZ); |
1102 |
++ 0x00, reg, buf, sizeof(u8), 1000); |
1103 |
+ if (ret < 0) { |
1104 |
+ stk1160_err("read failed on reg 0x%x (%d)\n", |
1105 |
+ reg, ret); |
1106 |
+@@ -96,7 +96,7 @@ int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value) |
1107 |
+ |
1108 |
+ ret = usb_control_msg(dev->udev, pipe, 0x01, |
1109 |
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
1110 |
+- value, reg, NULL, 0, HZ); |
1111 |
++ value, reg, NULL, 0, 1000); |
1112 |
+ if (ret < 0) { |
1113 |
+ stk1160_err("write failed on reg 0x%x (%d)\n", |
1114 |
+ reg, ret); |
1115 |
+diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c |
1116 |
+index 3fae3bfb2bdd5..4e3938f1ad62a 100644 |
1117 |
+--- a/drivers/media/usb/uvc/uvc_video.c |
1118 |
++++ b/drivers/media/usb/uvc/uvc_video.c |
1119 |
+@@ -1720,6 +1720,10 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags) |
1120 |
+ if (ep == NULL) |
1121 |
+ return -EIO; |
1122 |
+ |
1123 |
++ /* Reject broken descriptors. */ |
1124 |
++ if (usb_endpoint_maxp(&ep->desc) == 0) |
1125 |
++ return -EIO; |
1126 |
++ |
1127 |
+ ret = uvc_init_video_bulk(stream, ep, gfp_flags); |
1128 |
+ } |
1129 |
+ |
1130 |
+diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c |
1131 |
+index b6fd9041f82fc..66f9beb2c5ba9 100644 |
1132 |
+--- a/drivers/mfd/intel-lpss-acpi.c |
1133 |
++++ b/drivers/mfd/intel-lpss-acpi.c |
1134 |
+@@ -53,6 +53,7 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) |
1135 |
+ { |
1136 |
+ struct intel_lpss_platform_info *info; |
1137 |
+ const struct acpi_device_id *id; |
1138 |
++ int ret; |
1139 |
+ |
1140 |
+ id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev); |
1141 |
+ if (!id) |
1142 |
+@@ -66,10 +67,14 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) |
1143 |
+ info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1144 |
+ info->irq = platform_get_irq(pdev, 0); |
1145 |
+ |
1146 |
++ ret = intel_lpss_probe(&pdev->dev, info); |
1147 |
++ if (ret) |
1148 |
++ return ret; |
1149 |
++ |
1150 |
+ pm_runtime_set_active(&pdev->dev); |
1151 |
+ pm_runtime_enable(&pdev->dev); |
1152 |
+ |
1153 |
+- return intel_lpss_probe(&pdev->dev, info); |
1154 |
++ return 0; |
1155 |
+ } |
1156 |
+ |
1157 |
+ static int intel_lpss_acpi_remove(struct platform_device *pdev) |
1158 |
+diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c |
1159 |
+index 626fdcaf25101..645d26536114f 100644 |
1160 |
+--- a/drivers/misc/lattice-ecp3-config.c |
1161 |
++++ b/drivers/misc/lattice-ecp3-config.c |
1162 |
+@@ -81,12 +81,12 @@ static void firmware_load(const struct firmware *fw, void *context) |
1163 |
+ |
1164 |
+ if (fw == NULL) { |
1165 |
+ dev_err(&spi->dev, "Cannot load firmware, aborting\n"); |
1166 |
+- return; |
1167 |
++ goto out; |
1168 |
+ } |
1169 |
+ |
1170 |
+ if (fw->size == 0) { |
1171 |
+ dev_err(&spi->dev, "Error: Firmware size is 0!\n"); |
1172 |
+- return; |
1173 |
++ goto out; |
1174 |
+ } |
1175 |
+ |
1176 |
+ /* Fill dummy data (24 stuffing bits for commands) */ |
1177 |
+@@ -108,7 +108,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
1178 |
+ dev_err(&spi->dev, |
1179 |
+ "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", |
1180 |
+ jedec_id); |
1181 |
+- return; |
1182 |
++ goto out; |
1183 |
+ } |
1184 |
+ |
1185 |
+ dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); |
1186 |
+@@ -121,7 +121,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
1187 |
+ buffer = kzalloc(fw->size + 8, GFP_KERNEL); |
1188 |
+ if (!buffer) { |
1189 |
+ dev_err(&spi->dev, "Error: Can't allocate memory!\n"); |
1190 |
+- return; |
1191 |
++ goto out; |
1192 |
+ } |
1193 |
+ |
1194 |
+ /* |
1195 |
+@@ -160,7 +160,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
1196 |
+ "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", |
1197 |
+ status); |
1198 |
+ kfree(buffer); |
1199 |
+- return; |
1200 |
++ goto out; |
1201 |
+ } |
1202 |
+ |
1203 |
+ dev_info(&spi->dev, "Configuring the FPGA...\n"); |
1204 |
+@@ -186,7 +186,7 @@ static void firmware_load(const struct firmware *fw, void *context) |
1205 |
+ release_firmware(fw); |
1206 |
+ |
1207 |
+ kfree(buffer); |
1208 |
+- |
1209 |
++out: |
1210 |
+ complete(&data->fw_loaded); |
1211 |
+ } |
1212 |
+ |
1213 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
1214 |
+index d6363ae220526..bbf18d6e4f677 100644 |
1215 |
+--- a/drivers/net/bonding/bond_main.c |
1216 |
++++ b/drivers/net/bonding/bond_main.c |
1217 |
+@@ -785,14 +785,14 @@ static bool bond_should_notify_peers(struct bonding *bond) |
1218 |
+ slave = rcu_dereference(bond->curr_active_slave); |
1219 |
+ rcu_read_unlock(); |
1220 |
+ |
1221 |
+- netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
1222 |
+- slave ? slave->dev->name : "NULL"); |
1223 |
+- |
1224 |
+ if (!slave || !bond->send_peer_notif || |
1225 |
+ !netif_carrier_ok(bond->dev) || |
1226 |
+ test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
1227 |
+ return false; |
1228 |
+ |
1229 |
++ netdev_dbg(bond->dev, "bond_should_notify_peers: slave %s\n", |
1230 |
++ slave ? slave->dev->name : "NULL"); |
1231 |
++ |
1232 |
+ return true; |
1233 |
+ } |
1234 |
+ |
1235 |
+diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c |
1236 |
+index cdc0c7433a4b5..9fbed88d6c821 100644 |
1237 |
+--- a/drivers/net/can/softing/softing_cs.c |
1238 |
++++ b/drivers/net/can/softing/softing_cs.c |
1239 |
+@@ -304,7 +304,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia) |
1240 |
+ return 0; |
1241 |
+ |
1242 |
+ platform_failed: |
1243 |
+- kfree(dev); |
1244 |
++ platform_device_put(pdev); |
1245 |
+ mem_failed: |
1246 |
+ pcmcia_bad: |
1247 |
+ pcmcia_failed: |
1248 |
+diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c |
1249 |
+index 52fe50725d749..a74c779feb90e 100644 |
1250 |
+--- a/drivers/net/can/softing/softing_fw.c |
1251 |
++++ b/drivers/net/can/softing/softing_fw.c |
1252 |
+@@ -576,18 +576,19 @@ int softing_startstop(struct net_device *dev, int up) |
1253 |
+ if (ret < 0) |
1254 |
+ goto failed; |
1255 |
+ } |
1256 |
+- /* enable_error_frame */ |
1257 |
+- /* |
1258 |
++ |
1259 |
++ /* enable_error_frame |
1260 |
++ * |
1261 |
+ * Error reporting is switched off at the moment since |
1262 |
+ * the receiving of them is not yet 100% verified |
1263 |
+ * This should be enabled sooner or later |
1264 |
+- * |
1265 |
+- if (error_reporting) { |
1266 |
++ */ |
1267 |
++ if (0 && error_reporting) { |
1268 |
+ ret = softing_fct_cmd(card, 51, "enable_error_frame"); |
1269 |
+ if (ret < 0) |
1270 |
+ goto failed; |
1271 |
+ } |
1272 |
+- */ |
1273 |
++ |
1274 |
+ /* initialize interface */ |
1275 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); |
1276 |
+ iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); |
1277 |
+diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c |
1278 |
+index 3e965b00bc09f..c2ce98929e031 100644 |
1279 |
+--- a/drivers/net/can/usb/gs_usb.c |
1280 |
++++ b/drivers/net/can/usb/gs_usb.c |
1281 |
+@@ -303,7 +303,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
1282 |
+ |
1283 |
+ /* device reports out of range channel id */ |
1284 |
+ if (hf->channel >= GS_MAX_INTF) |
1285 |
+- goto resubmit_urb; |
1286 |
++ goto device_detach; |
1287 |
+ |
1288 |
+ dev = usbcan->canch[hf->channel]; |
1289 |
+ |
1290 |
+@@ -388,6 +388,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) |
1291 |
+ |
1292 |
+ /* USB failure take down all interfaces */ |
1293 |
+ if (rc == -ENODEV) { |
1294 |
++ device_detach: |
1295 |
+ for (rc = 0; rc < GS_MAX_INTF; rc++) { |
1296 |
+ if (usbcan->canch[rc]) |
1297 |
+ netif_device_detach(usbcan->canch[rc]->netdev); |
1298 |
+@@ -490,6 +491,8 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, struct net_device *net |
1299 |
+ |
1300 |
+ hf->echo_id = idx; |
1301 |
+ hf->channel = dev->channel; |
1302 |
++ hf->flags = 0; |
1303 |
++ hf->reserved = 0; |
1304 |
+ |
1305 |
+ cf = (struct can_frame *)skb->data; |
1306 |
+ |
1307 |
+diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c |
1308 |
+index 700b98d9c2500..19745e88774e2 100644 |
1309 |
+--- a/drivers/net/can/xilinx_can.c |
1310 |
++++ b/drivers/net/can/xilinx_can.c |
1311 |
+@@ -1284,7 +1284,12 @@ static int xcan_probe(struct platform_device *pdev) |
1312 |
+ spin_lock_init(&priv->tx_lock); |
1313 |
+ |
1314 |
+ /* Get IRQ for the device */ |
1315 |
+- ndev->irq = platform_get_irq(pdev, 0); |
1316 |
++ ret = platform_get_irq(pdev, 0); |
1317 |
++ if (ret < 0) |
1318 |
++ goto err_free; |
1319 |
++ |
1320 |
++ ndev->irq = ret; |
1321 |
++ |
1322 |
+ ndev->flags |= IFF_ECHO; /* We support local echo */ |
1323 |
+ |
1324 |
+ platform_set_drvdata(pdev, ndev); |
1325 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1326 |
+index a1f9f68575f44..df946dd360e63 100644 |
1327 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1328 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
1329 |
+@@ -3443,10 +3443,12 @@ static int bcmgenet_probe(struct platform_device *pdev) |
1330 |
+ |
1331 |
+ /* Request the WOL interrupt and advertise suspend if available */ |
1332 |
+ priv->wol_irq_disabled = true; |
1333 |
+- err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0, |
1334 |
+- dev->name, priv); |
1335 |
+- if (!err) |
1336 |
+- device_set_wakeup_capable(&pdev->dev, 1); |
1337 |
++ if (priv->wol_irq > 0) { |
1338 |
++ err = devm_request_irq(&pdev->dev, priv->wol_irq, |
1339 |
++ bcmgenet_wol_isr, 0, dev->name, priv); |
1340 |
++ if (!err) |
1341 |
++ device_set_wakeup_capable(&pdev->dev, 1); |
1342 |
++ } |
1343 |
+ |
1344 |
+ /* Set the needed headroom to account for any possible |
1345 |
+ * features enabling/disabling at runtime |
1346 |
+diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c |
1347 |
+index a15b4a97c172d..171bfaa536b76 100644 |
1348 |
+--- a/drivers/net/ethernet/freescale/xgmac_mdio.c |
1349 |
++++ b/drivers/net/ethernet/freescale/xgmac_mdio.c |
1350 |
+@@ -304,9 +304,10 @@ err_ioremap: |
1351 |
+ static int xgmac_mdio_remove(struct platform_device *pdev) |
1352 |
+ { |
1353 |
+ struct mii_bus *bus = platform_get_drvdata(pdev); |
1354 |
++ struct mdio_fsl_priv *priv = bus->priv; |
1355 |
+ |
1356 |
+ mdiobus_unregister(bus); |
1357 |
+- iounmap(bus->priv); |
1358 |
++ iounmap(priv->mdio_base); |
1359 |
+ mdiobus_free(bus); |
1360 |
+ |
1361 |
+ return 0; |
1362 |
+diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c |
1363 |
+index 2af7f77345fbd..e4128e151b854 100644 |
1364 |
+--- a/drivers/net/ethernet/i825xx/sni_82596.c |
1365 |
++++ b/drivers/net/ethernet/i825xx/sni_82596.c |
1366 |
+@@ -122,9 +122,10 @@ static int sni_82596_probe(struct platform_device *dev) |
1367 |
+ netdevice->dev_addr[5] = readb(eth_addr + 0x06); |
1368 |
+ iounmap(eth_addr); |
1369 |
+ |
1370 |
+- if (!netdevice->irq) { |
1371 |
++ if (netdevice->irq < 0) { |
1372 |
+ printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", |
1373 |
+ __FILE__, netdevice->base_addr); |
1374 |
++ retval = netdevice->irq; |
1375 |
+ goto probe_failed; |
1376 |
+ } |
1377 |
+ |
1378 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
1379 |
+index 44870fc37f544..d7c583fedbe74 100644 |
1380 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
1381 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
1382 |
+@@ -278,6 +278,16 @@ static int axienet_dma_bd_init(struct net_device *ndev) |
1383 |
+ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, |
1384 |
+ cr | XAXIDMA_CR_RUNSTOP_MASK); |
1385 |
+ |
1386 |
++ /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ |
1387 |
++ ret = read_poll_timeout(axienet_ior, value, |
1388 |
++ value & XAE_INT_PHYRSTCMPLT_MASK, |
1389 |
++ DELAY_OF_ONE_MILLISEC, 50000, false, lp, |
1390 |
++ XAE_IS_OFFSET); |
1391 |
++ if (ret) { |
1392 |
++ dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__); |
1393 |
++ return ret; |
1394 |
++ } |
1395 |
++ |
1396 |
+ return 0; |
1397 |
+ out: |
1398 |
+ axienet_dma_bd_release(ndev); |
1399 |
+@@ -671,7 +681,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1400 |
+ num_frag = skb_shinfo(skb)->nr_frags; |
1401 |
+ cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; |
1402 |
+ |
1403 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) { |
1404 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) { |
1405 |
+ if (netif_queue_stopped(ndev)) |
1406 |
+ return NETDEV_TX_BUSY; |
1407 |
+ |
1408 |
+@@ -681,7 +691,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1409 |
+ smp_mb(); |
1410 |
+ |
1411 |
+ /* Space might have just been freed - check again */ |
1412 |
+- if (axienet_check_tx_bd_space(lp, num_frag)) |
1413 |
++ if (axienet_check_tx_bd_space(lp, num_frag + 1)) |
1414 |
+ return NETDEV_TX_BUSY; |
1415 |
+ |
1416 |
+ netif_wake_queue(ndev); |
1417 |
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c |
1418 |
+index 4066fb5a935a7..2fb95cca33183 100644 |
1419 |
+--- a/drivers/net/phy/mdio_bus.c |
1420 |
++++ b/drivers/net/phy/mdio_bus.c |
1421 |
+@@ -295,7 +295,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) |
1422 |
+ } |
1423 |
+ |
1424 |
+ bus->state = MDIOBUS_REGISTERED; |
1425 |
+- pr_info("%s: probed\n", bus->name); |
1426 |
++ dev_dbg(&bus->dev, "probed\n"); |
1427 |
+ return 0; |
1428 |
+ |
1429 |
+ error: |
1430 |
+diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c |
1431 |
+index 46448d7e32902..679b14759379f 100644 |
1432 |
+--- a/drivers/net/ppp/ppp_generic.c |
1433 |
++++ b/drivers/net/ppp/ppp_generic.c |
1434 |
+@@ -70,6 +70,8 @@ |
1435 |
+ #define MPHDRLEN 6 /* multilink protocol header length */ |
1436 |
+ #define MPHDRLEN_SSN 4 /* ditto with short sequence numbers */ |
1437 |
+ |
1438 |
++#define PPP_PROTO_LEN 2 |
1439 |
++ |
1440 |
+ /* |
1441 |
+ * An instance of /dev/ppp can be associated with either a ppp |
1442 |
+ * interface unit or a ppp channel. In both cases, file->private_data |
1443 |
+@@ -487,6 +489,9 @@ static ssize_t ppp_write(struct file *file, const char __user *buf, |
1444 |
+ |
1445 |
+ if (!pf) |
1446 |
+ return -ENXIO; |
1447 |
++ /* All PPP packets should start with the 2-byte protocol */ |
1448 |
++ if (count < PPP_PROTO_LEN) |
1449 |
++ return -EINVAL; |
1450 |
+ ret = -ENOMEM; |
1451 |
+ skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); |
1452 |
+ if (!skb) |
1453 |
+@@ -1293,7 +1298,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) |
1454 |
+ } |
1455 |
+ |
1456 |
+ ++ppp->stats64.tx_packets; |
1457 |
+- ppp->stats64.tx_bytes += skb->len - 2; |
1458 |
++ ppp->stats64.tx_bytes += skb->len - PPP_PROTO_LEN; |
1459 |
+ |
1460 |
+ switch (proto) { |
1461 |
+ case PPP_IP: |
1462 |
+diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c |
1463 |
+index 4f345bd4e6e29..95151b46f2001 100644 |
1464 |
+--- a/drivers/net/usb/mcs7830.c |
1465 |
++++ b/drivers/net/usb/mcs7830.c |
1466 |
+@@ -121,8 +121,16 @@ static const char driver_name[] = "MOSCHIP usb-ethernet driver"; |
1467 |
+ |
1468 |
+ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data) |
1469 |
+ { |
1470 |
+- return usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
1471 |
+- 0x0000, index, data, size); |
1472 |
++ int ret; |
1473 |
++ |
1474 |
++ ret = usbnet_read_cmd(dev, MCS7830_RD_BREQ, MCS7830_RD_BMREQ, |
1475 |
++ 0x0000, index, data, size); |
1476 |
++ if (ret < 0) |
1477 |
++ return ret; |
1478 |
++ else if (ret < size) |
1479 |
++ return -ENODATA; |
1480 |
++ |
1481 |
++ return ret; |
1482 |
+ } |
1483 |
+ |
1484 |
+ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, const void *data) |
1485 |
+diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c |
1486 |
+index bc6330b437958..67c20cb92f138 100644 |
1487 |
+--- a/drivers/net/wireless/ath/ar5523/ar5523.c |
1488 |
++++ b/drivers/net/wireless/ath/ar5523/ar5523.c |
1489 |
+@@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb) |
1490 |
+ ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); |
1491 |
+ return; |
1492 |
+ } |
1493 |
++ if (!cmd->odata) { |
1494 |
++ ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply"); |
1495 |
++ return; |
1496 |
++ } |
1497 |
+ memcpy(cmd->odata, hdr + 1, sizeof(u32)); |
1498 |
+ cmd->olen = sizeof(u32); |
1499 |
+ cmd->res = 0; |
1500 |
+diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c |
1501 |
+index 75072a8f8cf42..15fb14f818f8b 100644 |
1502 |
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c |
1503 |
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c |
1504 |
+@@ -586,6 +586,13 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, |
1505 |
+ return; |
1506 |
+ } |
1507 |
+ |
1508 |
++ if (pkt_len > 2 * MAX_RX_BUF_SIZE) { |
1509 |
++ dev_err(&hif_dev->udev->dev, |
1510 |
++ "ath9k_htc: invalid pkt_len (%x)\n", pkt_len); |
1511 |
++ RX_STAT_INC(skb_dropped); |
1512 |
++ return; |
1513 |
++ } |
1514 |
++ |
1515 |
+ pad_len = 4 - (pkt_len & 0x3); |
1516 |
+ if (pad_len == 4) |
1517 |
+ pad_len = 0; |
1518 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
1519 |
+index ca498b1f1f568..6417fda88733c 100644 |
1520 |
+--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
1521 |
++++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c |
1522 |
+@@ -1957,6 +1957,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
1523 |
+ struct iwl_mvm_mc_iter_data iter_data = { |
1524 |
+ .mvm = mvm, |
1525 |
+ }; |
1526 |
++ int ret; |
1527 |
+ |
1528 |
+ lockdep_assert_held(&mvm->mutex); |
1529 |
+ |
1530 |
+@@ -1966,6 +1967,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) |
1531 |
+ ieee80211_iterate_active_interfaces_atomic( |
1532 |
+ mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
1533 |
+ iwl_mvm_mc_iface_iterator, &iter_data); |
1534 |
++ |
1535 |
++ /* |
1536 |
++ * Send a (synchronous) ech command so that we wait for the |
1537 |
++ * multiple asynchronous MCAST_FILTER_CMD commands sent by |
1538 |
++ * the interface iterator. Otherwise, we might get here over |
1539 |
++ * and over again (by userspace just sending a lot of these) |
1540 |
++ * and the CPU can send them faster than the firmware can |
1541 |
++ * process them. |
1542 |
++ * Note that the CPU is still faster - but with this we'll |
1543 |
++ * actually send fewer commands overall because the CPU will |
1544 |
++ * not schedule the work in mac80211 as frequently if it's |
1545 |
++ * still running when rescheduled (possibly multiple times). |
1546 |
++ */ |
1547 |
++ ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); |
1548 |
++ if (ret) |
1549 |
++ IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); |
1550 |
+ } |
1551 |
+ |
1552 |
+ static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw, |
1553 |
+diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c |
1554 |
+index 1be7b219cb202..4cdf6450aeedd 100644 |
1555 |
+--- a/drivers/net/wireless/mwifiex/usb.c |
1556 |
++++ b/drivers/net/wireless/mwifiex/usb.c |
1557 |
+@@ -132,7 +132,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, |
1558 |
+ default: |
1559 |
+ mwifiex_dbg(adapter, ERROR, |
1560 |
+ "unknown recv_type %#x\n", recv_type); |
1561 |
+- return -1; |
1562 |
++ ret = -1; |
1563 |
++ goto exit_restore_skb; |
1564 |
+ } |
1565 |
+ break; |
1566 |
+ case MWIFIEX_USB_EP_DATA: |
1567 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1568 |
+index 137d7c8645dae..380a2dcb95afd 100644 |
1569 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1570 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1571 |
+@@ -1062,6 +1062,7 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw) |
1572 |
+ _InitPABias(hw); |
1573 |
+ rtl92c_dm_init(hw); |
1574 |
+ exit: |
1575 |
++ local_irq_disable(); |
1576 |
+ local_irq_restore(flags); |
1577 |
+ return err; |
1578 |
+ } |
1579 |
+diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c |
1580 |
+index 3651c3871d5b4..1b4aacf2ff9a5 100644 |
1581 |
+--- a/drivers/parisc/pdc_stable.c |
1582 |
++++ b/drivers/parisc/pdc_stable.c |
1583 |
+@@ -992,8 +992,10 @@ pdcs_register_pathentries(void) |
1584 |
+ entry->kobj.kset = paths_kset; |
1585 |
+ err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL, |
1586 |
+ "%s", entry->name); |
1587 |
+- if (err) |
1588 |
++ if (err) { |
1589 |
++ kobject_put(&entry->kobj); |
1590 |
+ return err; |
1591 |
++ } |
1592 |
+ |
1593 |
+ /* kobject is now registered */ |
1594 |
+ write_lock(&entry->rw_lock); |
1595 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
1596 |
+index 8df369fac3dfb..518383e5cb6d0 100644 |
1597 |
+--- a/drivers/pci/quirks.c |
1598 |
++++ b/drivers/pci/quirks.c |
1599 |
+@@ -3657,6 +3657,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9120, |
1600 |
+ quirk_dma_func1_alias); |
1601 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123, |
1602 |
+ quirk_dma_func1_alias); |
1603 |
++/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c136 */ |
1604 |
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9125, |
1605 |
++ quirk_dma_func1_alias); |
1606 |
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, |
1607 |
+ quirk_dma_func1_alias); |
1608 |
+ /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ |
1609 |
+diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c |
1610 |
+index c3b615c94b4bf..a92cbc952b70b 100644 |
1611 |
+--- a/drivers/pcmcia/cs.c |
1612 |
++++ b/drivers/pcmcia/cs.c |
1613 |
+@@ -665,18 +665,16 @@ static int pccardd(void *__skt) |
1614 |
+ if (events || sysfs_events) |
1615 |
+ continue; |
1616 |
+ |
1617 |
++ set_current_state(TASK_INTERRUPTIBLE); |
1618 |
+ if (kthread_should_stop()) |
1619 |
+ break; |
1620 |
+ |
1621 |
+- set_current_state(TASK_INTERRUPTIBLE); |
1622 |
+- |
1623 |
+ schedule(); |
1624 |
+ |
1625 |
+- /* make sure we are running */ |
1626 |
+- __set_current_state(TASK_RUNNING); |
1627 |
+- |
1628 |
+ try_to_freeze(); |
1629 |
+ } |
1630 |
++ /* make sure we are running before we exit */ |
1631 |
++ __set_current_state(TASK_RUNNING); |
1632 |
+ |
1633 |
+ /* shut down socket, if a device is still present */ |
1634 |
+ if (skt->state & SOCKET_PRESENT) { |
1635 |
+diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c |
1636 |
+index 5ef7b46a25786..2e96d9273b780 100644 |
1637 |
+--- a/drivers/pcmcia/rsrc_nonstatic.c |
1638 |
++++ b/drivers/pcmcia/rsrc_nonstatic.c |
1639 |
+@@ -693,6 +693,9 @@ static struct resource *__nonstatic_find_io_region(struct pcmcia_socket *s, |
1640 |
+ unsigned long min = base; |
1641 |
+ int ret; |
1642 |
+ |
1643 |
++ if (!res) |
1644 |
++ return NULL; |
1645 |
++ |
1646 |
+ data.mask = align - 1; |
1647 |
+ data.offset = base & data.mask; |
1648 |
+ data.map = &s_data->io_db; |
1649 |
+@@ -812,6 +815,9 @@ static struct resource *nonstatic_find_mem_region(u_long base, u_long num, |
1650 |
+ unsigned long min, max; |
1651 |
+ int ret, i, j; |
1652 |
+ |
1653 |
++ if (!res) |
1654 |
++ return NULL; |
1655 |
++ |
1656 |
+ low = low || !(s->features & SS_CAP_PAGE_REGS); |
1657 |
+ |
1658 |
+ data.mask = align - 1; |
1659 |
+diff --git a/drivers/power/bq25890_charger.c b/drivers/power/bq25890_charger.c |
1660 |
+index f993a55cde20f..faf2a62435674 100644 |
1661 |
+--- a/drivers/power/bq25890_charger.c |
1662 |
++++ b/drivers/power/bq25890_charger.c |
1663 |
+@@ -521,12 +521,12 @@ static void bq25890_handle_state_change(struct bq25890_device *bq, |
1664 |
+ |
1665 |
+ if (!new_state->online) { /* power removed */ |
1666 |
+ /* disable ADC */ |
1667 |
+- ret = bq25890_field_write(bq, F_CONV_START, 0); |
1668 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 0); |
1669 |
+ if (ret < 0) |
1670 |
+ goto error; |
1671 |
+ } else if (!old_state.online) { /* power inserted */ |
1672 |
+ /* enable ADC, to have control of charge current/voltage */ |
1673 |
+- ret = bq25890_field_write(bq, F_CONV_START, 1); |
1674 |
++ ret = bq25890_field_write(bq, F_CONV_RATE, 1); |
1675 |
+ if (ret < 0) |
1676 |
+ goto error; |
1677 |
+ } |
1678 |
+diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c |
1679 |
+index 86015b393dd50..41de5f1331fec 100644 |
1680 |
+--- a/drivers/rtc/rtc-cmos.c |
1681 |
++++ b/drivers/rtc/rtc-cmos.c |
1682 |
+@@ -343,7 +343,10 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
1683 |
+ min = t->time.tm_min; |
1684 |
+ sec = t->time.tm_sec; |
1685 |
+ |
1686 |
++ spin_lock_irq(&rtc_lock); |
1687 |
+ rtc_control = CMOS_READ(RTC_CONTROL); |
1688 |
++ spin_unlock_irq(&rtc_lock); |
1689 |
++ |
1690 |
+ if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
1691 |
+ /* Writing 0xff means "don't care" or "match all". */ |
1692 |
+ mon = (mon <= 12) ? bin2bcd(mon) : 0xff; |
1693 |
+diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c |
1694 |
+index df019b78d9f79..e26d6cc3c8716 100644 |
1695 |
+--- a/drivers/scsi/sr.c |
1696 |
++++ b/drivers/scsi/sr.c |
1697 |
+@@ -883,7 +883,7 @@ static void get_capabilities(struct scsi_cd *cd) |
1698 |
+ |
1699 |
+ |
1700 |
+ /* allocate transfer buffer */ |
1701 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
1702 |
++ buffer = kmalloc(512, GFP_KERNEL); |
1703 |
+ if (!buffer) { |
1704 |
+ sr_printk(KERN_ERR, cd, "out of memory.\n"); |
1705 |
+ return; |
1706 |
+diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c |
1707 |
+index 11a238cb22223..629bfe1b20263 100644 |
1708 |
+--- a/drivers/scsi/sr_vendor.c |
1709 |
++++ b/drivers/scsi/sr_vendor.c |
1710 |
+@@ -118,7 +118,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength) |
1711 |
+ density = (blocklength > 2048) ? 0x81 : 0x83; |
1712 |
+ #endif |
1713 |
+ |
1714 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
1715 |
++ buffer = kmalloc(512, GFP_KERNEL); |
1716 |
+ if (!buffer) |
1717 |
+ return -ENOMEM; |
1718 |
+ |
1719 |
+@@ -166,7 +166,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) |
1720 |
+ if (cd->cdi.mask & CDC_MULTI_SESSION) |
1721 |
+ return 0; |
1722 |
+ |
1723 |
+- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); |
1724 |
++ buffer = kmalloc(512, GFP_KERNEL); |
1725 |
+ if (!buffer) |
1726 |
+ return -ENOMEM; |
1727 |
+ |
1728 |
+diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c |
1729 |
+index 2465259f62411..8e662e7a35181 100644 |
1730 |
+--- a/drivers/spi/spi-meson-spifc.c |
1731 |
++++ b/drivers/spi/spi-meson-spifc.c |
1732 |
+@@ -357,6 +357,7 @@ static int meson_spifc_probe(struct platform_device *pdev) |
1733 |
+ return 0; |
1734 |
+ out_clk: |
1735 |
+ clk_disable_unprepare(spifc->clk); |
1736 |
++ pm_runtime_disable(spifc->dev); |
1737 |
+ out_err: |
1738 |
+ spi_master_put(master); |
1739 |
+ return ret; |
1740 |
+diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c |
1741 |
+index 5d41d5b92619a..7f4ba92739663 100644 |
1742 |
+--- a/drivers/tty/serial/amba-pl010.c |
1743 |
++++ b/drivers/tty/serial/amba-pl010.c |
1744 |
+@@ -465,14 +465,11 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, |
1745 |
+ if ((termios->c_cflag & CREAD) == 0) |
1746 |
+ uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; |
1747 |
+ |
1748 |
+- /* first, disable everything */ |
1749 |
+ old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; |
1750 |
+ |
1751 |
+ if (UART_ENABLE_MS(port, termios->c_cflag)) |
1752 |
+ old_cr |= UART010_CR_MSIE; |
1753 |
+ |
1754 |
+- writel(0, uap->port.membase + UART010_CR); |
1755 |
+- |
1756 |
+ /* Set baud rate */ |
1757 |
+ quot -= 1; |
1758 |
+ writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); |
1759 |
+diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
1760 |
+index ecace294dc7e6..75932d68a722f 100644 |
1761 |
+--- a/drivers/tty/serial/amba-pl011.c |
1762 |
++++ b/drivers/tty/serial/amba-pl011.c |
1763 |
+@@ -1944,32 +1944,13 @@ static const char *pl011_type(struct uart_port *port) |
1764 |
+ return uap->port.type == PORT_AMBA ? uap->type : NULL; |
1765 |
+ } |
1766 |
+ |
1767 |
+-/* |
1768 |
+- * Release the memory region(s) being used by 'port' |
1769 |
+- */ |
1770 |
+-static void pl011_release_port(struct uart_port *port) |
1771 |
+-{ |
1772 |
+- release_mem_region(port->mapbase, SZ_4K); |
1773 |
+-} |
1774 |
+- |
1775 |
+-/* |
1776 |
+- * Request the memory region(s) being used by 'port' |
1777 |
+- */ |
1778 |
+-static int pl011_request_port(struct uart_port *port) |
1779 |
+-{ |
1780 |
+- return request_mem_region(port->mapbase, SZ_4K, "uart-pl011") |
1781 |
+- != NULL ? 0 : -EBUSY; |
1782 |
+-} |
1783 |
+- |
1784 |
+ /* |
1785 |
+ * Configure/autoconfigure the port. |
1786 |
+ */ |
1787 |
+ static void pl011_config_port(struct uart_port *port, int flags) |
1788 |
+ { |
1789 |
+- if (flags & UART_CONFIG_TYPE) { |
1790 |
++ if (flags & UART_CONFIG_TYPE) |
1791 |
+ port->type = PORT_AMBA; |
1792 |
+- pl011_request_port(port); |
1793 |
+- } |
1794 |
+ } |
1795 |
+ |
1796 |
+ /* |
1797 |
+@@ -1984,6 +1965,8 @@ static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser) |
1798 |
+ ret = -EINVAL; |
1799 |
+ if (ser->baud_base < 9600) |
1800 |
+ ret = -EINVAL; |
1801 |
++ if (port->mapbase != (unsigned long) ser->iomem_base) |
1802 |
++ ret = -EINVAL; |
1803 |
+ return ret; |
1804 |
+ } |
1805 |
+ |
1806 |
+@@ -2001,8 +1984,6 @@ static struct uart_ops amba_pl011_pops = { |
1807 |
+ .flush_buffer = pl011_dma_flush_buffer, |
1808 |
+ .set_termios = pl011_set_termios, |
1809 |
+ .type = pl011_type, |
1810 |
+- .release_port = pl011_release_port, |
1811 |
+- .request_port = pl011_request_port, |
1812 |
+ .config_port = pl011_config_port, |
1813 |
+ .verify_port = pl011_verify_port, |
1814 |
+ #ifdef CONFIG_CONSOLE_POLL |
1815 |
+@@ -2032,8 +2013,6 @@ static const struct uart_ops sbsa_uart_pops = { |
1816 |
+ .shutdown = sbsa_uart_shutdown, |
1817 |
+ .set_termios = sbsa_uart_set_termios, |
1818 |
+ .type = pl011_type, |
1819 |
+- .release_port = pl011_release_port, |
1820 |
+- .request_port = pl011_request_port, |
1821 |
+ .config_port = pl011_config_port, |
1822 |
+ .verify_port = pl011_verify_port, |
1823 |
+ #ifdef CONFIG_CONSOLE_POLL |
1824 |
+diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
1825 |
+index 3bd19de7df71b..e49493703179d 100644 |
1826 |
+--- a/drivers/tty/serial/atmel_serial.c |
1827 |
++++ b/drivers/tty/serial/atmel_serial.c |
1828 |
+@@ -928,6 +928,13 @@ static void atmel_tx_dma(struct uart_port *port) |
1829 |
+ desc->callback = atmel_complete_tx_dma; |
1830 |
+ desc->callback_param = atmel_port; |
1831 |
+ atmel_port->cookie_tx = dmaengine_submit(desc); |
1832 |
++ if (dma_submit_error(atmel_port->cookie_tx)) { |
1833 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
1834 |
++ atmel_port->cookie_tx); |
1835 |
++ return; |
1836 |
++ } |
1837 |
++ |
1838 |
++ dma_async_issue_pending(chan); |
1839 |
+ } |
1840 |
+ |
1841 |
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
1842 |
+@@ -1186,6 +1193,13 @@ static int atmel_prepare_rx_dma(struct uart_port *port) |
1843 |
+ desc->callback_param = port; |
1844 |
+ atmel_port->desc_rx = desc; |
1845 |
+ atmel_port->cookie_rx = dmaengine_submit(desc); |
1846 |
++ if (dma_submit_error(atmel_port->cookie_rx)) { |
1847 |
++ dev_err(port->dev, "dma_submit_error %d\n", |
1848 |
++ atmel_port->cookie_rx); |
1849 |
++ goto chan_err; |
1850 |
++ } |
1851 |
++ |
1852 |
++ dma_async_issue_pending(atmel_port->chan_rx); |
1853 |
+ |
1854 |
+ return 0; |
1855 |
+ |
1856 |
+diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
1857 |
+index 013fb874c64e2..8142135a2eec4 100644 |
1858 |
+--- a/drivers/tty/serial/serial_core.c |
1859 |
++++ b/drivers/tty/serial/serial_core.c |
1860 |
+@@ -2247,7 +2247,8 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, |
1861 |
+ * We probably don't need a spinlock around this, but |
1862 |
+ */ |
1863 |
+ spin_lock_irqsave(&port->lock, flags); |
1864 |
+- port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR); |
1865 |
++ port->mctrl &= TIOCM_DTR; |
1866 |
++ port->ops->set_mctrl(port, port->mctrl); |
1867 |
+ spin_unlock_irqrestore(&port->lock, flags); |
1868 |
+ |
1869 |
+ /* |
1870 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
1871 |
+index 99c146f4b6b51..3e0c1ff3a688e 100644 |
1872 |
+--- a/drivers/usb/core/hcd.c |
1873 |
++++ b/drivers/usb/core/hcd.c |
1874 |
+@@ -731,6 +731,7 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) |
1875 |
+ { |
1876 |
+ struct urb *urb; |
1877 |
+ int length; |
1878 |
++ int status; |
1879 |
+ unsigned long flags; |
1880 |
+ char buffer[6]; /* Any root hubs with > 31 ports? */ |
1881 |
+ |
1882 |
+@@ -748,11 +749,17 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) |
1883 |
+ if (urb) { |
1884 |
+ clear_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); |
1885 |
+ hcd->status_urb = NULL; |
1886 |
++ if (urb->transfer_buffer_length >= length) { |
1887 |
++ status = 0; |
1888 |
++ } else { |
1889 |
++ status = -EOVERFLOW; |
1890 |
++ length = urb->transfer_buffer_length; |
1891 |
++ } |
1892 |
+ urb->actual_length = length; |
1893 |
+ memcpy(urb->transfer_buffer, buffer, length); |
1894 |
+ |
1895 |
+ usb_hcd_unlink_urb_from_ep(hcd, urb); |
1896 |
+- usb_hcd_giveback_urb(hcd, urb, 0); |
1897 |
++ usb_hcd_giveback_urb(hcd, urb, status); |
1898 |
+ } else { |
1899 |
+ length = 0; |
1900 |
+ set_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); |
1901 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
1902 |
+index 66dda8d018caf..9b6d41740aaa6 100644 |
1903 |
+--- a/drivers/usb/core/hub.c |
1904 |
++++ b/drivers/usb/core/hub.c |
1905 |
+@@ -1054,7 +1054,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
1906 |
+ } else { |
1907 |
+ hub_power_on(hub, true); |
1908 |
+ } |
1909 |
+- } |
1910 |
++ /* Give some time on remote wakeup to let links to transit to U0 */ |
1911 |
++ } else if (hub_is_superspeed(hub->hdev)) |
1912 |
++ msleep(20); |
1913 |
++ |
1914 |
+ init2: |
1915 |
+ |
1916 |
+ /* |
1917 |
+@@ -1169,7 +1172,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
1918 |
+ */ |
1919 |
+ if (portchange || (hub_is_superspeed(hub->hdev) && |
1920 |
+ port_resumed)) |
1921 |
+- set_bit(port1, hub->change_bits); |
1922 |
++ set_bit(port1, hub->event_bits); |
1923 |
+ |
1924 |
+ } else if (udev->persist_enabled) { |
1925 |
+ #ifdef CONFIG_PM |
1926 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
1927 |
+index 390e592358e63..7af4d05dabeaa 100644 |
1928 |
+--- a/drivers/usb/gadget/function/f_fs.c |
1929 |
++++ b/drivers/usb/gadget/function/f_fs.c |
1930 |
+@@ -541,7 +541,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file) |
1931 |
+ file->private_data = ffs; |
1932 |
+ ffs_data_opened(ffs); |
1933 |
+ |
1934 |
+- return 0; |
1935 |
++ return stream_open(inode, file); |
1936 |
+ } |
1937 |
+ |
1938 |
+ static int ffs_ep0_release(struct inode *inode, struct file *file) |
1939 |
+@@ -882,7 +882,7 @@ ffs_epfile_open(struct inode *inode, struct file *file) |
1940 |
+ file->private_data = epfile; |
1941 |
+ ffs_data_opened(epfile->ffs); |
1942 |
+ |
1943 |
+- return 0; |
1944 |
++ return stream_open(inode, file); |
1945 |
+ } |
1946 |
+ |
1947 |
+ static int ffs_aio_cancel(struct kiocb *kiocb) |
1948 |
+diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c |
1949 |
+index 52c27cab78c3e..6f6315082bc44 100644 |
1950 |
+--- a/drivers/usb/misc/ftdi-elan.c |
1951 |
++++ b/drivers/usb/misc/ftdi-elan.c |
1952 |
+@@ -209,6 +209,7 @@ static void ftdi_elan_delete(struct kref *kref) |
1953 |
+ mutex_unlock(&ftdi_module_lock); |
1954 |
+ kfree(ftdi->bulk_in_buffer); |
1955 |
+ ftdi->bulk_in_buffer = NULL; |
1956 |
++ kfree(ftdi); |
1957 |
+ } |
1958 |
+ |
1959 |
+ static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) |
1960 |
+diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c |
1961 |
+index 365d6dff21de2..83c5864891424 100644 |
1962 |
+--- a/drivers/w1/slaves/w1_ds28e04.c |
1963 |
++++ b/drivers/w1/slaves/w1_ds28e04.c |
1964 |
+@@ -39,7 +39,7 @@ static int w1_strong_pullup = 1; |
1965 |
+ module_param_named(strong_pullup, w1_strong_pullup, int, 0); |
1966 |
+ |
1967 |
+ /* enable/disable CRC checking on DS28E04-100 memory accesses */ |
1968 |
+-static char w1_enable_crccheck = 1; |
1969 |
++static bool w1_enable_crccheck = true; |
1970 |
+ |
1971 |
+ #define W1_EEPROM_SIZE 512 |
1972 |
+ #define W1_PAGE_COUNT 16 |
1973 |
+@@ -346,32 +346,18 @@ static BIN_ATTR_RW(pio, 1); |
1974 |
+ static ssize_t crccheck_show(struct device *dev, struct device_attribute *attr, |
1975 |
+ char *buf) |
1976 |
+ { |
1977 |
+- if (put_user(w1_enable_crccheck + 0x30, buf)) |
1978 |
+- return -EFAULT; |
1979 |
+- |
1980 |
+- return sizeof(w1_enable_crccheck); |
1981 |
++ return sysfs_emit(buf, "%d\n", w1_enable_crccheck); |
1982 |
+ } |
1983 |
+ |
1984 |
+ static ssize_t crccheck_store(struct device *dev, struct device_attribute *attr, |
1985 |
+ const char *buf, size_t count) |
1986 |
+ { |
1987 |
+- char val; |
1988 |
+- |
1989 |
+- if (count != 1 || !buf) |
1990 |
+- return -EINVAL; |
1991 |
++ int err = kstrtobool(buf, &w1_enable_crccheck); |
1992 |
+ |
1993 |
+- if (get_user(val, buf)) |
1994 |
+- return -EFAULT; |
1995 |
++ if (err) |
1996 |
++ return err; |
1997 |
+ |
1998 |
+- /* convert to decimal */ |
1999 |
+- val = val - 0x30; |
2000 |
+- if (val != 0 && val != 1) |
2001 |
+- return -EINVAL; |
2002 |
+- |
2003 |
+- /* set the new value */ |
2004 |
+- w1_enable_crccheck = val; |
2005 |
+- |
2006 |
+- return sizeof(w1_enable_crccheck); |
2007 |
++ return count; |
2008 |
+ } |
2009 |
+ |
2010 |
+ static DEVICE_ATTR_RW(crccheck); |
2011 |
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c |
2012 |
+index 228bfa19b745d..00c9a9e719ece 100644 |
2013 |
+--- a/fs/btrfs/backref.c |
2014 |
++++ b/fs/btrfs/backref.c |
2015 |
+@@ -975,7 +975,12 @@ again: |
2016 |
+ ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); |
2017 |
+ if (ret < 0) |
2018 |
+ goto out; |
2019 |
+- BUG_ON(ret == 0); |
2020 |
++ if (ret == 0) { |
2021 |
++ /* This shouldn't happen, indicates a bug or fs corruption. */ |
2022 |
++ ASSERT(ret != 0); |
2023 |
++ ret = -EUCLEAN; |
2024 |
++ goto out; |
2025 |
++ } |
2026 |
+ |
2027 |
+ #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS |
2028 |
+ if (trans && likely(trans->type != __TRANS_DUMMY) && |
2029 |
+@@ -1104,10 +1109,18 @@ again: |
2030 |
+ goto out; |
2031 |
+ if (!ret && extent_item_pos) { |
2032 |
+ /* |
2033 |
+- * we've recorded that parent, so we must extend |
2034 |
+- * its inode list here |
2035 |
++ * We've recorded that parent, so we must extend |
2036 |
++ * its inode list here. |
2037 |
++ * |
2038 |
++ * However if there was corruption we may not |
2039 |
++ * have found an eie, return an error in this |
2040 |
++ * case. |
2041 |
+ */ |
2042 |
+- BUG_ON(!eie); |
2043 |
++ ASSERT(eie); |
2044 |
++ if (!eie) { |
2045 |
++ ret = -EUCLEAN; |
2046 |
++ goto out; |
2047 |
++ } |
2048 |
+ while (eie->next) |
2049 |
+ eie = eie->next; |
2050 |
+ eie->next = ref->inode_list; |
2051 |
+diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c |
2052 |
+index 3a7f401e943c1..ffab7dc881574 100644 |
2053 |
+--- a/fs/dlm/lock.c |
2054 |
++++ b/fs/dlm/lock.c |
2055 |
+@@ -3975,6 +3975,14 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
2056 |
+ int from = ms->m_header.h_nodeid; |
2057 |
+ int error = 0; |
2058 |
+ |
2059 |
++ /* currently mixing of user/kernel locks are not supported */ |
2060 |
++ if (ms->m_flags & DLM_IFL_USER && ~lkb->lkb_flags & DLM_IFL_USER) { |
2061 |
++ log_error(lkb->lkb_resource->res_ls, |
2062 |
++ "got user dlm message for a kernel lock"); |
2063 |
++ error = -EINVAL; |
2064 |
++ goto out; |
2065 |
++ } |
2066 |
++ |
2067 |
+ switch (ms->m_type) { |
2068 |
+ case DLM_MSG_CONVERT: |
2069 |
+ case DLM_MSG_UNLOCK: |
2070 |
+@@ -4003,6 +4011,7 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) |
2071 |
+ error = -EINVAL; |
2072 |
+ } |
2073 |
+ |
2074 |
++out: |
2075 |
+ if (error) |
2076 |
+ log_error(lkb->lkb_resource->res_ls, |
2077 |
+ "ignore invalid message %d from %d %x %x %x %d", |
2078 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
2079 |
+index 84f8d07302efa..a224d6efb5a6d 100644 |
2080 |
+--- a/fs/ext4/ioctl.c |
2081 |
++++ b/fs/ext4/ioctl.c |
2082 |
+@@ -610,8 +610,6 @@ resizefs_out: |
2083 |
+ sizeof(range))) |
2084 |
+ return -EFAULT; |
2085 |
+ |
2086 |
+- range.minlen = max((unsigned int)range.minlen, |
2087 |
+- q->limits.discard_granularity); |
2088 |
+ ret = ext4_trim_fs(sb, &range); |
2089 |
+ if (ret < 0) |
2090 |
+ return ret; |
2091 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
2092 |
+index ac87f7e5d6a4f..c7be47ed71144 100644 |
2093 |
+--- a/fs/ext4/mballoc.c |
2094 |
++++ b/fs/ext4/mballoc.c |
2095 |
+@@ -5223,6 +5223,7 @@ out: |
2096 |
+ */ |
2097 |
+ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
2098 |
+ { |
2099 |
++ struct request_queue *q = bdev_get_queue(sb->s_bdev); |
2100 |
+ struct ext4_group_info *grp; |
2101 |
+ ext4_group_t group, first_group, last_group; |
2102 |
+ ext4_grpblk_t cnt = 0, first_cluster, last_cluster; |
2103 |
+@@ -5241,6 +5242,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) |
2104 |
+ start >= max_blks || |
2105 |
+ range->len < sb->s_blocksize) |
2106 |
+ return -EINVAL; |
2107 |
++ /* No point to try to trim less than discard granularity */ |
2108 |
++ if (range->minlen < q->limits.discard_granularity) { |
2109 |
++ minlen = EXT4_NUM_B2C(EXT4_SB(sb), |
2110 |
++ q->limits.discard_granularity >> sb->s_blocksize_bits); |
2111 |
++ if (minlen > EXT4_CLUSTERS_PER_GROUP(sb)) |
2112 |
++ goto out; |
2113 |
++ } |
2114 |
+ if (end >= max_blks) |
2115 |
+ end = max_blks - 1; |
2116 |
+ if (end <= first_data_blk) |
2117 |
+diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c |
2118 |
+index a4651894cc332..1073e24ab6220 100644 |
2119 |
+--- a/fs/ext4/migrate.c |
2120 |
++++ b/fs/ext4/migrate.c |
2121 |
+@@ -459,12 +459,12 @@ int ext4_ext_migrate(struct inode *inode) |
2122 |
+ return retval; |
2123 |
+ |
2124 |
+ /* |
2125 |
+- * Worst case we can touch the allocation bitmaps, a bgd |
2126 |
+- * block, and a block to link in the orphan list. We do need |
2127 |
+- * need to worry about credits for modifying the quota inode. |
2128 |
++ * Worst case we can touch the allocation bitmaps and a block |
2129 |
++ * group descriptor block. We do need need to worry about |
2130 |
++ * credits for modifying the quota inode. |
2131 |
+ */ |
2132 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, |
2133 |
+- 4 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
2134 |
++ 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb)); |
2135 |
+ |
2136 |
+ if (IS_ERR(handle)) { |
2137 |
+ retval = PTR_ERR(handle); |
2138 |
+@@ -481,6 +481,13 @@ int ext4_ext_migrate(struct inode *inode) |
2139 |
+ ext4_journal_stop(handle); |
2140 |
+ return retval; |
2141 |
+ } |
2142 |
++ /* |
2143 |
++ * Use the correct seed for checksum (i.e. the seed from 'inode'). This |
2144 |
++ * is so that the metadata blocks will have the correct checksum after |
2145 |
++ * the migration. |
2146 |
++ */ |
2147 |
++ ei = EXT4_I(inode); |
2148 |
++ EXT4_I(tmp_inode)->i_csum_seed = ei->i_csum_seed; |
2149 |
+ i_size_write(tmp_inode, i_size_read(inode)); |
2150 |
+ /* |
2151 |
+ * Set the i_nlink to zero so it will be deleted later |
2152 |
+@@ -489,7 +496,6 @@ int ext4_ext_migrate(struct inode *inode) |
2153 |
+ clear_nlink(tmp_inode); |
2154 |
+ |
2155 |
+ ext4_ext_tree_init(handle, tmp_inode); |
2156 |
+- ext4_orphan_add(handle, tmp_inode); |
2157 |
+ ext4_journal_stop(handle); |
2158 |
+ |
2159 |
+ /* |
2160 |
+@@ -514,17 +520,10 @@ int ext4_ext_migrate(struct inode *inode) |
2161 |
+ |
2162 |
+ handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); |
2163 |
+ if (IS_ERR(handle)) { |
2164 |
+- /* |
2165 |
+- * It is impossible to update on-disk structures without |
2166 |
+- * a handle, so just rollback in-core changes and live other |
2167 |
+- * work to orphan_list_cleanup() |
2168 |
+- */ |
2169 |
+- ext4_orphan_del(NULL, tmp_inode); |
2170 |
+ retval = PTR_ERR(handle); |
2171 |
+ goto out; |
2172 |
+ } |
2173 |
+ |
2174 |
+- ei = EXT4_I(inode); |
2175 |
+ i_data = ei->i_data; |
2176 |
+ memset(&lb, 0, sizeof(lb)); |
2177 |
+ |
2178 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
2179 |
+index 1de02b90a1ef8..ae074ad4daaeb 100644 |
2180 |
+--- a/fs/ext4/super.c |
2181 |
++++ b/fs/ext4/super.c |
2182 |
+@@ -5367,7 +5367,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, |
2183 |
+ struct buffer_head *bh; |
2184 |
+ handle_t *handle = journal_current_handle(); |
2185 |
+ |
2186 |
+- if (EXT4_SB(sb)->s_journal && !handle) { |
2187 |
++ if (!handle) { |
2188 |
+ ext4_msg(sb, KERN_WARNING, "Quota write (off=%llu, len=%llu)" |
2189 |
+ " cancelled because transaction is not started", |
2190 |
+ (unsigned long long)off, (unsigned long long)len); |
2191 |
+diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c |
2192 |
+index 7968b7a5e7878..2b35d1dd665df 100644 |
2193 |
+--- a/fs/ubifs/super.c |
2194 |
++++ b/fs/ubifs/super.c |
2195 |
+@@ -1695,7 +1695,6 @@ out: |
2196 |
+ kthread_stop(c->bgt); |
2197 |
+ c->bgt = NULL; |
2198 |
+ } |
2199 |
+- free_wbufs(c); |
2200 |
+ kfree(c->write_reserve_buf); |
2201 |
+ c->write_reserve_buf = NULL; |
2202 |
+ vfree(c->ileb_buf); |
2203 |
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h |
2204 |
+index d236ce450da3e..2eee8ea05a7f1 100644 |
2205 |
+--- a/include/net/sch_generic.h |
2206 |
++++ b/include/net/sch_generic.h |
2207 |
+@@ -797,6 +797,7 @@ struct psched_ratecfg { |
2208 |
+ u64 rate_bytes_ps; /* bytes per second */ |
2209 |
+ u32 mult; |
2210 |
+ u16 overhead; |
2211 |
++ u16 mpu; |
2212 |
+ u8 linklayer; |
2213 |
+ u8 shift; |
2214 |
+ }; |
2215 |
+@@ -806,6 +807,9 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, |
2216 |
+ { |
2217 |
+ len += r->overhead; |
2218 |
+ |
2219 |
++ if (len < r->mpu) |
2220 |
++ len = r->mpu; |
2221 |
++ |
2222 |
+ if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) |
2223 |
+ return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; |
2224 |
+ |
2225 |
+@@ -828,6 +832,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, |
2226 |
+ res->rate = min_t(u64, r->rate_bytes_ps, ~0U); |
2227 |
+ |
2228 |
+ res->overhead = r->overhead; |
2229 |
++ res->mpu = r->mpu; |
2230 |
+ res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); |
2231 |
+ } |
2232 |
+ |
2233 |
+diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c |
2234 |
+index b1757895c4ad2..23bad44bb0850 100644 |
2235 |
+--- a/net/bluetooth/cmtp/core.c |
2236 |
++++ b/net/bluetooth/cmtp/core.c |
2237 |
+@@ -500,9 +500,7 @@ static int __init cmtp_init(void) |
2238 |
+ { |
2239 |
+ BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); |
2240 |
+ |
2241 |
+- cmtp_init_sockets(); |
2242 |
+- |
2243 |
+- return 0; |
2244 |
++ return cmtp_init_sockets(); |
2245 |
+ } |
2246 |
+ |
2247 |
+ static void __exit cmtp_exit(void) |
2248 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
2249 |
+index eefaa10c74dbb..1cc78b88a0d9f 100644 |
2250 |
+--- a/net/bluetooth/hci_core.c |
2251 |
++++ b/net/bluetooth/hci_core.c |
2252 |
+@@ -3459,6 +3459,7 @@ int hci_register_dev(struct hci_dev *hdev) |
2253 |
+ return id; |
2254 |
+ |
2255 |
+ err_wqueue: |
2256 |
++ debugfs_remove_recursive(hdev->debugfs); |
2257 |
+ destroy_workqueue(hdev->workqueue); |
2258 |
+ destroy_workqueue(hdev->req_workqueue); |
2259 |
+ err: |
2260 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
2261 |
+index 6528ecc3a3bc5..05ccd2bcd9e46 100644 |
2262 |
+--- a/net/bluetooth/hci_event.c |
2263 |
++++ b/net/bluetooth/hci_event.c |
2264 |
+@@ -4940,7 +4940,8 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
2265 |
+ struct hci_ev_le_advertising_info *ev = ptr; |
2266 |
+ s8 rssi; |
2267 |
+ |
2268 |
+- if (ev->length <= HCI_MAX_AD_LENGTH) { |
2269 |
++ if (ev->length <= HCI_MAX_AD_LENGTH && |
2270 |
++ ev->data + ev->length <= skb_tail_pointer(skb)) { |
2271 |
+ rssi = ev->data[ev->length]; |
2272 |
+ process_adv_report(hdev, ev->evt_type, &ev->bdaddr, |
2273 |
+ ev->bdaddr_type, NULL, 0, rssi, |
2274 |
+@@ -4950,6 +4951,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb) |
2275 |
+ } |
2276 |
+ |
2277 |
+ ptr += sizeof(*ev) + ev->length + 1; |
2278 |
++ |
2279 |
++ if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) { |
2280 |
++ bt_dev_err(hdev, "Malicious advertising data. Stopping processing"); |
2281 |
++ break; |
2282 |
++ } |
2283 |
+ } |
2284 |
+ |
2285 |
+ hci_dev_unlock(hdev); |
2286 |
+diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
2287 |
+index 24eea13035557..f580dbaac5a94 100644 |
2288 |
+--- a/net/bridge/br_netfilter_hooks.c |
2289 |
++++ b/net/bridge/br_netfilter_hooks.c |
2290 |
+@@ -719,6 +719,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
2291 |
+ if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) |
2292 |
+ mtu = nf_bridge->frag_max_size; |
2293 |
+ |
2294 |
++ nf_bridge_update_protocol(skb); |
2295 |
++ nf_bridge_push_encap_header(skb); |
2296 |
++ |
2297 |
+ if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { |
2298 |
+ nf_bridge_info_free(skb); |
2299 |
+ return br_dev_queue_push_xmit(net, sk, skb); |
2300 |
+@@ -736,8 +739,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
2301 |
+ |
2302 |
+ IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; |
2303 |
+ |
2304 |
+- nf_bridge_update_protocol(skb); |
2305 |
+- |
2306 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
2307 |
+ |
2308 |
+ data->vlan_tci = skb->vlan_tci; |
2309 |
+@@ -760,8 +761,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
2310 |
+ |
2311 |
+ IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; |
2312 |
+ |
2313 |
+- nf_bridge_update_protocol(skb); |
2314 |
+- |
2315 |
+ data = this_cpu_ptr(&brnf_frag_data_storage); |
2316 |
+ data->encap_size = nf_bridge_encap_header_len(skb); |
2317 |
+ data->size = ETH_HLEN + data->encap_size; |
2318 |
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c |
2319 |
+index 01bfe28b20a19..441973d890683 100644 |
2320 |
+--- a/net/core/net_namespace.c |
2321 |
++++ b/net/core/net_namespace.c |
2322 |
+@@ -130,8 +130,10 @@ static void ops_exit_list(const struct pernet_operations *ops, |
2323 |
+ { |
2324 |
+ struct net *net; |
2325 |
+ if (ops->exit) { |
2326 |
+- list_for_each_entry(net, net_exit_list, exit_list) |
2327 |
++ list_for_each_entry(net, net_exit_list, exit_list) { |
2328 |
+ ops->exit(net); |
2329 |
++ cond_resched(); |
2330 |
++ } |
2331 |
+ } |
2332 |
+ if (ops->exit_batch) |
2333 |
+ ops->exit_batch(net_exit_list); |
2334 |
+diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c |
2335 |
+index ece7a5d59a612..1d61a08eafaf7 100644 |
2336 |
+--- a/net/nfc/llcp_sock.c |
2337 |
++++ b/net/nfc/llcp_sock.c |
2338 |
+@@ -790,6 +790,11 @@ static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
2339 |
+ |
2340 |
+ lock_sock(sk); |
2341 |
+ |
2342 |
++ if (!llcp_sock->local) { |
2343 |
++ release_sock(sk); |
2344 |
++ return -ENODEV; |
2345 |
++ } |
2346 |
++ |
2347 |
+ if (sk->sk_type == SOCK_DGRAM) { |
2348 |
+ DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, |
2349 |
+ msg->msg_name); |
2350 |
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c |
2351 |
+index 10c05fa0e6b35..dabd63f708024 100644 |
2352 |
+--- a/net/sched/sch_generic.c |
2353 |
++++ b/net/sched/sch_generic.c |
2354 |
+@@ -966,6 +966,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, |
2355 |
+ { |
2356 |
+ memset(r, 0, sizeof(*r)); |
2357 |
+ r->overhead = conf->overhead; |
2358 |
++ r->mpu = conf->mpu; |
2359 |
+ r->rate_bytes_ps = max_t(u64, conf->rate, rate64); |
2360 |
+ r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); |
2361 |
+ r->mult = 1; |
2362 |
+diff --git a/net/unix/garbage.c b/net/unix/garbage.c |
2363 |
+index 8bbe1b8e4ff7f..4d283e26d8162 100644 |
2364 |
+--- a/net/unix/garbage.c |
2365 |
++++ b/net/unix/garbage.c |
2366 |
+@@ -197,8 +197,11 @@ void wait_for_unix_gc(void) |
2367 |
+ { |
2368 |
+ /* If number of inflight sockets is insane, |
2369 |
+ * force a garbage collect right now. |
2370 |
++ * Paired with the WRITE_ONCE() in unix_inflight(), |
2371 |
++ * unix_notinflight() and gc_in_progress(). |
2372 |
+ */ |
2373 |
+- if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) |
2374 |
++ if (READ_ONCE(unix_tot_inflight) > UNIX_INFLIGHT_TRIGGER_GC && |
2375 |
++ !READ_ONCE(gc_in_progress)) |
2376 |
+ unix_gc(); |
2377 |
+ wait_event(unix_gc_wait, gc_in_progress == false); |
2378 |
+ } |
2379 |
+@@ -218,7 +221,9 @@ void unix_gc(void) |
2380 |
+ if (gc_in_progress) |
2381 |
+ goto out; |
2382 |
+ |
2383 |
+- gc_in_progress = true; |
2384 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
2385 |
++ WRITE_ONCE(gc_in_progress, true); |
2386 |
++ |
2387 |
+ /* First, select candidates for garbage collection. Only |
2388 |
+ * in-flight sockets are considered, and from those only ones |
2389 |
+ * which don't have any external reference. |
2390 |
+@@ -304,7 +309,10 @@ void unix_gc(void) |
2391 |
+ |
2392 |
+ /* All candidates should have been detached by now. */ |
2393 |
+ BUG_ON(!list_empty(&gc_candidates)); |
2394 |
+- gc_in_progress = false; |
2395 |
++ |
2396 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc(). */ |
2397 |
++ WRITE_ONCE(gc_in_progress, false); |
2398 |
++ |
2399 |
+ wake_up(&unix_gc_wait); |
2400 |
+ |
2401 |
+ out: |
2402 |
+diff --git a/net/unix/scm.c b/net/unix/scm.c |
2403 |
+index df8f636ab1d8c..bf1a8fa8c4f1d 100644 |
2404 |
+--- a/net/unix/scm.c |
2405 |
++++ b/net/unix/scm.c |
2406 |
+@@ -56,7 +56,8 @@ void unix_inflight(struct user_struct *user, struct file *fp) |
2407 |
+ } else { |
2408 |
+ BUG_ON(list_empty(&u->link)); |
2409 |
+ } |
2410 |
+- unix_tot_inflight++; |
2411 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
2412 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1); |
2413 |
+ } |
2414 |
+ user->unix_inflight++; |
2415 |
+ spin_unlock(&unix_gc_lock); |
2416 |
+@@ -76,7 +77,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp) |
2417 |
+ |
2418 |
+ if (atomic_long_dec_and_test(&u->inflight)) |
2419 |
+ list_del_init(&u->link); |
2420 |
+- unix_tot_inflight--; |
2421 |
++ /* Paired with READ_ONCE() in wait_for_unix_gc() */ |
2422 |
++ WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1); |
2423 |
+ } |
2424 |
+ user->unix_inflight--; |
2425 |
+ spin_unlock(&unix_gc_lock); |
2426 |
+diff --git a/sound/core/jack.c b/sound/core/jack.c |
2427 |
+index fcc972fbe8ffd..ecbdac88f95ad 100644 |
2428 |
+--- a/sound/core/jack.c |
2429 |
++++ b/sound/core/jack.c |
2430 |
+@@ -64,10 +64,13 @@ static int snd_jack_dev_free(struct snd_device *device) |
2431 |
+ struct snd_card *card = device->card; |
2432 |
+ struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; |
2433 |
+ |
2434 |
++ down_write(&card->controls_rwsem); |
2435 |
+ list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { |
2436 |
+ list_del_init(&jack_kctl->list); |
2437 |
+ snd_ctl_remove(card, jack_kctl->kctl); |
2438 |
+ } |
2439 |
++ up_write(&card->controls_rwsem); |
2440 |
++ |
2441 |
+ if (jack->private_free) |
2442 |
+ jack->private_free(jack); |
2443 |
+ |
2444 |
+diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
2445 |
+index 593791d9a334f..6af4afe23e373 100644 |
2446 |
+--- a/sound/core/oss/pcm_oss.c |
2447 |
++++ b/sound/core/oss/pcm_oss.c |
2448 |
+@@ -2121,7 +2121,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr |
2449 |
+ int err, cmd; |
2450 |
+ |
2451 |
+ #ifdef OSS_DEBUG |
2452 |
+- pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger); |
2453 |
++ pr_debug("pcm_oss: trigger = 0x%x\n", trigger); |
2454 |
+ #endif |
2455 |
+ |
2456 |
+ psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
2457 |
+diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
2458 |
+index cdff5f9764808..6ae28dcd79945 100644 |
2459 |
+--- a/sound/core/pcm.c |
2460 |
++++ b/sound/core/pcm.c |
2461 |
+@@ -857,7 +857,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); |
2462 |
+ static void free_chmap(struct snd_pcm_str *pstr) |
2463 |
+ { |
2464 |
+ if (pstr->chmap_kctl) { |
2465 |
+- snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); |
2466 |
++ struct snd_card *card = pstr->pcm->card; |
2467 |
++ |
2468 |
++ down_write(&card->controls_rwsem); |
2469 |
++ snd_ctl_remove(card, pstr->chmap_kctl); |
2470 |
++ up_write(&card->controls_rwsem); |
2471 |
+ pstr->chmap_kctl = NULL; |
2472 |
+ } |
2473 |
+ } |
2474 |
+diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c |
2475 |
+index ea1aa07962761..b923059a22276 100644 |
2476 |
+--- a/sound/core/seq/seq_queue.c |
2477 |
++++ b/sound/core/seq/seq_queue.c |
2478 |
+@@ -257,12 +257,15 @@ struct snd_seq_queue *snd_seq_queue_find_name(char *name) |
2479 |
+ |
2480 |
+ /* -------------------------------------------------------- */ |
2481 |
+ |
2482 |
++#define MAX_CELL_PROCESSES_IN_QUEUE 1000 |
2483 |
++ |
2484 |
+ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
2485 |
+ { |
2486 |
+ unsigned long flags; |
2487 |
+ struct snd_seq_event_cell *cell; |
2488 |
+ snd_seq_tick_time_t cur_tick; |
2489 |
+ snd_seq_real_time_t cur_time; |
2490 |
++ int processed = 0; |
2491 |
+ |
2492 |
+ if (q == NULL) |
2493 |
+ return; |
2494 |
+@@ -285,6 +288,8 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
2495 |
+ if (!cell) |
2496 |
+ break; |
2497 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
2498 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
2499 |
++ goto out; /* the rest processed at the next batch */ |
2500 |
+ } |
2501 |
+ |
2502 |
+ /* Process time queue... */ |
2503 |
+@@ -294,14 +299,19 @@ void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop) |
2504 |
+ if (!cell) |
2505 |
+ break; |
2506 |
+ snd_seq_dispatch_event(cell, atomic, hop); |
2507 |
++ if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE) |
2508 |
++ goto out; /* the rest processed at the next batch */ |
2509 |
+ } |
2510 |
+ |
2511 |
++ out: |
2512 |
+ /* free lock */ |
2513 |
+ spin_lock_irqsave(&q->check_lock, flags); |
2514 |
+ if (q->check_again) { |
2515 |
+ q->check_again = 0; |
2516 |
+- spin_unlock_irqrestore(&q->check_lock, flags); |
2517 |
+- goto __again; |
2518 |
++ if (processed < MAX_CELL_PROCESSES_IN_QUEUE) { |
2519 |
++ spin_unlock_irqrestore(&q->check_lock, flags); |
2520 |
++ goto __again; |
2521 |
++ } |
2522 |
+ } |
2523 |
+ q->check_blocked = 0; |
2524 |
+ spin_unlock_irqrestore(&q->check_lock, flags); |
2525 |
+diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
2526 |
+index 4962a9d8a572b..7533f8860c57e 100644 |
2527 |
+--- a/sound/pci/hda/hda_codec.c |
2528 |
++++ b/sound/pci/hda/hda_codec.c |
2529 |
+@@ -1608,8 +1608,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) |
2530 |
+ { |
2531 |
+ int i; |
2532 |
+ struct hda_nid_item *items = codec->mixers.list; |
2533 |
++ |
2534 |
++ down_write(&codec->card->controls_rwsem); |
2535 |
+ for (i = 0; i < codec->mixers.used; i++) |
2536 |
+ snd_ctl_remove(codec->card, items[i].kctl); |
2537 |
++ up_write(&codec->card->controls_rwsem); |
2538 |
+ snd_array_free(&codec->mixers); |
2539 |
+ snd_array_free(&codec->nids); |
2540 |
+ } |
2541 |
+diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c |
2542 |
+index 4ed29ffc1c54e..d9cd9350ffbe2 100644 |
2543 |
+--- a/sound/soc/samsung/idma.c |
2544 |
++++ b/sound/soc/samsung/idma.c |
2545 |
+@@ -370,6 +370,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream) |
2546 |
+ buf->addr = idma.lp_tx_addr; |
2547 |
+ buf->bytes = idma_hardware.buffer_bytes_max; |
2548 |
+ buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes); |
2549 |
++ if (!buf->area) |
2550 |
++ return -ENOMEM; |
2551 |
+ |
2552 |
+ return 0; |
2553 |
+ } |