Contents of /trunk/kernel-alx/patches-4.9/0307-4.9.208-all-fixes.patch
Parent Directory | Revision Log
Revision 3582 -
(show annotations)
(download)
Thu Aug 13 10:21:22 2020 UTC (4 years, 1 month ago) by niro
File size: 169673 byte(s)
Thu Aug 13 10:21:22 2020 UTC (4 years, 1 month ago) by niro
File size: 169673 byte(s)
linux-208
1 | diff --git a/Makefile b/Makefile |
2 | index aa8e52a3b73d..1d1d9f68e962 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 207 |
9 | +SUBLEVEL = 208 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h |
14 | index 005bf4ff1b4c..f3ddd4f599e3 100644 |
15 | --- a/arch/arm/boot/compressed/libfdt_env.h |
16 | +++ b/arch/arm/boot/compressed/libfdt_env.h |
17 | @@ -1,11 +1,13 @@ |
18 | #ifndef _ARM_LIBFDT_ENV_H |
19 | #define _ARM_LIBFDT_ENV_H |
20 | |
21 | +#include <linux/limits.h> |
22 | #include <linux/types.h> |
23 | #include <linux/string.h> |
24 | #include <asm/byteorder.h> |
25 | |
26 | -#define INT_MAX ((int)(~0U>>1)) |
27 | +#define INT32_MAX S32_MAX |
28 | +#define UINT32_MAX U32_MAX |
29 | |
30 | typedef __be16 fdt16_t; |
31 | typedef __be32 fdt32_t; |
32 | diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c |
33 | index 42816bebb1e0..e3713d6fb8e0 100644 |
34 | --- a/arch/arm64/kernel/psci.c |
35 | +++ b/arch/arm64/kernel/psci.c |
36 | @@ -83,7 +83,8 @@ static void cpu_psci_cpu_die(unsigned int cpu) |
37 | |
38 | static int cpu_psci_cpu_kill(unsigned int cpu) |
39 | { |
40 | - int err, i; |
41 | + int err; |
42 | + unsigned long start, end; |
43 | |
44 | if (!psci_ops.affinity_info) |
45 | return 0; |
46 | @@ -93,16 +94,18 @@ static int cpu_psci_cpu_kill(unsigned int cpu) |
47 | * while it is dying. So, try again a few times. |
48 | */ |
49 | |
50 | - for (i = 0; i < 10; i++) { |
51 | + start = jiffies; |
52 | + end = start + msecs_to_jiffies(100); |
53 | + do { |
54 | err = psci_ops.affinity_info(cpu_logical_map(cpu), 0); |
55 | if (err == PSCI_0_2_AFFINITY_LEVEL_OFF) { |
56 | - pr_info("CPU%d killed.\n", cpu); |
57 | + pr_info("CPU%d killed (polled %d ms)\n", cpu, |
58 | + jiffies_to_msecs(jiffies - start)); |
59 | return 0; |
60 | } |
61 | |
62 | - msleep(10); |
63 | - pr_info("Retrying again to check for CPU kill\n"); |
64 | - } |
65 | + usleep_range(100, 1000); |
66 | + } while (time_before(jiffies, end)); |
67 | |
68 | pr_warn("CPU%d may not have shut down cleanly (AFFINITY_INFO reports %d)\n", |
69 | cpu, err); |
70 | diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h |
71 | index 0b3db6322c79..5f2cb1c53e15 100644 |
72 | --- a/arch/powerpc/boot/libfdt_env.h |
73 | +++ b/arch/powerpc/boot/libfdt_env.h |
74 | @@ -5,6 +5,8 @@ |
75 | #include <string.h> |
76 | |
77 | #define INT_MAX ((int)(~0U>>1)) |
78 | +#define UINT32_MAX ((u32)~0U) |
79 | +#define INT32_MAX ((s32)(UINT32_MAX >> 1)) |
80 | |
81 | #include "of.h" |
82 | |
83 | diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c |
84 | index ad713f741ca8..eff4a336a1b4 100644 |
85 | --- a/arch/powerpc/kernel/irq.c |
86 | +++ b/arch/powerpc/kernel/irq.c |
87 | @@ -527,8 +527,6 @@ void __do_irq(struct pt_regs *regs) |
88 | |
89 | trace_irq_entry(regs); |
90 | |
91 | - check_stack_overflow(); |
92 | - |
93 | /* |
94 | * Query the platform PIC for the interrupt & ack it. |
95 | * |
96 | @@ -560,6 +558,8 @@ void do_IRQ(struct pt_regs *regs) |
97 | irqtp = hardirq_ctx[raw_smp_processor_id()]; |
98 | sirqtp = softirq_ctx[raw_smp_processor_id()]; |
99 | |
100 | + check_stack_overflow(); |
101 | + |
102 | /* Already there ? */ |
103 | if (unlikely(curtp == irqtp || curtp == sirqtp)) { |
104 | __do_irq(regs); |
105 | diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c |
106 | index 11fff9669cfd..ff85fc800183 100644 |
107 | --- a/arch/powerpc/kernel/security.c |
108 | +++ b/arch/powerpc/kernel/security.c |
109 | @@ -135,32 +135,33 @@ ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, cha |
110 | |
111 | thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV); |
112 | |
113 | - if (rfi_flush || thread_priv) { |
114 | + if (rfi_flush) { |
115 | struct seq_buf s; |
116 | seq_buf_init(&s, buf, PAGE_SIZE - 1); |
117 | |
118 | - seq_buf_printf(&s, "Mitigation: "); |
119 | - |
120 | - if (rfi_flush) |
121 | - seq_buf_printf(&s, "RFI Flush"); |
122 | - |
123 | - if (rfi_flush && thread_priv) |
124 | - seq_buf_printf(&s, ", "); |
125 | - |
126 | + seq_buf_printf(&s, "Mitigation: RFI Flush"); |
127 | if (thread_priv) |
128 | - seq_buf_printf(&s, "L1D private per thread"); |
129 | + seq_buf_printf(&s, ", L1D private per thread"); |
130 | |
131 | seq_buf_printf(&s, "\n"); |
132 | |
133 | return s.len; |
134 | } |
135 | |
136 | + if (thread_priv) |
137 | + return sprintf(buf, "Vulnerable: L1D private per thread\n"); |
138 | + |
139 | if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) && |
140 | !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR)) |
141 | return sprintf(buf, "Not affected\n"); |
142 | |
143 | return sprintf(buf, "Vulnerable\n"); |
144 | } |
145 | + |
146 | +ssize_t cpu_show_l1tf(struct device *dev, struct device_attribute *attr, char *buf) |
147 | +{ |
148 | + return cpu_show_meltdown(dev, attr, buf); |
149 | +} |
150 | #endif |
151 | |
152 | ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf) |
153 | diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c |
154 | index 3c6258a1656b..71315b4989e0 100644 |
155 | --- a/arch/powerpc/kernel/time.c |
156 | +++ b/arch/powerpc/kernel/time.c |
157 | @@ -257,7 +257,7 @@ static u64 scan_dispatch_log(u64 stop_tb) |
158 | * Accumulate stolen time by scanning the dispatch trace log. |
159 | * Called on entry from user mode. |
160 | */ |
161 | -void accumulate_stolen_time(void) |
162 | +void notrace accumulate_stolen_time(void) |
163 | { |
164 | u64 sst, ust; |
165 | u8 save_soft_enabled = local_paca->soft_enabled; |
166 | diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c |
167 | index bd666287c5ed..2dc1fc445f35 100644 |
168 | --- a/arch/powerpc/mm/hash_utils_64.c |
169 | +++ b/arch/powerpc/mm/hash_utils_64.c |
170 | @@ -289,10 +289,18 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, |
171 | ret = mmu_hash_ops.hpte_insert(hpteg, vpn, paddr, tprot, |
172 | HPTE_V_BOLTED, psize, psize, |
173 | ssize); |
174 | - |
175 | + if (ret == -1) { |
176 | + /* Try to remove a non bolted entry */ |
177 | + ret = mmu_hash_ops.hpte_remove(hpteg); |
178 | + if (ret != -1) |
179 | + ret = mmu_hash_ops.hpte_insert(hpteg, vpn, paddr, tprot, |
180 | + HPTE_V_BOLTED, psize, psize, |
181 | + ssize); |
182 | + } |
183 | if (ret < 0) |
184 | break; |
185 | |
186 | + cond_resched(); |
187 | #ifdef CONFIG_DEBUG_PAGEALLOC |
188 | if (debug_pagealloc_enabled() && |
189 | (paddr >> PAGE_SHIFT) < linear_map_hash_count) |
190 | diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c |
191 | index 66e7227469b8..b5ff5ee3e39c 100644 |
192 | --- a/arch/powerpc/platforms/pseries/cmm.c |
193 | +++ b/arch/powerpc/platforms/pseries/cmm.c |
194 | @@ -391,6 +391,10 @@ static struct bus_type cmm_subsys = { |
195 | .dev_name = "cmm", |
196 | }; |
197 | |
198 | +static void cmm_release_device(struct device *dev) |
199 | +{ |
200 | +} |
201 | + |
202 | /** |
203 | * cmm_sysfs_register - Register with sysfs |
204 | * |
205 | @@ -406,6 +410,7 @@ static int cmm_sysfs_register(struct device *dev) |
206 | |
207 | dev->id = 0; |
208 | dev->bus = &cmm_subsys; |
209 | + dev->release = cmm_release_device; |
210 | |
211 | if ((rc = device_register(dev))) |
212 | goto subsys_unregister; |
213 | diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c |
214 | index aaf9dab3c193..f9dca1aed9a4 100644 |
215 | --- a/arch/s390/kernel/dis.c |
216 | +++ b/arch/s390/kernel/dis.c |
217 | @@ -1930,10 +1930,11 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr) |
218 | ptr += sprintf(ptr, "%%c%i", value); |
219 | else if (operand->flags & OPERAND_VR) |
220 | ptr += sprintf(ptr, "%%v%i", value); |
221 | - else if (operand->flags & OPERAND_PCREL) |
222 | - ptr += sprintf(ptr, "%lx", (signed int) value |
223 | - + addr); |
224 | - else if (operand->flags & OPERAND_SIGNED) |
225 | + else if (operand->flags & OPERAND_PCREL) { |
226 | + void *pcrel = (void *)((int)value + addr); |
227 | + |
228 | + ptr += sprintf(ptr, "%px", pcrel); |
229 | + } else if (operand->flags & OPERAND_SIGNED) |
230 | ptr += sprintf(ptr, "%i", value); |
231 | else |
232 | ptr += sprintf(ptr, "%u", value); |
233 | @@ -2005,7 +2006,7 @@ void show_code(struct pt_regs *regs) |
234 | else |
235 | *ptr++ = ' '; |
236 | addr = regs->psw.addr + start - 32; |
237 | - ptr += sprintf(ptr, "%016lx: ", addr); |
238 | + ptr += sprintf(ptr, "%px: ", (void *)addr); |
239 | if (start + opsize >= end) |
240 | break; |
241 | for (i = 0; i < opsize; i++) |
242 | @@ -2033,7 +2034,7 @@ void print_fn_code(unsigned char *code, unsigned long len) |
243 | opsize = insn_length(*code); |
244 | if (opsize > len) |
245 | break; |
246 | - ptr += sprintf(ptr, "%p: ", code); |
247 | + ptr += sprintf(ptr, "%px: ", code); |
248 | for (i = 0; i < opsize; i++) |
249 | ptr += sprintf(ptr, "%02x", code[i]); |
250 | *ptr++ = '\t'; |
251 | diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c |
252 | index f46e5c0cb6d9..02476d2333df 100644 |
253 | --- a/arch/s390/kernel/perf_cpum_sf.c |
254 | +++ b/arch/s390/kernel/perf_cpum_sf.c |
255 | @@ -185,7 +185,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
256 | unsigned long num_sdb, gfp_t gfp_flags) |
257 | { |
258 | int i, rc; |
259 | - unsigned long *new, *tail; |
260 | + unsigned long *new, *tail, *tail_prev = NULL; |
261 | |
262 | if (!sfb->sdbt || !sfb->tail) |
263 | return -EINVAL; |
264 | @@ -224,6 +224,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
265 | sfb->num_sdbt++; |
266 | /* Link current page to tail of chain */ |
267 | *tail = (unsigned long)(void *) new + 1; |
268 | + tail_prev = tail; |
269 | tail = new; |
270 | } |
271 | |
272 | @@ -233,10 +234,22 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
273 | * issue, a new realloc call (if required) might succeed. |
274 | */ |
275 | rc = alloc_sample_data_block(tail, gfp_flags); |
276 | - if (rc) |
277 | + if (rc) { |
278 | + /* Undo last SDBT. An SDBT with no SDB at its first |
279 | + * entry but with an SDBT entry instead can not be |
280 | + * handled by the interrupt handler code. |
281 | + * Avoid this situation. |
282 | + */ |
283 | + if (tail_prev) { |
284 | + sfb->num_sdbt--; |
285 | + free_page((unsigned long) new); |
286 | + tail = tail_prev; |
287 | + } |
288 | break; |
289 | + } |
290 | sfb->num_sdb++; |
291 | tail++; |
292 | + tail_prev = new = NULL; /* Allocated at least one SBD */ |
293 | } |
294 | |
295 | /* Link sampling buffer to its origin */ |
296 | diff --git a/arch/sh/include/cpu-sh4/cpu/sh7734.h b/arch/sh/include/cpu-sh4/cpu/sh7734.h |
297 | index 2fb9a7b71b41..a2667c9b5819 100644 |
298 | --- a/arch/sh/include/cpu-sh4/cpu/sh7734.h |
299 | +++ b/arch/sh/include/cpu-sh4/cpu/sh7734.h |
300 | @@ -133,7 +133,7 @@ enum { |
301 | GPIO_FN_EX_WAIT1, GPIO_FN_SD1_DAT0_A, GPIO_FN_DREQ2, GPIO_FN_CAN1_TX_C, |
302 | GPIO_FN_ET0_LINK_C, GPIO_FN_ET0_ETXD5_A, |
303 | GPIO_FN_EX_WAIT0, GPIO_FN_TCLK1_B, |
304 | - GPIO_FN_RD_WR, GPIO_FN_TCLK0, |
305 | + GPIO_FN_RD_WR, GPIO_FN_TCLK0, GPIO_FN_CAN_CLK_B, GPIO_FN_ET0_ETXD4, |
306 | GPIO_FN_EX_CS5, GPIO_FN_SD1_CMD_A, GPIO_FN_ATADIR, GPIO_FN_QSSL_B, |
307 | GPIO_FN_ET0_ETXD3_A, |
308 | GPIO_FN_EX_CS4, GPIO_FN_SD1_WP_A, GPIO_FN_ATAWR, GPIO_FN_QMI_QIO1_B, |
309 | diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h |
310 | index f498411f2500..1b15304dd098 100644 |
311 | --- a/arch/x86/include/asm/crash.h |
312 | +++ b/arch/x86/include/asm/crash.h |
313 | @@ -1,6 +1,8 @@ |
314 | #ifndef _ASM_X86_CRASH_H |
315 | #define _ASM_X86_CRASH_H |
316 | |
317 | +struct kimage; |
318 | + |
319 | int crash_load_segments(struct kimage *image); |
320 | int crash_copy_backup_region(struct kimage *image); |
321 | int crash_setup_memmap_entries(struct kimage *image, |
322 | diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h |
323 | index 8554f960e21b..61d6f2c05757 100644 |
324 | --- a/arch/x86/include/asm/fixmap.h |
325 | +++ b/arch/x86/include/asm/fixmap.h |
326 | @@ -142,7 +142,7 @@ extern pte_t *kmap_pte; |
327 | extern pte_t *pkmap_page_table; |
328 | |
329 | void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); |
330 | -void native_set_fixmap(enum fixed_addresses idx, |
331 | +void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, |
332 | phys_addr_t phys, pgprot_t flags); |
333 | |
334 | #ifndef CONFIG_PARAVIRT |
335 | diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
336 | index 09dd95cabfc2..3401b28f1312 100644 |
337 | --- a/arch/x86/kernel/apic/io_apic.c |
338 | +++ b/arch/x86/kernel/apic/io_apic.c |
339 | @@ -1712,9 +1712,10 @@ static bool io_apic_level_ack_pending(struct mp_chip_data *data) |
340 | |
341 | static inline bool ioapic_irqd_mask(struct irq_data *data) |
342 | { |
343 | - /* If we are moving the irq we need to mask it */ |
344 | + /* If we are moving the IRQ we need to mask it */ |
345 | if (unlikely(irqd_is_setaffinity_pending(data))) { |
346 | - mask_ioapic_irq(data); |
347 | + if (!irqd_irq_masked(data)) |
348 | + mask_ioapic_irq(data); |
349 | return true; |
350 | } |
351 | return false; |
352 | @@ -1751,7 +1752,9 @@ static inline void ioapic_irqd_unmask(struct irq_data *data, bool masked) |
353 | */ |
354 | if (!io_apic_level_ack_pending(data->chip_data)) |
355 | irq_move_masked_irq(data); |
356 | - unmask_ioapic_irq(data); |
357 | + /* If the IRQ is masked in the core, leave it: */ |
358 | + if (!irqd_irq_masked(data)) |
359 | + unmask_ioapic_irq(data); |
360 | } |
361 | } |
362 | #else |
363 | diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
364 | index d3b2c5b25c9c..07188a012492 100644 |
365 | --- a/arch/x86/kernel/cpu/mcheck/mce.c |
366 | +++ b/arch/x86/kernel/cpu/mcheck/mce.c |
367 | @@ -782,8 +782,8 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, |
368 | if (quirk_no_way_out) |
369 | quirk_no_way_out(i, m, regs); |
370 | |
371 | + m->bank = i; |
372 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
373 | - m->bank = i; |
374 | mce_read_aux(m, i); |
375 | *msg = tmp; |
376 | return 1; |
377 | diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
378 | index c460c91d0c8f..be2439592b0e 100644 |
379 | --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c |
380 | +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
381 | @@ -190,7 +190,7 @@ static int therm_throt_process(bool new_event, int event, int level) |
382 | /* if we just entered the thermal event */ |
383 | if (new_event) { |
384 | if (event == THERMAL_THROTTLING_EVENT) |
385 | - pr_crit("CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n", |
386 | + pr_warn("CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n", |
387 | this_cpu, |
388 | level == CORE_LEVEL ? "Core" : "Package", |
389 | state->count); |
390 | diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt |
391 | index 1754e094bc28..0f7eb4f5bdb7 100644 |
392 | --- a/arch/x86/lib/x86-opcode-map.txt |
393 | +++ b/arch/x86/lib/x86-opcode-map.txt |
394 | @@ -333,7 +333,7 @@ AVXcode: 1 |
395 | 06: CLTS |
396 | 07: SYSRET (o64) |
397 | 08: INVD |
398 | -09: WBINVD |
399 | +09: WBINVD | WBNOINVD (F3) |
400 | 0a: |
401 | 0b: UD2 (1B) |
402 | 0c: |
403 | @@ -364,7 +364,7 @@ AVXcode: 1 |
404 | # a ModR/M byte. |
405 | 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev |
406 | 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv |
407 | -1c: |
408 | +1c: Grp20 (1A),(1C) |
409 | 1d: |
410 | 1e: |
411 | 1f: NOP Ev |
412 | @@ -792,6 +792,8 @@ f3: Grp17 (1A) |
413 | f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) |
414 | f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) |
415 | f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) |
416 | +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) |
417 | +f9: MOVDIRI My,Gy |
418 | EndTable |
419 | |
420 | Table: 3-byte opcode 2 (0x0f 0x3a) |
421 | @@ -943,9 +945,9 @@ GrpTable: Grp6 |
422 | EndTable |
423 | |
424 | GrpTable: Grp7 |
425 | -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) |
426 | -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) |
427 | -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) |
428 | +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) |
429 | +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) |
430 | +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) |
431 | 3: LIDT Ms |
432 | 4: SMSW Mw/Rv |
433 | 5: rdpkru (110),(11B) | wrpkru (111),(11B) |
434 | @@ -1011,7 +1013,7 @@ GrpTable: Grp15 |
435 | 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) |
436 | 4: XSAVE |
437 | 5: XRSTOR | lfence (11B) |
438 | -6: XSAVEOPT | clwb (66) | mfence (11B) |
439 | +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) |
440 | 7: clflush | clflushopt (66) | sfence (11B) |
441 | EndTable |
442 | |
443 | @@ -1042,6 +1044,10 @@ GrpTable: Grp19 |
444 | 6: vscatterpf1qps/d Wx (66),(ev) |
445 | EndTable |
446 | |
447 | +GrpTable: Grp20 |
448 | +0: cldemote Mb |
449 | +EndTable |
450 | + |
451 | # AMD's Prefetch Group |
452 | GrpTable: GrpP |
453 | 0: PREFETCH |
454 | diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c |
455 | index dff8ac2d255c..08e0380414a9 100644 |
456 | --- a/arch/x86/mm/pgtable.c |
457 | +++ b/arch/x86/mm/pgtable.c |
458 | @@ -544,8 +544,8 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) |
459 | fixmaps_set++; |
460 | } |
461 | |
462 | -void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, |
463 | - pgprot_t flags) |
464 | +void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, |
465 | + phys_addr_t phys, pgprot_t flags) |
466 | { |
467 | __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags)); |
468 | } |
469 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
470 | index da1a987c622a..b1582f161171 100644 |
471 | --- a/drivers/ata/libata-core.c |
472 | +++ b/drivers/ata/libata-core.c |
473 | @@ -6550,6 +6550,9 @@ void ata_host_detach(struct ata_host *host) |
474 | { |
475 | int i; |
476 | |
477 | + /* Ensure ata_port probe has completed */ |
478 | + async_synchronize_full(); |
479 | + |
480 | for (i = 0; i < host->n_ports; i++) |
481 | ata_port_detach(host->ports[i]); |
482 | |
483 | diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c |
484 | index a46f188f679e..782dbab5ad56 100644 |
485 | --- a/drivers/cdrom/cdrom.c |
486 | +++ b/drivers/cdrom/cdrom.c |
487 | @@ -998,6 +998,12 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype *tracks) |
488 | tracks->xa = 0; |
489 | tracks->error = 0; |
490 | cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); |
491 | + |
492 | + if (!CDROM_CAN(CDC_PLAY_AUDIO)) { |
493 | + tracks->error = CDS_NO_INFO; |
494 | + return; |
495 | + } |
496 | + |
497 | /* Grab the TOC header so we can see how many tracks there are */ |
498 | ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header); |
499 | if (ret) { |
500 | @@ -1164,7 +1170,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, |
501 | ret = open_for_data(cdi); |
502 | if (ret) |
503 | goto err; |
504 | - cdrom_mmc3_profile(cdi); |
505 | + if (CDROM_CAN(CDC_GENERIC_PACKET)) |
506 | + cdrom_mmc3_profile(cdi); |
507 | if (mode & FMODE_WRITE) { |
508 | ret = -EROFS; |
509 | if (cdrom_open_write(cdi)) |
510 | @@ -2873,6 +2880,9 @@ int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written) |
511 | it doesn't give enough information or fails. then we return |
512 | the toc contents. */ |
513 | use_toc: |
514 | + if (!CDROM_CAN(CDC_PLAY_AUDIO)) |
515 | + return -ENOSYS; |
516 | + |
517 | toc.cdte_format = CDROM_MSF; |
518 | toc.cdte_track = CDROM_LEADOUT; |
519 | if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &toc))) |
520 | diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c |
521 | index 37a58d78aab3..3324a7f4bee3 100644 |
522 | --- a/drivers/char/hw_random/omap3-rom-rng.c |
523 | +++ b/drivers/char/hw_random/omap3-rom-rng.c |
524 | @@ -114,7 +114,8 @@ static int omap3_rom_rng_remove(struct platform_device *pdev) |
525 | { |
526 | cancel_delayed_work_sync(&idle_work); |
527 | hwrng_unregister(&omap3_rom_rng_ops); |
528 | - clk_disable_unprepare(rng_clk); |
529 | + if (!rng_idle) |
530 | + clk_disable_unprepare(rng_clk); |
531 | return 0; |
532 | } |
533 | |
534 | diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c |
535 | index c40b1804f58c..bb556f9bbeda 100644 |
536 | --- a/drivers/clk/pxa/clk-pxa27x.c |
537 | +++ b/drivers/clk/pxa/clk-pxa27x.c |
538 | @@ -362,6 +362,7 @@ struct dummy_clk { |
539 | }; |
540 | static struct dummy_clk dummy_clks[] __initdata = { |
541 | DUMMY_CLK(NULL, "pxa27x-gpio", "osc_32_768khz"), |
542 | + DUMMY_CLK(NULL, "pxa-rtc", "osc_32_768khz"), |
543 | DUMMY_CLK(NULL, "sa1100-rtc", "osc_32_768khz"), |
544 | DUMMY_CLK("UARTCLK", "pxa2xx-ir", "STUART"), |
545 | }; |
546 | diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c |
547 | index a071bba8018c..0ae1b0a66eb5 100644 |
548 | --- a/drivers/clk/qcom/clk-rcg2.c |
549 | +++ b/drivers/clk/qcom/clk-rcg2.c |
550 | @@ -196,6 +196,8 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, |
551 | p = clk_hw_get_parent_by_index(hw, index); |
552 | if (clk_flags & CLK_SET_RATE_PARENT) { |
553 | if (f->pre_div) { |
554 | + if (!rate) |
555 | + rate = req->rate; |
556 | rate /= 2; |
557 | rate *= f->pre_div + 1; |
558 | } |
559 | diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c |
560 | index fffcbaf0fba7..f89a9f0aa606 100644 |
561 | --- a/drivers/clk/qcom/common.c |
562 | +++ b/drivers/clk/qcom/common.c |
563 | @@ -37,6 +37,9 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate) |
564 | if (!f) |
565 | return NULL; |
566 | |
567 | + if (!f->freq) |
568 | + return f; |
569 | + |
570 | for (; f->freq; f++) |
571 | if (rate <= f->freq) |
572 | return f; |
573 | diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c |
574 | index 1ba871b7fe11..e5717807c00a 100644 |
575 | --- a/drivers/clocksource/asm9260_timer.c |
576 | +++ b/drivers/clocksource/asm9260_timer.c |
577 | @@ -198,6 +198,10 @@ static int __init asm9260_timer_init(struct device_node *np) |
578 | } |
579 | |
580 | clk = of_clk_get(np, 0); |
581 | + if (IS_ERR(clk)) { |
582 | + pr_err("Failed to get clk!\n"); |
583 | + return PTR_ERR(clk); |
584 | + } |
585 | |
586 | ret = clk_prepare_enable(clk); |
587 | if (ret) { |
588 | diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
589 | index 063ce77df619..86d48f8c6a2e 100644 |
590 | --- a/drivers/cpufreq/cpufreq.c |
591 | +++ b/drivers/cpufreq/cpufreq.c |
592 | @@ -2449,6 +2449,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) |
593 | if (cpufreq_disabled()) |
594 | return -ENODEV; |
595 | |
596 | + /* |
597 | + * The cpufreq core depends heavily on the availability of device |
598 | + * structure, make sure they are available before proceeding further. |
599 | + */ |
600 | + if (!get_cpu_device(0)) |
601 | + return -EPROBE_DEFER; |
602 | + |
603 | if (!driver_data || !driver_data->verify || !driver_data->init || |
604 | !(driver_data->setpolicy || driver_data->target_index || |
605 | driver_data->target) || |
606 | diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
607 | index ec16ec2e284d..b2e683713539 100644 |
608 | --- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
609 | +++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
610 | @@ -286,8 +286,8 @@ static int sun4i_hash(struct ahash_request *areq) |
611 | */ |
612 | while (op->len < 64 && i < end) { |
613 | /* how many bytes we can read from current SG */ |
614 | - in_r = min3(mi.length - in_i, end - i, |
615 | - 64 - op->len); |
616 | + in_r = min(end - i, 64 - op->len); |
617 | + in_r = min_t(size_t, mi.length - in_i, in_r); |
618 | memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
619 | op->len += in_r; |
620 | i += in_r; |
621 | @@ -307,8 +307,8 @@ static int sun4i_hash(struct ahash_request *areq) |
622 | } |
623 | if (mi.length - in_i > 3 && i < end) { |
624 | /* how many bytes we can read from current SG */ |
625 | - in_r = min3(mi.length - in_i, areq->nbytes - i, |
626 | - ((mi.length - in_i) / 4) * 4); |
627 | + in_r = min_t(size_t, mi.length - in_i, areq->nbytes - i); |
628 | + in_r = min_t(size_t, ((mi.length - in_i) / 4) * 4, in_r); |
629 | /* how many bytes we can write in the device*/ |
630 | todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4); |
631 | writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo); |
632 | @@ -334,8 +334,8 @@ static int sun4i_hash(struct ahash_request *areq) |
633 | if ((areq->nbytes - i) < 64) { |
634 | while (i < areq->nbytes && in_i < mi.length && op->len < 64) { |
635 | /* how many bytes we can read from current SG */ |
636 | - in_r = min3(mi.length - in_i, areq->nbytes - i, |
637 | - 64 - op->len); |
638 | + in_r = min(areq->nbytes - i, 64 - op->len); |
639 | + in_r = min_t(size_t, mi.length - in_i, in_r); |
640 | memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
641 | op->len += in_r; |
642 | i += in_r; |
643 | diff --git a/drivers/crypto/vmx/Makefile b/drivers/crypto/vmx/Makefile |
644 | index de6e241b0866..957377c309a9 100644 |
645 | --- a/drivers/crypto/vmx/Makefile |
646 | +++ b/drivers/crypto/vmx/Makefile |
647 | @@ -2,13 +2,13 @@ obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o |
648 | vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o |
649 | |
650 | ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) |
651 | -TARGET := linux-ppc64le |
652 | +override flavour := linux-ppc64le |
653 | else |
654 | -TARGET := linux-ppc64 |
655 | +override flavour := linux-ppc64 |
656 | endif |
657 | |
658 | quiet_cmd_perl = PERL $@ |
659 | - cmd_perl = $(PERL) $(<) $(TARGET) > $(@) |
660 | + cmd_perl = $(PERL) $(<) $(flavour) > $(@) |
661 | |
662 | $(src)/aesp8-ppc.S: $(src)/aesp8-ppc.pl |
663 | $(call cmd,perl) |
664 | diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c |
665 | index e3fa4390f846..4ddbf6604e2a 100644 |
666 | --- a/drivers/edac/ghes_edac.c |
667 | +++ b/drivers/edac/ghes_edac.c |
668 | @@ -189,6 +189,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, |
669 | /* Cleans the error report buffer */ |
670 | memset(e, 0, sizeof (*e)); |
671 | e->error_count = 1; |
672 | + e->grain = 1; |
673 | strcpy(e->label, "unknown label"); |
674 | e->msg = pvt->msg; |
675 | e->other_detail = pvt->other_detail; |
676 | @@ -284,7 +285,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, |
677 | |
678 | /* Error grain */ |
679 | if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) |
680 | - e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); |
681 | + e->grain = ~mem_err->physical_addr_mask + 1; |
682 | |
683 | /* Memory error location, mapped on e->location */ |
684 | p = e->location; |
685 | @@ -391,8 +392,13 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, |
686 | if (p > pvt->other_detail) |
687 | *(p - 1) = '\0'; |
688 | |
689 | + /* Sanity-check driver-supplied grain value. */ |
690 | + if (WARN_ON_ONCE(!e->grain)) |
691 | + e->grain = 1; |
692 | + |
693 | + grain_bits = fls_long(e->grain - 1); |
694 | + |
695 | /* Generate the trace event */ |
696 | - grain_bits = fls_long(e->grain); |
697 | snprintf(pvt->detail_location, sizeof(pvt->detail_location), |
698 | "APEI location: %s %s", e->location, e->other_detail); |
699 | trace_mc_event(type, e->msg, e->label, e->error_count, |
700 | diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c |
701 | index b22325688503..9d2d8a6673c8 100644 |
702 | --- a/drivers/extcon/extcon-sm5502.c |
703 | +++ b/drivers/extcon/extcon-sm5502.c |
704 | @@ -69,6 +69,10 @@ struct sm5502_muic_info { |
705 | /* Default value of SM5502 register to bring up MUIC device. */ |
706 | static struct reg_data sm5502_reg_data[] = { |
707 | { |
708 | + .reg = SM5502_REG_RESET, |
709 | + .val = SM5502_REG_RESET_MASK, |
710 | + .invert = true, |
711 | + }, { |
712 | .reg = SM5502_REG_CONTROL, |
713 | .val = SM5502_REG_CONTROL_MASK_INT_MASK, |
714 | .invert = false, |
715 | diff --git a/drivers/extcon/extcon-sm5502.h b/drivers/extcon/extcon-sm5502.h |
716 | index 974b53222f56..12f8b01e5753 100644 |
717 | --- a/drivers/extcon/extcon-sm5502.h |
718 | +++ b/drivers/extcon/extcon-sm5502.h |
719 | @@ -241,6 +241,8 @@ enum sm5502_reg { |
720 | #define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ |
721 | | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) |
722 | |
723 | +#define SM5502_REG_RESET_MASK (0x1) |
724 | + |
725 | /* SM5502 Interrupts */ |
726 | enum sm5502_irq { |
727 | /* INT1 */ |
728 | diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c |
729 | index 793518a30afe..bd777687233b 100644 |
730 | --- a/drivers/gpio/gpio-mpc8xxx.c |
731 | +++ b/drivers/gpio/gpio-mpc8xxx.c |
732 | @@ -337,7 +337,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) |
733 | * It's assumed that only a single type of gpio controller is available |
734 | * on the current machine, so overwriting global data is fine. |
735 | */ |
736 | - mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; |
737 | + if (devtype->irq_set_type) |
738 | + mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; |
739 | |
740 | if (devtype->gpio_dir_out) |
741 | gc->direction_output = devtype->gpio_dir_out; |
742 | diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c |
743 | index a2a82366a771..eb97e88a103c 100644 |
744 | --- a/drivers/gpu/drm/bridge/analogix-anx78xx.c |
745 | +++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c |
746 | @@ -725,7 +725,9 @@ static int anx78xx_init_pdata(struct anx78xx *anx78xx) |
747 | /* 1.0V digital core power regulator */ |
748 | pdata->dvdd10 = devm_regulator_get(dev, "dvdd10"); |
749 | if (IS_ERR(pdata->dvdd10)) { |
750 | - DRM_ERROR("DVDD10 regulator not found\n"); |
751 | + if (PTR_ERR(pdata->dvdd10) != -EPROBE_DEFER) |
752 | + DRM_ERROR("DVDD10 regulator not found\n"); |
753 | + |
754 | return PTR_ERR(pdata->dvdd10); |
755 | } |
756 | |
757 | @@ -1344,7 +1346,9 @@ static int anx78xx_i2c_probe(struct i2c_client *client, |
758 | |
759 | err = anx78xx_init_pdata(anx78xx); |
760 | if (err) { |
761 | - DRM_ERROR("Failed to initialize pdata: %d\n", err); |
762 | + if (err != -EPROBE_DEFER) |
763 | + DRM_ERROR("Failed to initialize pdata: %d\n", err); |
764 | + |
765 | return err; |
766 | } |
767 | |
768 | diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c |
769 | index da9fd34b9550..caa6da02206a 100644 |
770 | --- a/drivers/gpu/drm/gma500/oaktrail_crtc.c |
771 | +++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c |
772 | @@ -139,6 +139,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit, |
773 | s32 freq_error, min_error = 100000; |
774 | |
775 | memset(best_clock, 0, sizeof(*best_clock)); |
776 | + memset(&clock, 0, sizeof(clock)); |
777 | |
778 | for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { |
779 | for (clock.n = limit->n.min; clock.n <= limit->n.max; |
780 | @@ -195,6 +196,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit, |
781 | int err = target; |
782 | |
783 | memset(best_clock, 0, sizeof(*best_clock)); |
784 | + memset(&clock, 0, sizeof(clock)); |
785 | |
786 | for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { |
787 | for (clock.p1 = limit->p1.min; clock.p1 <= limit->p1.max; |
788 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
789 | index 42d1b350afd2..c89eb3c3965c 100644 |
790 | --- a/drivers/hid/hid-core.c |
791 | +++ b/drivers/hid/hid-core.c |
792 | @@ -761,6 +761,10 @@ static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage) |
793 | if (usage == 0xff0000c5 && parser->global.report_count == 256 && |
794 | parser->global.report_size == 8) |
795 | parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; |
796 | + |
797 | + if (usage == 0xff0000c6 && parser->global.report_count == 1 && |
798 | + parser->global.report_size == 8) |
799 | + parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; |
800 | } |
801 | |
802 | static void hid_scan_collection(struct hid_parser *parser, unsigned type) |
803 | diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c |
804 | index 712fbd2b1f16..ec3f7bc70b75 100644 |
805 | --- a/drivers/iio/adc/max1027.c |
806 | +++ b/drivers/iio/adc/max1027.c |
807 | @@ -471,6 +471,14 @@ static int max1027_probe(struct spi_device *spi) |
808 | goto fail_dev_register; |
809 | } |
810 | |
811 | + /* Internal reset */ |
812 | + st->reg = MAX1027_RST_REG; |
813 | + ret = spi_write(st->spi, &st->reg, 1); |
814 | + if (ret < 0) { |
815 | + dev_err(&indio_dev->dev, "Failed to reset the ADC\n"); |
816 | + return ret; |
817 | + } |
818 | + |
819 | /* Disable averaging */ |
820 | st->reg = MAX1027_AVG_REG; |
821 | ret = spi_write(st->spi, &st->reg, 1); |
822 | diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c |
823 | index b05946604f80..6d5bb11594dc 100644 |
824 | --- a/drivers/iio/light/bh1750.c |
825 | +++ b/drivers/iio/light/bh1750.c |
826 | @@ -62,9 +62,9 @@ struct bh1750_chip_info { |
827 | |
828 | u16 int_time_low_mask; |
829 | u16 int_time_high_mask; |
830 | -} |
831 | +}; |
832 | |
833 | -static const bh1750_chip_info_tbl[] = { |
834 | +static const struct bh1750_chip_info bh1750_chip_info_tbl[] = { |
835 | [BH1710] = { 140, 1022, 300, 400, 250000000, 2, 0x001F, 0x03E0 }, |
836 | [BH1721] = { 140, 1020, 300, 400, 250000000, 2, 0x0010, 0x03E0 }, |
837 | [BH1750] = { 31, 254, 69, 1740, 57500000, 1, 0x001F, 0x00E0 }, |
838 | diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c |
839 | index e46e2b095c18..fdf5179a81c1 100644 |
840 | --- a/drivers/infiniband/ulp/iser/iscsi_iser.c |
841 | +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c |
842 | @@ -649,6 +649,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, |
843 | if (ib_conn->pi_support) { |
844 | u32 sig_caps = ib_conn->device->ib_device->attrs.sig_prot_cap; |
845 | |
846 | + shost->sg_prot_tablesize = shost->sg_tablesize; |
847 | scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps)); |
848 | scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP | |
849 | SHOST_DIX_GUARD_CRC); |
850 | diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c |
851 | index c2fb0236a47c..8d871fcb7912 100644 |
852 | --- a/drivers/input/touchscreen/atmel_mxt_ts.c |
853 | +++ b/drivers/input/touchscreen/atmel_mxt_ts.c |
854 | @@ -3206,6 +3206,8 @@ static int __maybe_unused mxt_suspend(struct device *dev) |
855 | |
856 | mutex_unlock(&input_dev->mutex); |
857 | |
858 | + disable_irq(data->irq); |
859 | + |
860 | return 0; |
861 | } |
862 | |
863 | @@ -3218,6 +3220,8 @@ static int __maybe_unused mxt_resume(struct device *dev) |
864 | if (!input_dev) |
865 | return 0; |
866 | |
867 | + enable_irq(data->irq); |
868 | + |
869 | mutex_lock(&input_dev->mutex); |
870 | |
871 | if (input_dev->users) |
872 | diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c |
873 | index c4eb293b1524..04cec050e42b 100644 |
874 | --- a/drivers/iommu/tegra-smmu.c |
875 | +++ b/drivers/iommu/tegra-smmu.c |
876 | @@ -153,9 +153,9 @@ static bool smmu_dma_addr_valid(struct tegra_smmu *smmu, dma_addr_t addr) |
877 | return (addr & smmu->pfn_mask) == addr; |
878 | } |
879 | |
880 | -static dma_addr_t smmu_pde_to_dma(u32 pde) |
881 | +static dma_addr_t smmu_pde_to_dma(struct tegra_smmu *smmu, u32 pde) |
882 | { |
883 | - return pde << 12; |
884 | + return (dma_addr_t)(pde & smmu->pfn_mask) << 12; |
885 | } |
886 | |
887 | static void smmu_flush_ptc_all(struct tegra_smmu *smmu) |
888 | @@ -540,6 +540,7 @@ static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, |
889 | dma_addr_t *dmap) |
890 | { |
891 | unsigned int pd_index = iova_pd_index(iova); |
892 | + struct tegra_smmu *smmu = as->smmu; |
893 | struct page *pt_page; |
894 | u32 *pd; |
895 | |
896 | @@ -548,7 +549,7 @@ static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, |
897 | return NULL; |
898 | |
899 | pd = page_address(as->pd); |
900 | - *dmap = smmu_pde_to_dma(pd[pd_index]); |
901 | + *dmap = smmu_pde_to_dma(smmu, pd[pd_index]); |
902 | |
903 | return tegra_smmu_pte_offset(pt_page, iova); |
904 | } |
905 | @@ -590,7 +591,7 @@ static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova, |
906 | } else { |
907 | u32 *pd = page_address(as->pd); |
908 | |
909 | - *dmap = smmu_pde_to_dma(pd[pde]); |
910 | + *dmap = smmu_pde_to_dma(smmu, pd[pde]); |
911 | } |
912 | |
913 | return tegra_smmu_pte_offset(as->pts[pde], iova); |
914 | @@ -615,7 +616,7 @@ static void tegra_smmu_pte_put_use(struct tegra_smmu_as *as, unsigned long iova) |
915 | if (--as->count[pde] == 0) { |
916 | struct tegra_smmu *smmu = as->smmu; |
917 | u32 *pd = page_address(as->pd); |
918 | - dma_addr_t pte_dma = smmu_pde_to_dma(pd[pde]); |
919 | + dma_addr_t pte_dma = smmu_pde_to_dma(smmu, pd[pde]); |
920 | |
921 | tegra_smmu_set_pde(as, iova, 0); |
922 | |
923 | diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c |
924 | index 6e24facebb46..a571d9c6e42a 100644 |
925 | --- a/drivers/irqchip/irq-bcm7038-l1.c |
926 | +++ b/drivers/irqchip/irq-bcm7038-l1.c |
927 | @@ -282,6 +282,10 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, |
928 | pr_err("failed to map parent interrupt %d\n", parent_irq); |
929 | return -EINVAL; |
930 | } |
931 | + |
932 | + if (of_property_read_bool(dn, "brcm,irq-can-wake")) |
933 | + enable_irq_wake(parent_irq); |
934 | + |
935 | irq_set_chained_handler_and_data(parent_irq, bcm7038_l1_irq_handle, |
936 | intc); |
937 | |
938 | diff --git a/drivers/irqchip/irq-ingenic.c b/drivers/irqchip/irq-ingenic.c |
939 | index fc5953dea509..b2e16dca76a6 100644 |
940 | --- a/drivers/irqchip/irq-ingenic.c |
941 | +++ b/drivers/irqchip/irq-ingenic.c |
942 | @@ -117,6 +117,14 @@ static int __init ingenic_intc_of_init(struct device_node *node, |
943 | goto out_unmap_irq; |
944 | } |
945 | |
946 | + domain = irq_domain_add_legacy(node, num_chips * 32, |
947 | + JZ4740_IRQ_BASE, 0, |
948 | + &irq_domain_simple_ops, NULL); |
949 | + if (!domain) { |
950 | + err = -ENOMEM; |
951 | + goto out_unmap_base; |
952 | + } |
953 | + |
954 | for (i = 0; i < num_chips; i++) { |
955 | /* Mask all irqs */ |
956 | writel(0xffffffff, intc->base + (i * CHIP_SIZE) + |
957 | @@ -143,14 +151,11 @@ static int __init ingenic_intc_of_init(struct device_node *node, |
958 | IRQ_NOPROBE | IRQ_LEVEL); |
959 | } |
960 | |
961 | - domain = irq_domain_add_legacy(node, num_chips * 32, JZ4740_IRQ_BASE, 0, |
962 | - &irq_domain_simple_ops, NULL); |
963 | - if (!domain) |
964 | - pr_warn("unable to register IRQ domain\n"); |
965 | - |
966 | setup_irq(parent_irq, &intc_cascade_action); |
967 | return 0; |
968 | |
969 | +out_unmap_base: |
970 | + iounmap(intc->base); |
971 | out_unmap_irq: |
972 | irq_dispose_mapping(parent_irq); |
973 | out_free: |
974 | diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
975 | index 4e34afb6e36a..c8c5e3368b8b 100644 |
976 | --- a/drivers/md/bcache/btree.c |
977 | +++ b/drivers/md/bcache/btree.c |
978 | @@ -681,6 +681,8 @@ static unsigned long bch_mca_scan(struct shrinker *shrink, |
979 | * IO can always make forward progress: |
980 | */ |
981 | nr /= c->btree_pages; |
982 | + if (nr == 0) |
983 | + nr = 1; |
984 | nr = min_t(unsigned long, nr, mca_can_free(c)); |
985 | |
986 | i = 0; |
987 | diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c |
988 | index 3554eea77e04..ade3c48e2e0c 100644 |
989 | --- a/drivers/media/i2c/ov2659.c |
990 | +++ b/drivers/media/i2c/ov2659.c |
991 | @@ -419,10 +419,14 @@ static struct sensor_register ov2659_720p[] = { |
992 | { REG_TIMING_YINC, 0x11 }, |
993 | { REG_TIMING_VERT_FORMAT, 0x80 }, |
994 | { REG_TIMING_HORIZ_FORMAT, 0x00 }, |
995 | + { 0x370a, 0x12 }, |
996 | { 0x3a03, 0xe8 }, |
997 | { 0x3a09, 0x6f }, |
998 | { 0x3a0b, 0x5d }, |
999 | { 0x3a15, 0x9a }, |
1000 | + { REG_VFIFO_READ_START_H, 0x00 }, |
1001 | + { REG_VFIFO_READ_START_L, 0x80 }, |
1002 | + { REG_ISP_CTRL02, 0x00 }, |
1003 | { REG_NULL, 0x00 }, |
1004 | }; |
1005 | |
1006 | @@ -1204,11 +1208,15 @@ static int ov2659_s_stream(struct v4l2_subdev *sd, int on) |
1007 | goto unlock; |
1008 | } |
1009 | |
1010 | - ov2659_set_pixel_clock(ov2659); |
1011 | - ov2659_set_frame_size(ov2659); |
1012 | - ov2659_set_format(ov2659); |
1013 | - ov2659_set_streaming(ov2659, 1); |
1014 | - ov2659->streaming = on; |
1015 | + ret = ov2659_set_pixel_clock(ov2659); |
1016 | + if (!ret) |
1017 | + ret = ov2659_set_frame_size(ov2659); |
1018 | + if (!ret) |
1019 | + ret = ov2659_set_format(ov2659); |
1020 | + if (!ret) { |
1021 | + ov2659_set_streaming(ov2659, 1); |
1022 | + ov2659->streaming = on; |
1023 | + } |
1024 | |
1025 | unlock: |
1026 | mutex_unlock(&ov2659->lock); |
1027 | diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c |
1028 | index fc187c5aeb1e..7a119466f973 100644 |
1029 | --- a/drivers/media/i2c/soc_camera/ov6650.c |
1030 | +++ b/drivers/media/i2c/soc_camera/ov6650.c |
1031 | @@ -612,7 +612,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
1032 | dev_err(&client->dev, "Pixel format not handled: 0x%x\n", code); |
1033 | return -EINVAL; |
1034 | } |
1035 | - priv->code = code; |
1036 | |
1037 | if (code == MEDIA_BUS_FMT_Y8_1X8 || |
1038 | code == MEDIA_BUS_FMT_SBGGR8_1X8) { |
1039 | @@ -638,7 +637,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
1040 | dev_dbg(&client->dev, "max resolution: CIF\n"); |
1041 | coma_mask |= COMA_QCIF; |
1042 | } |
1043 | - priv->half_scale = half_scale; |
1044 | |
1045 | if (sense) { |
1046 | if (sense->master_clock == 8000000) { |
1047 | @@ -678,8 +676,13 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
1048 | ret = ov6650_reg_rmw(client, REG_COMA, coma_set, coma_mask); |
1049 | if (!ret) |
1050 | ret = ov6650_reg_write(client, REG_CLKRC, clkrc); |
1051 | - if (!ret) |
1052 | + if (!ret) { |
1053 | + priv->half_scale = half_scale; |
1054 | + |
1055 | ret = ov6650_reg_rmw(client, REG_COML, coml_set, coml_mask); |
1056 | + } |
1057 | + if (!ret) |
1058 | + priv->code = code; |
1059 | |
1060 | if (!ret) { |
1061 | mf->colorspace = priv->colorspace; |
1062 | diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c |
1063 | index 05489a401c5c..bd500f12d0f7 100644 |
1064 | --- a/drivers/media/platform/am437x/am437x-vpfe.c |
1065 | +++ b/drivers/media/platform/am437x/am437x-vpfe.c |
1066 | @@ -1847,6 +1847,10 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) |
1067 | if (!(sdinfo->inputs[0].capabilities & V4L2_IN_CAP_STD)) |
1068 | return -ENODATA; |
1069 | |
1070 | + /* if trying to set the same std then nothing to do */ |
1071 | + if (vpfe_standards[vpfe->std_index].std_id == std_id) |
1072 | + return 0; |
1073 | + |
1074 | /* If streaming is started, return error */ |
1075 | if (vb2_is_busy(&vpfe->buffer_queue)) { |
1076 | vpfe_err(vpfe, "%s device busy\n", __func__); |
1077 | diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c |
1078 | index 0189f7f7cb03..dbb4829acc43 100644 |
1079 | --- a/drivers/media/platform/ti-vpe/vpe.c |
1080 | +++ b/drivers/media/platform/ti-vpe/vpe.c |
1081 | @@ -330,20 +330,25 @@ enum { |
1082 | }; |
1083 | |
1084 | /* find our format description corresponding to the passed v4l2_format */ |
1085 | -static struct vpe_fmt *find_format(struct v4l2_format *f) |
1086 | +static struct vpe_fmt *__find_format(u32 fourcc) |
1087 | { |
1088 | struct vpe_fmt *fmt; |
1089 | unsigned int k; |
1090 | |
1091 | for (k = 0; k < ARRAY_SIZE(vpe_formats); k++) { |
1092 | fmt = &vpe_formats[k]; |
1093 | - if (fmt->fourcc == f->fmt.pix.pixelformat) |
1094 | + if (fmt->fourcc == fourcc) |
1095 | return fmt; |
1096 | } |
1097 | |
1098 | return NULL; |
1099 | } |
1100 | |
1101 | +static struct vpe_fmt *find_format(struct v4l2_format *f) |
1102 | +{ |
1103 | + return __find_format(f->fmt.pix.pixelformat); |
1104 | +} |
1105 | + |
1106 | /* |
1107 | * there is one vpe_dev structure in the driver, it is shared by |
1108 | * all instances. |
1109 | @@ -1293,6 +1298,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) |
1110 | d_vb->timecode = s_vb->timecode; |
1111 | |
1112 | d_vb->sequence = ctx->sequence; |
1113 | + s_vb->sequence = ctx->sequence; |
1114 | |
1115 | d_q_data = &ctx->q_data[Q_DATA_DST]; |
1116 | if (d_q_data->flags & Q_DATA_INTERLACED) { |
1117 | @@ -1433,9 +1439,9 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, |
1118 | int i, depth, depth_bytes; |
1119 | |
1120 | if (!fmt || !(fmt->types & type)) { |
1121 | - vpe_err(ctx->dev, "Fourcc format (0x%08x) invalid.\n", |
1122 | + vpe_dbg(ctx->dev, "Fourcc format (0x%08x) invalid.\n", |
1123 | pix->pixelformat); |
1124 | - return -EINVAL; |
1125 | + fmt = __find_format(V4L2_PIX_FMT_YUYV); |
1126 | } |
1127 | |
1128 | if (pix->field != V4L2_FIELD_NONE && pix->field != V4L2_FIELD_ALTERNATE) |
1129 | @@ -1992,7 +1998,7 @@ static int vpe_open(struct file *file) |
1130 | v4l2_ctrl_handler_setup(hdl); |
1131 | |
1132 | s_q_data = &ctx->q_data[Q_DATA_SRC]; |
1133 | - s_q_data->fmt = &vpe_formats[2]; |
1134 | + s_q_data->fmt = __find_format(V4L2_PIX_FMT_YUYV); |
1135 | s_q_data->width = 1920; |
1136 | s_q_data->height = 1080; |
1137 | s_q_data->bytesperline[VPE_LUMA] = (s_q_data->width * |
1138 | diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c |
1139 | index f218886c504d..fb69534a8b56 100644 |
1140 | --- a/drivers/media/radio/si470x/radio-si470x-i2c.c |
1141 | +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c |
1142 | @@ -460,6 +460,8 @@ static int si470x_i2c_remove(struct i2c_client *client) |
1143 | video_unregister_device(&radio->videodev); |
1144 | kfree(radio); |
1145 | |
1146 | + v4l2_ctrl_handler_free(&radio->hdl); |
1147 | + v4l2_device_unregister(&radio->v4l2_dev); |
1148 | return 0; |
1149 | } |
1150 | |
1151 | diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
1152 | index 1fc3c8d7dd9b..2594d6a7393f 100644 |
1153 | --- a/drivers/media/usb/b2c2/flexcop-usb.c |
1154 | +++ b/drivers/media/usb/b2c2/flexcop-usb.c |
1155 | @@ -504,7 +504,13 @@ urb_error: |
1156 | static int flexcop_usb_init(struct flexcop_usb *fc_usb) |
1157 | { |
1158 | /* use the alternate setting with the larges buffer */ |
1159 | - usb_set_interface(fc_usb->udev,0,1); |
1160 | + int ret = usb_set_interface(fc_usb->udev, 0, 1); |
1161 | + |
1162 | + if (ret) { |
1163 | + err("set interface failed."); |
1164 | + return ret; |
1165 | + } |
1166 | + |
1167 | switch (fc_usb->udev->speed) { |
1168 | case USB_SPEED_LOW: |
1169 | err("cannot handle USB speed because it is too slow."); |
1170 | diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
1171 | index 2cc4d2b6f810..d18ced28797d 100644 |
1172 | --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
1173 | +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
1174 | @@ -919,8 +919,12 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp) |
1175 | pvr2_v4l2_dev_disassociate_parent(vp->dev_video); |
1176 | pvr2_v4l2_dev_disassociate_parent(vp->dev_radio); |
1177 | if (!list_empty(&vp->dev_video->devbase.fh_list) || |
1178 | - !list_empty(&vp->dev_radio->devbase.fh_list)) |
1179 | + (vp->dev_radio && |
1180 | + !list_empty(&vp->dev_radio->devbase.fh_list))) { |
1181 | + pvr2_trace(PVR2_TRACE_STRUCT, |
1182 | + "pvr2_v4l2 internal_check exit-empty id=%p", vp); |
1183 | return; |
1184 | + } |
1185 | pvr2_v4l2_destroy_no_lock(vp); |
1186 | } |
1187 | |
1188 | @@ -994,7 +998,8 @@ static int pvr2_v4l2_release(struct file *file) |
1189 | kfree(fhp); |
1190 | if (vp->channel.mc_head->disconnect_flag && |
1191 | list_empty(&vp->dev_video->devbase.fh_list) && |
1192 | - list_empty(&vp->dev_radio->devbase.fh_list)) { |
1193 | + (!vp->dev_radio || |
1194 | + list_empty(&vp->dev_radio->devbase.fh_list))) { |
1195 | pvr2_v4l2_destroy_no_lock(vp); |
1196 | } |
1197 | return 0; |
1198 | diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
1199 | index 6f11cd95bb5f..225ecab7eccc 100644 |
1200 | --- a/drivers/mmc/host/sdhci-of-esdhc.c |
1201 | +++ b/drivers/mmc/host/sdhci-of-esdhc.c |
1202 | @@ -637,8 +637,8 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) |
1203 | host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ; |
1204 | |
1205 | if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) { |
1206 | - host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
1207 | - host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
1208 | + host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
1209 | + host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
1210 | } |
1211 | |
1212 | if (of_device_is_compatible(np, "fsl,p5040-esdhc") || |
1213 | diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
1214 | index 0347742a495a..bd43dc7f4c63 100644 |
1215 | --- a/drivers/mmc/host/sdhci.c |
1216 | +++ b/drivers/mmc/host/sdhci.c |
1217 | @@ -1557,9 +1557,7 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing) |
1218 | ctrl_2 |= SDHCI_CTRL_UHS_SDR104; |
1219 | else if (timing == MMC_TIMING_UHS_SDR12) |
1220 | ctrl_2 |= SDHCI_CTRL_UHS_SDR12; |
1221 | - else if (timing == MMC_TIMING_SD_HS || |
1222 | - timing == MMC_TIMING_MMC_HS || |
1223 | - timing == MMC_TIMING_UHS_SDR25) |
1224 | + else if (timing == MMC_TIMING_UHS_SDR25) |
1225 | ctrl_2 |= SDHCI_CTRL_UHS_SDR25; |
1226 | else if (timing == MMC_TIMING_UHS_SDR50) |
1227 | ctrl_2 |= SDHCI_CTRL_UHS_SDR50; |
1228 | @@ -2100,7 +2098,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) |
1229 | spin_lock_irqsave(&host->lock, flags); |
1230 | |
1231 | if (!host->tuning_done) { |
1232 | - pr_info(DRIVER_NAME ": Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock\n"); |
1233 | + pr_debug(DRIVER_NAME ": Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock\n"); |
1234 | ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); |
1235 | ctrl &= ~SDHCI_CTRL_TUNED_CLK; |
1236 | ctrl &= ~SDHCI_CTRL_EXEC_TUNING; |
1237 | diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c |
1238 | index 0fc1f73b0d23..3e025766181b 100644 |
1239 | --- a/drivers/mmc/host/tmio_mmc_pio.c |
1240 | +++ b/drivers/mmc/host/tmio_mmc_pio.c |
1241 | @@ -1076,7 +1076,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, |
1242 | tmio_mmc_ops.start_signal_voltage_switch = _host->start_signal_voltage_switch; |
1243 | mmc->ops = &tmio_mmc_ops; |
1244 | |
1245 | - mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; |
1246 | + mmc->caps |= MMC_CAP_ERASE | MMC_CAP_4_BIT_DATA | pdata->capabilities; |
1247 | mmc->caps2 |= pdata->capabilities2; |
1248 | mmc->max_segs = 32; |
1249 | mmc->max_blk_size = 512; |
1250 | diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1251 | index 0780900b37c7..961f31c8356b 100644 |
1252 | --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1253 | +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
1254 | @@ -1105,8 +1105,8 @@ static int ena_io_poll(struct napi_struct *napi, int budget) |
1255 | struct ena_ring *tx_ring, *rx_ring; |
1256 | struct ena_eth_io_intr_reg intr_reg; |
1257 | |
1258 | - u32 tx_work_done; |
1259 | - u32 rx_work_done; |
1260 | + int tx_work_done; |
1261 | + int rx_work_done = 0; |
1262 | int tx_budget; |
1263 | int napi_comp_call = 0; |
1264 | int ret; |
1265 | @@ -1122,7 +1122,11 @@ static int ena_io_poll(struct napi_struct *napi, int budget) |
1266 | } |
1267 | |
1268 | tx_work_done = ena_clean_tx_irq(tx_ring, tx_budget); |
1269 | - rx_work_done = ena_clean_rx_irq(rx_ring, napi, budget); |
1270 | + /* On netpoll the budget is zero and the handler should only clean the |
1271 | + * tx completions. |
1272 | + */ |
1273 | + if (likely(budget)) |
1274 | + rx_work_done = ena_clean_rx_irq(rx_ring, napi, budget); |
1275 | |
1276 | if ((budget > rx_work_done) && (tx_budget > tx_work_done)) { |
1277 | napi_complete_done(napi, rx_work_done); |
1278 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1279 | index c6e059119b22..e8a09d0afe1c 100644 |
1280 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1281 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1282 | @@ -2376,15 +2376,21 @@ static int bnx2x_set_pf_tx_switching(struct bnx2x *bp, bool enable) |
1283 | /* send the ramrod on all the queues of the PF */ |
1284 | for_each_eth_queue(bp, i) { |
1285 | struct bnx2x_fastpath *fp = &bp->fp[i]; |
1286 | + int tx_idx; |
1287 | |
1288 | /* Set the appropriate Queue object */ |
1289 | q_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; |
1290 | |
1291 | - /* Update the Queue state */ |
1292 | - rc = bnx2x_queue_state_change(bp, &q_params); |
1293 | - if (rc) { |
1294 | - BNX2X_ERR("Failed to configure Tx switching\n"); |
1295 | - return rc; |
1296 | + for (tx_idx = FIRST_TX_COS_INDEX; |
1297 | + tx_idx < fp->max_cos; tx_idx++) { |
1298 | + q_params.params.update.cid_index = tx_idx; |
1299 | + |
1300 | + /* Update the Queue state */ |
1301 | + rc = bnx2x_queue_state_change(bp, &q_params); |
1302 | + if (rc) { |
1303 | + BNX2X_ERR("Failed to configure Tx switching\n"); |
1304 | + return rc; |
1305 | + } |
1306 | } |
1307 | } |
1308 | |
1309 | diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c |
1310 | index 4436a0307f32..0b3aa83f3fc1 100644 |
1311 | --- a/drivers/net/ethernet/hisilicon/hip04_eth.c |
1312 | +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c |
1313 | @@ -455,9 +455,9 @@ static int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1314 | skb_tx_timestamp(skb); |
1315 | |
1316 | hip04_set_xmit_desc(priv, phys); |
1317 | - priv->tx_head = TX_NEXT(tx_head); |
1318 | count++; |
1319 | netdev_sent_queue(ndev, skb->len); |
1320 | + priv->tx_head = TX_NEXT(tx_head); |
1321 | |
1322 | stats->tx_bytes += skb->len; |
1323 | stats->tx_packets++; |
1324 | diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
1325 | index c653b97d84d5..f2cb77c3b199 100644 |
1326 | --- a/drivers/net/ethernet/qlogic/qla3xxx.c |
1327 | +++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
1328 | @@ -2752,6 +2752,9 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
1329 | int err; |
1330 | |
1331 | for (i = 0; i < qdev->num_large_buffers; i++) { |
1332 | + lrg_buf_cb = &qdev->lrg_buf[i]; |
1333 | + memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); |
1334 | + |
1335 | skb = netdev_alloc_skb(qdev->ndev, |
1336 | qdev->lrg_buffer_len); |
1337 | if (unlikely(!skb)) { |
1338 | @@ -2762,11 +2765,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
1339 | ql_free_large_buffers(qdev); |
1340 | return -ENOMEM; |
1341 | } else { |
1342 | - |
1343 | - lrg_buf_cb = &qdev->lrg_buf[i]; |
1344 | - memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); |
1345 | lrg_buf_cb->index = i; |
1346 | - lrg_buf_cb->skb = skb; |
1347 | /* |
1348 | * We save some space to copy the ethhdr from first |
1349 | * buffer |
1350 | @@ -2788,6 +2787,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
1351 | return -ENOMEM; |
1352 | } |
1353 | |
1354 | + lrg_buf_cb->skb = skb; |
1355 | dma_unmap_addr_set(lrg_buf_cb, mapaddr, map); |
1356 | dma_unmap_len_set(lrg_buf_cb, maplen, |
1357 | qdev->lrg_buffer_len - |
1358 | diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c |
1359 | index bbc983b04561..3511d40ba3f1 100644 |
1360 | --- a/drivers/net/fjes/fjes_main.c |
1361 | +++ b/drivers/net/fjes/fjes_main.c |
1362 | @@ -148,6 +148,9 @@ static int fjes_acpi_add(struct acpi_device *device) |
1363 | /* create platform_device */ |
1364 | plat_dev = platform_device_register_simple(DRV_NAME, 0, fjes_resource, |
1365 | ARRAY_SIZE(fjes_resource)); |
1366 | + if (IS_ERR(plat_dev)) |
1367 | + return PTR_ERR(plat_dev); |
1368 | + |
1369 | device->driver_data = plat_dev; |
1370 | |
1371 | return 0; |
1372 | diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c |
1373 | index 7e1df403a37d..c2898718b593 100644 |
1374 | --- a/drivers/net/gtp.c |
1375 | +++ b/drivers/net/gtp.c |
1376 | @@ -42,7 +42,6 @@ struct pdp_ctx { |
1377 | struct hlist_node hlist_addr; |
1378 | |
1379 | union { |
1380 | - u64 tid; |
1381 | struct { |
1382 | u64 tid; |
1383 | u16 flow; |
1384 | @@ -678,10 +677,13 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev, |
1385 | if (err < 0) |
1386 | goto out_err; |
1387 | |
1388 | - if (!data[IFLA_GTP_PDP_HASHSIZE]) |
1389 | + if (!data[IFLA_GTP_PDP_HASHSIZE]) { |
1390 | hashsize = 1024; |
1391 | - else |
1392 | + } else { |
1393 | hashsize = nla_get_u32(data[IFLA_GTP_PDP_HASHSIZE]); |
1394 | + if (!hashsize) |
1395 | + hashsize = 1024; |
1396 | + } |
1397 | |
1398 | err = gtp_hashtable_new(gtp, hashsize); |
1399 | if (err < 0) |
1400 | @@ -1221,43 +1223,46 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb, |
1401 | struct netlink_callback *cb) |
1402 | { |
1403 | struct gtp_dev *last_gtp = (struct gtp_dev *)cb->args[2], *gtp; |
1404 | + int i, j, bucket = cb->args[0], skip = cb->args[1]; |
1405 | struct net *net = sock_net(skb->sk); |
1406 | - struct gtp_net *gn = net_generic(net, gtp_net_id); |
1407 | - unsigned long tid = cb->args[1]; |
1408 | - int i, k = cb->args[0], ret; |
1409 | struct pdp_ctx *pctx; |
1410 | + struct gtp_net *gn; |
1411 | + |
1412 | + gn = net_generic(net, gtp_net_id); |
1413 | |
1414 | if (cb->args[4]) |
1415 | return 0; |
1416 | |
1417 | + rcu_read_lock(); |
1418 | list_for_each_entry_rcu(gtp, &gn->gtp_dev_list, list) { |
1419 | if (last_gtp && last_gtp != gtp) |
1420 | continue; |
1421 | else |
1422 | last_gtp = NULL; |
1423 | |
1424 | - for (i = k; i < gtp->hash_size; i++) { |
1425 | - hlist_for_each_entry_rcu(pctx, >p->tid_hash[i], hlist_tid) { |
1426 | - if (tid && tid != pctx->u.tid) |
1427 | - continue; |
1428 | - else |
1429 | - tid = 0; |
1430 | - |
1431 | - ret = gtp_genl_fill_info(skb, |
1432 | - NETLINK_CB(cb->skb).portid, |
1433 | - cb->nlh->nlmsg_seq, |
1434 | - cb->nlh->nlmsg_type, pctx); |
1435 | - if (ret < 0) { |
1436 | + for (i = bucket; i < gtp->hash_size; i++) { |
1437 | + j = 0; |
1438 | + hlist_for_each_entry_rcu(pctx, >p->tid_hash[i], |
1439 | + hlist_tid) { |
1440 | + if (j >= skip && |
1441 | + gtp_genl_fill_info(skb, |
1442 | + NETLINK_CB(cb->skb).portid, |
1443 | + cb->nlh->nlmsg_seq, |
1444 | + cb->nlh->nlmsg_type, pctx)) { |
1445 | cb->args[0] = i; |
1446 | - cb->args[1] = pctx->u.tid; |
1447 | + cb->args[1] = j; |
1448 | cb->args[2] = (unsigned long)gtp; |
1449 | goto out; |
1450 | } |
1451 | + j++; |
1452 | } |
1453 | + skip = 0; |
1454 | } |
1455 | + bucket = 0; |
1456 | } |
1457 | cb->args[4] = 1; |
1458 | out: |
1459 | + rcu_read_unlock(); |
1460 | return skb->len; |
1461 | } |
1462 | |
1463 | diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c |
1464 | index 470b3dcd54e5..03c96a6cbafd 100644 |
1465 | --- a/drivers/net/hamradio/6pack.c |
1466 | +++ b/drivers/net/hamradio/6pack.c |
1467 | @@ -665,10 +665,10 @@ static void sixpack_close(struct tty_struct *tty) |
1468 | { |
1469 | struct sixpack *sp; |
1470 | |
1471 | - write_lock_bh(&disc_data_lock); |
1472 | + write_lock_irq(&disc_data_lock); |
1473 | sp = tty->disc_data; |
1474 | tty->disc_data = NULL; |
1475 | - write_unlock_bh(&disc_data_lock); |
1476 | + write_unlock_irq(&disc_data_lock); |
1477 | if (!sp) |
1478 | return; |
1479 | |
1480 | diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c |
1481 | index e0a6b1a0ca88..088fe5d34f50 100644 |
1482 | --- a/drivers/net/hamradio/mkiss.c |
1483 | +++ b/drivers/net/hamradio/mkiss.c |
1484 | @@ -783,10 +783,10 @@ static void mkiss_close(struct tty_struct *tty) |
1485 | { |
1486 | struct mkiss *ax; |
1487 | |
1488 | - write_lock_bh(&disc_data_lock); |
1489 | + write_lock_irq(&disc_data_lock); |
1490 | ax = tty->disc_data; |
1491 | tty->disc_data = NULL; |
1492 | - write_unlock_bh(&disc_data_lock); |
1493 | + write_unlock_irq(&disc_data_lock); |
1494 | |
1495 | if (!ax) |
1496 | return; |
1497 | diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
1498 | index 5c2c72b1ef8b..3289fd910c4a 100644 |
1499 | --- a/drivers/net/phy/phy_device.c |
1500 | +++ b/drivers/net/phy/phy_device.c |
1501 | @@ -324,8 +324,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, |
1502 | mdiodev->device_free = phy_mdio_device_free; |
1503 | mdiodev->device_remove = phy_mdio_device_remove; |
1504 | |
1505 | - dev->speed = 0; |
1506 | - dev->duplex = -1; |
1507 | + dev->speed = SPEED_UNKNOWN; |
1508 | + dev->duplex = DUPLEX_UNKNOWN; |
1509 | dev->pause = 0; |
1510 | dev->asym_pause = 0; |
1511 | dev->link = 1; |
1512 | diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c |
1513 | index a3f9d8f05db4..96258e6a1920 100644 |
1514 | --- a/drivers/net/usb/lan78xx.c |
1515 | +++ b/drivers/net/usb/lan78xx.c |
1516 | @@ -1763,6 +1763,7 @@ static int lan78xx_mdio_init(struct lan78xx_net *dev) |
1517 | dev->mdiobus->read = lan78xx_mdiobus_read; |
1518 | dev->mdiobus->write = lan78xx_mdiobus_write; |
1519 | dev->mdiobus->name = "lan78xx-mdiobus"; |
1520 | + dev->mdiobus->parent = &dev->udev->dev; |
1521 | |
1522 | snprintf(dev->mdiobus->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", |
1523 | dev->udev->bus->busnum, dev->udev->devnum); |
1524 | diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c |
1525 | index 9852c5d51139..beeb6be06939 100644 |
1526 | --- a/drivers/net/wireless/ath/ath10k/txrx.c |
1527 | +++ b/drivers/net/wireless/ath/ath10k/txrx.c |
1528 | @@ -99,6 +99,8 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, |
1529 | |
1530 | info = IEEE80211_SKB_CB(msdu); |
1531 | memset(&info->status, 0, sizeof(info->status)); |
1532 | + info->status.rates[0].idx = -1; |
1533 | + |
1534 | trace_ath10k_txrx_tx_unref(ar, tx_done->msdu_id); |
1535 | |
1536 | if (tx_done->status == HTT_TX_COMPL_STATE_DISCARD) { |
1537 | diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/led.c b/drivers/net/wireless/intel/iwlwifi/dvm/led.c |
1538 | index 1bbd17ada974..20e16c423990 100644 |
1539 | --- a/drivers/net/wireless/intel/iwlwifi/dvm/led.c |
1540 | +++ b/drivers/net/wireless/intel/iwlwifi/dvm/led.c |
1541 | @@ -185,6 +185,9 @@ void iwl_leds_init(struct iwl_priv *priv) |
1542 | |
1543 | priv->led.name = kasprintf(GFP_KERNEL, "%s-led", |
1544 | wiphy_name(priv->hw->wiphy)); |
1545 | + if (!priv->led.name) |
1546 | + return; |
1547 | + |
1548 | priv->led.brightness_set = iwl_led_brightness_set; |
1549 | priv->led.blink_set = iwl_led_blink_set; |
1550 | priv->led.max_brightness = 1; |
1551 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/led.c b/drivers/net/wireless/intel/iwlwifi/mvm/led.c |
1552 | index 1e51fbe95f7c..73c351a64187 100644 |
1553 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/led.c |
1554 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/led.c |
1555 | @@ -109,6 +109,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm) |
1556 | |
1557 | mvm->led.name = kasprintf(GFP_KERNEL, "%s-led", |
1558 | wiphy_name(mvm->hw->wiphy)); |
1559 | + if (!mvm->led.name) |
1560 | + return -ENOMEM; |
1561 | + |
1562 | mvm->led.brightness_set = iwl_led_brightness_set; |
1563 | mvm->led.max_brightness = 1; |
1564 | |
1565 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
1566 | index b78e60eb600f..d0aa4d0a5537 100644 |
1567 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
1568 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c |
1569 | @@ -62,6 +62,7 @@ |
1570 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
1571 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1572 | *****************************************************************************/ |
1573 | +#include <asm/unaligned.h> |
1574 | #include <linux/etherdevice.h> |
1575 | #include <linux/skbuff.h> |
1576 | #include "iwl-trans.h" |
1577 | @@ -289,7 +290,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, |
1578 | rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data; |
1579 | hdr = (struct ieee80211_hdr *)(pkt->data + sizeof(*rx_res)); |
1580 | len = le16_to_cpu(rx_res->byte_count); |
1581 | - rx_pkt_status = le32_to_cpup((__le32 *) |
1582 | + rx_pkt_status = get_unaligned_le32((__le32 *) |
1583 | (pkt->data + sizeof(*rx_res) + len)); |
1584 | |
1585 | /* Dont use dev_alloc_skb(), we'll have enough headroom once |
1586 | diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c |
1587 | index 06a57c708992..44da911c9a1a 100644 |
1588 | --- a/drivers/net/wireless/marvell/libertas/if_sdio.c |
1589 | +++ b/drivers/net/wireless/marvell/libertas/if_sdio.c |
1590 | @@ -1229,6 +1229,10 @@ static int if_sdio_probe(struct sdio_func *func, |
1591 | |
1592 | spin_lock_init(&card->lock); |
1593 | card->workqueue = alloc_workqueue("libertas_sdio", WQ_MEM_RECLAIM, 0); |
1594 | + if (unlikely(!card->workqueue)) { |
1595 | + ret = -ENOMEM; |
1596 | + goto err_queue; |
1597 | + } |
1598 | INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker); |
1599 | init_waitqueue_head(&card->pwron_waitq); |
1600 | |
1601 | @@ -1282,6 +1286,7 @@ err_activate_card: |
1602 | lbs_remove_card(priv); |
1603 | free: |
1604 | destroy_workqueue(card->workqueue); |
1605 | +err_queue: |
1606 | while (card->packets) { |
1607 | packet = card->packets; |
1608 | card->packets = card->packets->next; |
1609 | diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c |
1610 | index cb681b265b10..38d45a77c06b 100644 |
1611 | --- a/drivers/net/wireless/marvell/mwifiex/pcie.c |
1612 | +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c |
1613 | @@ -632,8 +632,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter) |
1614 | skb_put(skb, MAX_EVENT_SIZE); |
1615 | |
1616 | if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, |
1617 | - PCI_DMA_FROMDEVICE)) |
1618 | + PCI_DMA_FROMDEVICE)) { |
1619 | + kfree_skb(skb); |
1620 | + kfree(card->evtbd_ring_vbase); |
1621 | return -1; |
1622 | + } |
1623 | |
1624 | buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); |
1625 | |
1626 | diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |
1627 | index 08d587a342d3..9143b173935d 100644 |
1628 | --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |
1629 | +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h |
1630 | @@ -1348,6 +1348,7 @@ struct rtl8xxxu_fileops { |
1631 | u8 has_s0s1:1; |
1632 | u8 has_tx_report:1; |
1633 | u8 gen2_thermal_meter:1; |
1634 | + u8 needs_full_init:1; |
1635 | u32 adda_1t_init; |
1636 | u32 adda_1t_path_on; |
1637 | u32 adda_2t_path_on_a; |
1638 | diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c |
1639 | index 02b8ddd98a95..f51ee88d692b 100644 |
1640 | --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c |
1641 | +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c |
1642 | @@ -1673,6 +1673,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = { |
1643 | .has_s0s1 = 1, |
1644 | .has_tx_report = 1, |
1645 | .gen2_thermal_meter = 1, |
1646 | + .needs_full_init = 1, |
1647 | .adda_1t_init = 0x01c00014, |
1648 | .adda_1t_path_on = 0x01c00014, |
1649 | .adda_2t_path_on_a = 0x01c00014, |
1650 | diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1651 | index e78545d4add3..6d34d442294a 100644 |
1652 | --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1653 | +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |
1654 | @@ -3905,6 +3905,9 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) |
1655 | else |
1656 | macpower = true; |
1657 | |
1658 | + if (fops->needs_full_init) |
1659 | + macpower = false; |
1660 | + |
1661 | ret = fops->power_on(priv); |
1662 | if (ret < 0) { |
1663 | dev_warn(dev, "%s: Failed power on\n", __func__); |
1664 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1665 | index ae8f055483fa..39a6bd314ca3 100644 |
1666 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1667 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1668 | @@ -1576,6 +1576,8 @@ static bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb) |
1669 | * This is maybe necessary: |
1670 | * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb); |
1671 | */ |
1672 | + dev_kfree_skb(skb); |
1673 | + |
1674 | return true; |
1675 | } |
1676 | |
1677 | diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c |
1678 | index ae0c48f3c2bc..1f02461de261 100644 |
1679 | --- a/drivers/net/wireless/realtek/rtlwifi/usb.c |
1680 | +++ b/drivers/net/wireless/realtek/rtlwifi/usb.c |
1681 | @@ -1088,8 +1088,10 @@ int rtl_usb_probe(struct usb_interface *intf, |
1682 | rtlpriv->hw = hw; |
1683 | rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), |
1684 | GFP_KERNEL); |
1685 | - if (!rtlpriv->usb_data) |
1686 | + if (!rtlpriv->usb_data) { |
1687 | + ieee80211_free_hw(hw); |
1688 | return -ENOMEM; |
1689 | + } |
1690 | |
1691 | /* this spin lock must be initialized early */ |
1692 | spin_lock_init(&rtlpriv->locks.usb_lock); |
1693 | @@ -1152,6 +1154,7 @@ error_out: |
1694 | _rtl_usb_io_handler_release(hw); |
1695 | usb_put_dev(udev); |
1696 | complete(&rtlpriv->firmware_loading_complete); |
1697 | + kfree(rtlpriv->usb_data); |
1698 | return -ENODEV; |
1699 | } |
1700 | EXPORT_SYMBOL(rtl_usb_probe); |
1701 | diff --git a/drivers/parport/share.c b/drivers/parport/share.c |
1702 | index daa2eb3050df..a7ceed7182ac 100644 |
1703 | --- a/drivers/parport/share.c |
1704 | +++ b/drivers/parport/share.c |
1705 | @@ -230,6 +230,18 @@ static int port_check(struct device *dev, void *dev_drv) |
1706 | return 0; |
1707 | } |
1708 | |
1709 | +/* |
1710 | + * Iterates through all the devices connected to the bus and return 1 |
1711 | + * if the device is a parallel port. |
1712 | + */ |
1713 | + |
1714 | +static int port_detect(struct device *dev, void *dev_drv) |
1715 | +{ |
1716 | + if (is_parport(dev)) |
1717 | + return 1; |
1718 | + return 0; |
1719 | +} |
1720 | + |
1721 | /** |
1722 | * parport_register_driver - register a parallel port device driver |
1723 | * @drv: structure describing the driver |
1724 | @@ -282,6 +294,15 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner, |
1725 | if (ret) |
1726 | return ret; |
1727 | |
1728 | + /* |
1729 | + * check if bus has any parallel port registered, if |
1730 | + * none is found then load the lowlevel driver. |
1731 | + */ |
1732 | + ret = bus_for_each_dev(&parport_bus_type, NULL, NULL, |
1733 | + port_detect); |
1734 | + if (!ret) |
1735 | + get_lowlevel_driver(); |
1736 | + |
1737 | mutex_lock(®istration_lock); |
1738 | if (drv->match_port) |
1739 | bus_for_each_dev(&parport_bus_type, NULL, drv, |
1740 | diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c |
1741 | index fc5b18d3db20..f83a2a60d9c9 100644 |
1742 | --- a/drivers/pinctrl/intel/pinctrl-baytrail.c |
1743 | +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c |
1744 | @@ -204,7 +204,6 @@ struct byt_gpio { |
1745 | struct platform_device *pdev; |
1746 | struct pinctrl_dev *pctl_dev; |
1747 | struct pinctrl_desc pctl_desc; |
1748 | - raw_spinlock_t lock; |
1749 | const struct byt_pinctrl_soc_data *soc_data; |
1750 | struct byt_community *communities_copy; |
1751 | struct byt_gpio_pin_context *saved_context; |
1752 | @@ -715,6 +714,8 @@ static const struct byt_pinctrl_soc_data *byt_soc_data[] = { |
1753 | NULL, |
1754 | }; |
1755 | |
1756 | +static DEFINE_RAW_SPINLOCK(byt_lock); |
1757 | + |
1758 | static struct byt_community *byt_get_community(struct byt_gpio *vg, |
1759 | unsigned int pin) |
1760 | { |
1761 | @@ -856,7 +857,7 @@ static void byt_set_group_simple_mux(struct byt_gpio *vg, |
1762 | unsigned long flags; |
1763 | int i; |
1764 | |
1765 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1766 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1767 | |
1768 | for (i = 0; i < group.npins; i++) { |
1769 | void __iomem *padcfg0; |
1770 | @@ -876,7 +877,7 @@ static void byt_set_group_simple_mux(struct byt_gpio *vg, |
1771 | writel(value, padcfg0); |
1772 | } |
1773 | |
1774 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1775 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1776 | } |
1777 | |
1778 | static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
1779 | @@ -886,7 +887,7 @@ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
1780 | unsigned long flags; |
1781 | int i; |
1782 | |
1783 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1784 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1785 | |
1786 | for (i = 0; i < group.npins; i++) { |
1787 | void __iomem *padcfg0; |
1788 | @@ -906,7 +907,7 @@ static void byt_set_group_mixed_mux(struct byt_gpio *vg, |
1789 | writel(value, padcfg0); |
1790 | } |
1791 | |
1792 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1793 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1794 | } |
1795 | |
1796 | static int byt_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector, |
1797 | @@ -955,11 +956,11 @@ static void byt_gpio_clear_triggering(struct byt_gpio *vg, unsigned int offset) |
1798 | unsigned long flags; |
1799 | u32 value; |
1800 | |
1801 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1802 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1803 | value = readl(reg); |
1804 | value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); |
1805 | writel(value, reg); |
1806 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1807 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1808 | } |
1809 | |
1810 | static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
1811 | @@ -971,7 +972,7 @@ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
1812 | u32 value, gpio_mux; |
1813 | unsigned long flags; |
1814 | |
1815 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1816 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1817 | |
1818 | /* |
1819 | * In most cases, func pin mux 000 means GPIO function. |
1820 | @@ -993,7 +994,7 @@ static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev, |
1821 | "pin %u forcibly re-configured as GPIO\n", offset); |
1822 | } |
1823 | |
1824 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1825 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1826 | |
1827 | pm_runtime_get(&vg->pdev->dev); |
1828 | |
1829 | @@ -1021,7 +1022,7 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
1830 | unsigned long flags; |
1831 | u32 value; |
1832 | |
1833 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1834 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1835 | |
1836 | value = readl(val_reg); |
1837 | value &= ~BYT_DIR_MASK; |
1838 | @@ -1038,7 +1039,7 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
1839 | "Potential Error: Setting GPIO with direct_irq_en to output"); |
1840 | writel(value, val_reg); |
1841 | |
1842 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1843 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1844 | |
1845 | return 0; |
1846 | } |
1847 | @@ -1107,11 +1108,11 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset, |
1848 | u32 conf, pull, val, debounce; |
1849 | u16 arg = 0; |
1850 | |
1851 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1852 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1853 | conf = readl(conf_reg); |
1854 | pull = conf & BYT_PULL_ASSIGN_MASK; |
1855 | val = readl(val_reg); |
1856 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1857 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1858 | |
1859 | switch (param) { |
1860 | case PIN_CONFIG_BIAS_DISABLE: |
1861 | @@ -1138,9 +1139,9 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset, |
1862 | if (!(conf & BYT_DEBOUNCE_EN)) |
1863 | return -EINVAL; |
1864 | |
1865 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1866 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1867 | debounce = readl(db_reg); |
1868 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1869 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1870 | |
1871 | switch (debounce & BYT_DEBOUNCE_PULSE_MASK) { |
1872 | case BYT_DEBOUNCE_PULSE_375US: |
1873 | @@ -1192,7 +1193,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
1874 | u32 conf, val, debounce; |
1875 | int i, ret = 0; |
1876 | |
1877 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1878 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1879 | |
1880 | conf = readl(conf_reg); |
1881 | val = readl(val_reg); |
1882 | @@ -1300,7 +1301,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, |
1883 | if (!ret) |
1884 | writel(conf, conf_reg); |
1885 | |
1886 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1887 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1888 | |
1889 | return ret; |
1890 | } |
1891 | @@ -1325,9 +1326,9 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned offset) |
1892 | unsigned long flags; |
1893 | u32 val; |
1894 | |
1895 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1896 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1897 | val = readl(reg); |
1898 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1899 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1900 | |
1901 | return !!(val & BYT_LEVEL); |
1902 | } |
1903 | @@ -1342,13 +1343,13 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
1904 | if (!reg) |
1905 | return; |
1906 | |
1907 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1908 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1909 | old_val = readl(reg); |
1910 | if (value) |
1911 | writel(old_val | BYT_LEVEL, reg); |
1912 | else |
1913 | writel(old_val & ~BYT_LEVEL, reg); |
1914 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1915 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1916 | } |
1917 | |
1918 | static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) |
1919 | @@ -1361,9 +1362,9 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) |
1920 | if (!reg) |
1921 | return -EINVAL; |
1922 | |
1923 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1924 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1925 | value = readl(reg); |
1926 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1927 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1928 | |
1929 | if (!(value & BYT_OUTPUT_EN)) |
1930 | return GPIOF_DIR_OUT; |
1931 | @@ -1406,14 +1407,14 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
1932 | const char *label; |
1933 | unsigned int pin; |
1934 | |
1935 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1936 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1937 | pin = vg->soc_data->pins[i].number; |
1938 | reg = byt_gpio_reg(vg, pin, BYT_CONF0_REG); |
1939 | if (!reg) { |
1940 | seq_printf(s, |
1941 | "Could not retrieve pin %i conf0 reg\n", |
1942 | pin); |
1943 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1944 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1945 | continue; |
1946 | } |
1947 | conf0 = readl(reg); |
1948 | @@ -1422,11 +1423,11 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
1949 | if (!reg) { |
1950 | seq_printf(s, |
1951 | "Could not retrieve pin %i val reg\n", pin); |
1952 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1953 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1954 | continue; |
1955 | } |
1956 | val = readl(reg); |
1957 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1958 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1959 | |
1960 | comm = byt_get_community(vg, pin); |
1961 | if (!comm) { |
1962 | @@ -1510,9 +1511,9 @@ static void byt_irq_ack(struct irq_data *d) |
1963 | if (!reg) |
1964 | return; |
1965 | |
1966 | - raw_spin_lock(&vg->lock); |
1967 | + raw_spin_lock(&byt_lock); |
1968 | writel(BIT(offset % 32), reg); |
1969 | - raw_spin_unlock(&vg->lock); |
1970 | + raw_spin_unlock(&byt_lock); |
1971 | } |
1972 | |
1973 | static void byt_irq_mask(struct irq_data *d) |
1974 | @@ -1536,7 +1537,7 @@ static void byt_irq_unmask(struct irq_data *d) |
1975 | if (!reg) |
1976 | return; |
1977 | |
1978 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1979 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1980 | value = readl(reg); |
1981 | |
1982 | switch (irqd_get_trigger_type(d)) { |
1983 | @@ -1557,7 +1558,7 @@ static void byt_irq_unmask(struct irq_data *d) |
1984 | |
1985 | writel(value, reg); |
1986 | |
1987 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
1988 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
1989 | } |
1990 | |
1991 | static int byt_irq_type(struct irq_data *d, unsigned int type) |
1992 | @@ -1571,7 +1572,7 @@ static int byt_irq_type(struct irq_data *d, unsigned int type) |
1993 | if (!reg || offset >= vg->chip.ngpio) |
1994 | return -EINVAL; |
1995 | |
1996 | - raw_spin_lock_irqsave(&vg->lock, flags); |
1997 | + raw_spin_lock_irqsave(&byt_lock, flags); |
1998 | value = readl(reg); |
1999 | |
2000 | WARN(value & BYT_DIRECT_IRQ_EN, |
2001 | @@ -1593,7 +1594,7 @@ static int byt_irq_type(struct irq_data *d, unsigned int type) |
2002 | else if (type & IRQ_TYPE_LEVEL_MASK) |
2003 | irq_set_handler_locked(d, handle_level_irq); |
2004 | |
2005 | - raw_spin_unlock_irqrestore(&vg->lock, flags); |
2006 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
2007 | |
2008 | return 0; |
2009 | } |
2010 | @@ -1629,9 +1630,9 @@ static void byt_gpio_irq_handler(struct irq_desc *desc) |
2011 | continue; |
2012 | } |
2013 | |
2014 | - raw_spin_lock(&vg->lock); |
2015 | + raw_spin_lock(&byt_lock); |
2016 | pending = readl(reg); |
2017 | - raw_spin_unlock(&vg->lock); |
2018 | + raw_spin_unlock(&byt_lock); |
2019 | for_each_set_bit(pin, &pending, 32) { |
2020 | virq = irq_find_mapping(vg->chip.irqdomain, base + pin); |
2021 | generic_handle_irq(virq); |
2022 | @@ -1833,8 +1834,6 @@ static int byt_pinctrl_probe(struct platform_device *pdev) |
2023 | return PTR_ERR(vg->pctl_dev); |
2024 | } |
2025 | |
2026 | - raw_spin_lock_init(&vg->lock); |
2027 | - |
2028 | ret = byt_gpio_probe(vg); |
2029 | if (ret) { |
2030 | pinctrl_unregister(vg->pctl_dev); |
2031 | @@ -1852,8 +1851,11 @@ static int byt_gpio_suspend(struct device *dev) |
2032 | { |
2033 | struct platform_device *pdev = to_platform_device(dev); |
2034 | struct byt_gpio *vg = platform_get_drvdata(pdev); |
2035 | + unsigned long flags; |
2036 | int i; |
2037 | |
2038 | + raw_spin_lock_irqsave(&byt_lock, flags); |
2039 | + |
2040 | for (i = 0; i < vg->soc_data->npins; i++) { |
2041 | void __iomem *reg; |
2042 | u32 value; |
2043 | @@ -1874,6 +1876,7 @@ static int byt_gpio_suspend(struct device *dev) |
2044 | vg->saved_context[i].val = value; |
2045 | } |
2046 | |
2047 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
2048 | return 0; |
2049 | } |
2050 | |
2051 | @@ -1881,8 +1884,11 @@ static int byt_gpio_resume(struct device *dev) |
2052 | { |
2053 | struct platform_device *pdev = to_platform_device(dev); |
2054 | struct byt_gpio *vg = platform_get_drvdata(pdev); |
2055 | + unsigned long flags; |
2056 | int i; |
2057 | |
2058 | + raw_spin_lock_irqsave(&byt_lock, flags); |
2059 | + |
2060 | for (i = 0; i < vg->soc_data->npins; i++) { |
2061 | void __iomem *reg; |
2062 | u32 value; |
2063 | @@ -1920,6 +1926,7 @@ static int byt_gpio_resume(struct device *dev) |
2064 | } |
2065 | } |
2066 | |
2067 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
2068 | return 0; |
2069 | } |
2070 | #endif |
2071 | diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
2072 | index 33232041ee86..3eccc9b3ca84 100644 |
2073 | --- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
2074 | +++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
2075 | @@ -1453,7 +1453,7 @@ static const struct pinmux_func pinmux_func_gpios[] = { |
2076 | GPIO_FN(ET0_ETXD2_A), |
2077 | GPIO_FN(EX_CS5), GPIO_FN(SD1_CMD_A), GPIO_FN(ATADIR), GPIO_FN(QSSL_B), |
2078 | GPIO_FN(ET0_ETXD3_A), |
2079 | - GPIO_FN(RD_WR), GPIO_FN(TCLK1_B), |
2080 | + GPIO_FN(RD_WR), GPIO_FN(TCLK0), GPIO_FN(CAN_CLK_B), GPIO_FN(ET0_ETXD4), |
2081 | GPIO_FN(EX_WAIT0), GPIO_FN(TCLK1_B), |
2082 | GPIO_FN(EX_WAIT1), GPIO_FN(SD1_DAT0_A), GPIO_FN(DREQ2), |
2083 | GPIO_FN(CAN1_TX_C), GPIO_FN(ET0_LINK_C), GPIO_FN(ET0_ETXD5_A), |
2084 | @@ -1949,7 +1949,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
2085 | /* IP3_20 [1] */ |
2086 | FN_EX_WAIT0, FN_TCLK1_B, |
2087 | /* IP3_19_18 [2] */ |
2088 | - FN_RD_WR, FN_TCLK1_B, 0, 0, |
2089 | + FN_RD_WR, FN_TCLK0, FN_CAN_CLK_B, FN_ET0_ETXD4, |
2090 | /* IP3_17_15 [3] */ |
2091 | FN_EX_CS5, FN_SD1_CMD_A, FN_ATADIR, FN_QSSL_B, |
2092 | FN_ET0_ETXD3_A, 0, 0, 0, |
2093 | diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c |
2094 | index 05dc16b477f0..f065529390fe 100644 |
2095 | --- a/drivers/platform/x86/hp-wmi.c |
2096 | +++ b/drivers/platform/x86/hp-wmi.c |
2097 | @@ -308,7 +308,7 @@ static int __init hp_wmi_bios_2008_later(void) |
2098 | |
2099 | static int __init hp_wmi_bios_2009_later(void) |
2100 | { |
2101 | - int state = 0; |
2102 | + u8 state[128]; |
2103 | int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, 0, &state, |
2104 | sizeof(state), sizeof(state)); |
2105 | if (!ret) |
2106 | diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c |
2107 | index 5e941db5ccaf..c7e70cfb581f 100644 |
2108 | --- a/drivers/regulator/max8907-regulator.c |
2109 | +++ b/drivers/regulator/max8907-regulator.c |
2110 | @@ -299,7 +299,10 @@ static int max8907_regulator_probe(struct platform_device *pdev) |
2111 | memcpy(pmic->desc, max8907_regulators, sizeof(pmic->desc)); |
2112 | |
2113 | /* Backwards compatibility with MAX8907B; SD1 uses different voltages */ |
2114 | - regmap_read(max8907->regmap_gen, MAX8907_REG_II2RR, &val); |
2115 | + ret = regmap_read(max8907->regmap_gen, MAX8907_REG_II2RR, &val); |
2116 | + if (ret) |
2117 | + return ret; |
2118 | + |
2119 | if ((val & MAX8907_II2RR_VERSION_MASK) == |
2120 | MAX8907_II2RR_VERSION_REV_B) { |
2121 | pmic->desc[MAX8907_SD1].min_uV = 637500; |
2122 | @@ -336,14 +339,20 @@ static int max8907_regulator_probe(struct platform_device *pdev) |
2123 | } |
2124 | |
2125 | if (pmic->desc[i].ops == &max8907_ldo_ops) { |
2126 | - regmap_read(config.regmap, pmic->desc[i].enable_reg, |
2127 | + ret = regmap_read(config.regmap, pmic->desc[i].enable_reg, |
2128 | &val); |
2129 | + if (ret) |
2130 | + return ret; |
2131 | + |
2132 | if ((val & MAX8907_MASK_LDO_SEQ) != |
2133 | MAX8907_MASK_LDO_SEQ) |
2134 | pmic->desc[i].ops = &max8907_ldo_hwctl_ops; |
2135 | } else if (pmic->desc[i].ops == &max8907_out5v_ops) { |
2136 | - regmap_read(config.regmap, pmic->desc[i].enable_reg, |
2137 | + ret = regmap_read(config.regmap, pmic->desc[i].enable_reg, |
2138 | &val); |
2139 | + if (ret) |
2140 | + return ret; |
2141 | + |
2142 | if ((val & (MAX8907_MASK_OUT5V_VINEN | |
2143 | MAX8907_MASK_OUT5V_ENSRC)) != |
2144 | MAX8907_MASK_OUT5V_ENSRC) |
2145 | diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c |
2146 | index a59ad94ea52b..9dc4b689f94b 100644 |
2147 | --- a/drivers/scsi/atari_scsi.c |
2148 | +++ b/drivers/scsi/atari_scsi.c |
2149 | @@ -753,7 +753,7 @@ static int __init atari_scsi_probe(struct platform_device *pdev) |
2150 | atari_scsi_template.sg_tablesize = SG_ALL; |
2151 | } else { |
2152 | atari_scsi_template.can_queue = 1; |
2153 | - atari_scsi_template.sg_tablesize = SG_NONE; |
2154 | + atari_scsi_template.sg_tablesize = 1; |
2155 | } |
2156 | |
2157 | if (setup_can_queue > 0) |
2158 | @@ -762,8 +762,8 @@ static int __init atari_scsi_probe(struct platform_device *pdev) |
2159 | if (setup_cmd_per_lun > 0) |
2160 | atari_scsi_template.cmd_per_lun = setup_cmd_per_lun; |
2161 | |
2162 | - /* Leave sg_tablesize at 0 on a Falcon! */ |
2163 | - if (ATARIHW_PRESENT(TT_SCSI) && setup_sg_tablesize >= 0) |
2164 | + /* Don't increase sg_tablesize on Falcon! */ |
2165 | + if (ATARIHW_PRESENT(TT_SCSI) && setup_sg_tablesize > 0) |
2166 | atari_scsi_template.sg_tablesize = setup_sg_tablesize; |
2167 | |
2168 | if (setup_hostid >= 0) { |
2169 | diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c |
2170 | index be5ee2d37815..957767d38361 100644 |
2171 | --- a/drivers/scsi/csiostor/csio_lnode.c |
2172 | +++ b/drivers/scsi/csiostor/csio_lnode.c |
2173 | @@ -301,6 +301,7 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
2174 | struct fc_fdmi_port_name *port_name; |
2175 | uint8_t buf[64]; |
2176 | uint8_t *fc4_type; |
2177 | + unsigned long flags; |
2178 | |
2179 | if (fdmi_req->wr_status != FW_SUCCESS) { |
2180 | csio_ln_dbg(ln, "WR error:%x in processing fdmi rhba cmd\n", |
2181 | @@ -377,13 +378,13 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
2182 | len = (uint32_t)(pld - (uint8_t *)cmd); |
2183 | |
2184 | /* Submit FDMI RPA request */ |
2185 | - spin_lock_irq(&hw->lock); |
2186 | + spin_lock_irqsave(&hw->lock, flags); |
2187 | if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_done, |
2188 | FCOE_CT, &fdmi_req->dma_buf, len)) { |
2189 | CSIO_INC_STATS(ln, n_fdmi_err); |
2190 | csio_ln_dbg(ln, "Failed to issue fdmi rpa req\n"); |
2191 | } |
2192 | - spin_unlock_irq(&hw->lock); |
2193 | + spin_unlock_irqrestore(&hw->lock, flags); |
2194 | } |
2195 | |
2196 | /* |
2197 | @@ -404,6 +405,7 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
2198 | struct fc_fdmi_rpl *reg_pl; |
2199 | struct fs_fdmi_attrs *attrib_blk; |
2200 | uint8_t buf[64]; |
2201 | + unsigned long flags; |
2202 | |
2203 | if (fdmi_req->wr_status != FW_SUCCESS) { |
2204 | csio_ln_dbg(ln, "WR error:%x in processing fdmi dprt cmd\n", |
2205 | @@ -483,13 +485,13 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
2206 | attrib_blk->numattrs = htonl(numattrs); |
2207 | |
2208 | /* Submit FDMI RHBA request */ |
2209 | - spin_lock_irq(&hw->lock); |
2210 | + spin_lock_irqsave(&hw->lock, flags); |
2211 | if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_rhba_cbfn, |
2212 | FCOE_CT, &fdmi_req->dma_buf, len)) { |
2213 | CSIO_INC_STATS(ln, n_fdmi_err); |
2214 | csio_ln_dbg(ln, "Failed to issue fdmi rhba req\n"); |
2215 | } |
2216 | - spin_unlock_irq(&hw->lock); |
2217 | + spin_unlock_irqrestore(&hw->lock, flags); |
2218 | } |
2219 | |
2220 | /* |
2221 | @@ -504,6 +506,7 @@ csio_ln_fdmi_dhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
2222 | void *cmd; |
2223 | struct fc_fdmi_port_name *port_name; |
2224 | uint32_t len; |
2225 | + unsigned long flags; |
2226 | |
2227 | if (fdmi_req->wr_status != FW_SUCCESS) { |
2228 | csio_ln_dbg(ln, "WR error:%x in processing fdmi dhba cmd\n", |
2229 | @@ -534,13 +537,13 @@ csio_ln_fdmi_dhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
2230 | len += sizeof(*port_name); |
2231 | |
2232 | /* Submit FDMI request */ |
2233 | - spin_lock_irq(&hw->lock); |
2234 | + spin_lock_irqsave(&hw->lock, flags); |
2235 | if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_dprt_cbfn, |
2236 | FCOE_CT, &fdmi_req->dma_buf, len)) { |
2237 | CSIO_INC_STATS(ln, n_fdmi_err); |
2238 | csio_ln_dbg(ln, "Failed to issue fdmi dprt req\n"); |
2239 | } |
2240 | - spin_unlock_irq(&hw->lock); |
2241 | + spin_unlock_irqrestore(&hw->lock, flags); |
2242 | } |
2243 | |
2244 | /** |
2245 | diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
2246 | index 3702497b5b16..4901bf24916b 100644 |
2247 | --- a/drivers/scsi/lpfc/lpfc_els.c |
2248 | +++ b/drivers/scsi/lpfc/lpfc_els.c |
2249 | @@ -3863,7 +3863,7 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
2250 | mempool_free(mbox, phba->mbox_mem_pool); |
2251 | } |
2252 | out: |
2253 | - if (ndlp && NLP_CHK_NODE_ACT(ndlp)) { |
2254 | + if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) { |
2255 | spin_lock_irq(shost->host_lock); |
2256 | ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI); |
2257 | spin_unlock_irq(shost->host_lock); |
2258 | diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c |
2259 | index 21ec7b5b6c85..fefef2884d59 100644 |
2260 | --- a/drivers/scsi/lpfc/lpfc_nportdisc.c |
2261 | +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c |
2262 | @@ -454,8 +454,10 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
2263 | * single discovery thread, this will cause a huge delay in |
2264 | * discovery. Also this will cause multiple state machines |
2265 | * running in parallel for this node. |
2266 | + * This only applies to a fabric environment. |
2267 | */ |
2268 | - if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) { |
2269 | + if ((ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) && |
2270 | + (vport->fc_flag & FC_FABRIC)) { |
2271 | /* software abort outstanding PLOGI */ |
2272 | lpfc_els_abort(phba, ndlp); |
2273 | } |
2274 | diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
2275 | index e1e0feb25003..cbe808e83f47 100644 |
2276 | --- a/drivers/scsi/lpfc/lpfc_sli.c |
2277 | +++ b/drivers/scsi/lpfc/lpfc_sli.c |
2278 | @@ -11962,13 +11962,19 @@ send_current_mbox: |
2279 | phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; |
2280 | /* Setting active mailbox pointer need to be in sync to flag clear */ |
2281 | phba->sli.mbox_active = NULL; |
2282 | + if (bf_get(lpfc_trailer_consumed, mcqe)) |
2283 | + lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); |
2284 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
2285 | /* Wake up worker thread to post the next pending mailbox command */ |
2286 | lpfc_worker_wake_up(phba); |
2287 | + return workposted; |
2288 | + |
2289 | out_no_mqe_complete: |
2290 | + spin_lock_irqsave(&phba->hbalock, iflags); |
2291 | if (bf_get(lpfc_trailer_consumed, mcqe)) |
2292 | lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); |
2293 | - return workposted; |
2294 | + spin_unlock_irqrestore(&phba->hbalock, iflags); |
2295 | + return false; |
2296 | } |
2297 | |
2298 | /** |
2299 | @@ -15989,6 +15995,13 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phba) |
2300 | static void |
2301 | __lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) |
2302 | { |
2303 | + /* |
2304 | + * if the rpi value indicates a prior unreg has already |
2305 | + * been done, skip the unreg. |
2306 | + */ |
2307 | + if (rpi == LPFC_RPI_ALLOC_ERROR) |
2308 | + return; |
2309 | + |
2310 | if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) { |
2311 | phba->sli4_hba.rpi_count--; |
2312 | phba->sli4_hba.max_cfg_param.rpi_used--; |
2313 | diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c |
2314 | index 5648d30c7376..5aa60bbbd09a 100644 |
2315 | --- a/drivers/scsi/mac_scsi.c |
2316 | +++ b/drivers/scsi/mac_scsi.c |
2317 | @@ -378,7 +378,7 @@ static int __init mac_scsi_probe(struct platform_device *pdev) |
2318 | mac_scsi_template.can_queue = setup_can_queue; |
2319 | if (setup_cmd_per_lun > 0) |
2320 | mac_scsi_template.cmd_per_lun = setup_cmd_per_lun; |
2321 | - if (setup_sg_tablesize >= 0) |
2322 | + if (setup_sg_tablesize > 0) |
2323 | mac_scsi_template.sg_tablesize = setup_sg_tablesize; |
2324 | if (setup_hostid >= 0) |
2325 | mac_scsi_template.this_id = setup_hostid & 7; |
2326 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
2327 | index 26cdc127ac89..90a87e59ff60 100644 |
2328 | --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
2329 | +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
2330 | @@ -1465,7 +1465,8 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, |
2331 | " for diag buffers, requested size(%d)\n", |
2332 | ioc->name, __func__, request_data_sz); |
2333 | mpt3sas_base_free_smid(ioc, smid); |
2334 | - return -ENOMEM; |
2335 | + rc = -ENOMEM; |
2336 | + goto out; |
2337 | } |
2338 | ioc->diag_buffer[buffer_type] = request_data; |
2339 | ioc->diag_buffer_sz[buffer_type] = request_data_sz; |
2340 | diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
2341 | index 9edd61c063a1..df5f0bc29587 100644 |
2342 | --- a/drivers/scsi/pm8001/pm80xx_hwi.c |
2343 | +++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
2344 | @@ -2368,6 +2368,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
2345 | pm8001_printk("task 0x%p done with io_status 0x%x" |
2346 | " resp 0x%x stat 0x%x but aborted by upper layer!\n", |
2347 | t, status, ts->resp, ts->stat)); |
2348 | + if (t->slow_task) |
2349 | + complete(&t->slow_task->completion); |
2350 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2351 | } else { |
2352 | spin_unlock_irqrestore(&t->task_state_lock, flags); |
2353 | diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
2354 | index 2b0e61557317..d7118d3767c3 100644 |
2355 | --- a/drivers/scsi/scsi_debug.c |
2356 | +++ b/drivers/scsi/scsi_debug.c |
2357 | @@ -4953,6 +4953,11 @@ static int __init scsi_debug_init(void) |
2358 | return -EINVAL; |
2359 | } |
2360 | |
2361 | + if (sdebug_num_tgts < 0) { |
2362 | + pr_err("num_tgts must be >= 0\n"); |
2363 | + return -EINVAL; |
2364 | + } |
2365 | + |
2366 | if (sdebug_guard > 1) { |
2367 | pr_err("guard must be 0 or 1\n"); |
2368 | return -EINVAL; |
2369 | diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c |
2370 | index 0ff083bbf5b1..617a60737590 100644 |
2371 | --- a/drivers/scsi/scsi_trace.c |
2372 | +++ b/drivers/scsi/scsi_trace.c |
2373 | @@ -30,15 +30,18 @@ static const char * |
2374 | scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb, int len) |
2375 | { |
2376 | const char *ret = trace_seq_buffer_ptr(p); |
2377 | - sector_t lba = 0, txlen = 0; |
2378 | + u32 lba = 0, txlen; |
2379 | |
2380 | lba |= ((cdb[1] & 0x1F) << 16); |
2381 | lba |= (cdb[2] << 8); |
2382 | lba |= cdb[3]; |
2383 | - txlen = cdb[4]; |
2384 | + /* |
2385 | + * From SBC-2: a TRANSFER LENGTH field set to zero specifies that 256 |
2386 | + * logical blocks shall be read (READ(6)) or written (WRITE(6)). |
2387 | + */ |
2388 | + txlen = cdb[4] ? cdb[4] : 256; |
2389 | |
2390 | - trace_seq_printf(p, "lba=%llu txlen=%llu", |
2391 | - (unsigned long long)lba, (unsigned long long)txlen); |
2392 | + trace_seq_printf(p, "lba=%u txlen=%u", lba, txlen); |
2393 | trace_seq_putc(p, 0); |
2394 | |
2395 | return ret; |
2396 | diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c |
2397 | index 3c4c07038948..6f75693cf7d2 100644 |
2398 | --- a/drivers/scsi/sun3_scsi.c |
2399 | +++ b/drivers/scsi/sun3_scsi.c |
2400 | @@ -419,7 +419,7 @@ static struct scsi_host_template sun3_scsi_template = { |
2401 | .eh_bus_reset_handler = sun3scsi_bus_reset, |
2402 | .can_queue = 16, |
2403 | .this_id = 7, |
2404 | - .sg_tablesize = SG_NONE, |
2405 | + .sg_tablesize = 1, |
2406 | .cmd_per_lun = 2, |
2407 | .use_clustering = DISABLE_CLUSTERING, |
2408 | .cmd_size = NCR5380_CMD_SIZE, |
2409 | @@ -440,7 +440,7 @@ static int __init sun3_scsi_probe(struct platform_device *pdev) |
2410 | sun3_scsi_template.can_queue = setup_can_queue; |
2411 | if (setup_cmd_per_lun > 0) |
2412 | sun3_scsi_template.cmd_per_lun = setup_cmd_per_lun; |
2413 | - if (setup_sg_tablesize >= 0) |
2414 | + if (setup_sg_tablesize > 0) |
2415 | sun3_scsi_template.sg_tablesize = setup_sg_tablesize; |
2416 | if (setup_hostid >= 0) |
2417 | sun3_scsi_template.this_id = setup_hostid & 7; |
2418 | diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
2419 | index 26f259fb6e3c..094e879af121 100644 |
2420 | --- a/drivers/scsi/ufs/ufshcd.c |
2421 | +++ b/drivers/scsi/ufs/ufshcd.c |
2422 | @@ -2006,10 +2006,10 @@ static int __ufshcd_query_descriptor(struct ufs_hba *hba, |
2423 | goto out_unlock; |
2424 | } |
2425 | |
2426 | - hba->dev_cmd.query.descriptor = NULL; |
2427 | *buf_len = be16_to_cpu(response->upiu_res.length); |
2428 | |
2429 | out_unlock: |
2430 | + hba->dev_cmd.query.descriptor = NULL; |
2431 | mutex_unlock(&hba->dev_cmd.lock); |
2432 | out: |
2433 | ufshcd_release(hba); |
2434 | diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c |
2435 | index 7a37090dabbe..2e65b70c7879 100644 |
2436 | --- a/drivers/spi/spi-img-spfi.c |
2437 | +++ b/drivers/spi/spi-img-spfi.c |
2438 | @@ -673,6 +673,8 @@ static int img_spfi_probe(struct platform_device *pdev) |
2439 | dma_release_channel(spfi->tx_ch); |
2440 | if (spfi->rx_ch) |
2441 | dma_release_channel(spfi->rx_ch); |
2442 | + spfi->tx_ch = NULL; |
2443 | + spfi->rx_ch = NULL; |
2444 | dev_warn(spfi->dev, "Failed to get DMA channels, falling back to PIO mode\n"); |
2445 | } else { |
2446 | master->dma_tx = spfi->tx_ch; |
2447 | diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
2448 | index 6dd195b94c57..2f84d7653afd 100644 |
2449 | --- a/drivers/spi/spi-pxa2xx.c |
2450 | +++ b/drivers/spi/spi-pxa2xx.c |
2451 | @@ -1529,7 +1529,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) |
2452 | } |
2453 | |
2454 | ssp->clk = devm_clk_get(&pdev->dev, NULL); |
2455 | + if (IS_ERR(ssp->clk)) |
2456 | + return NULL; |
2457 | + |
2458 | ssp->irq = platform_get_irq(pdev, 0); |
2459 | + if (ssp->irq < 0) |
2460 | + return NULL; |
2461 | + |
2462 | ssp->type = type; |
2463 | ssp->pdev = pdev; |
2464 | ssp->port_id = pxa2xx_spi_get_port_id(adev); |
2465 | diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c |
2466 | index e54b59638458..710adbc2485f 100644 |
2467 | --- a/drivers/spi/spi-st-ssc4.c |
2468 | +++ b/drivers/spi/spi-st-ssc4.c |
2469 | @@ -385,6 +385,7 @@ static int spi_st_probe(struct platform_device *pdev) |
2470 | return 0; |
2471 | |
2472 | clk_disable: |
2473 | + pm_runtime_disable(&pdev->dev); |
2474 | clk_disable_unprepare(spi_st->clk); |
2475 | put_master: |
2476 | spi_master_put(master); |
2477 | @@ -396,6 +397,8 @@ static int spi_st_remove(struct platform_device *pdev) |
2478 | struct spi_master *master = platform_get_drvdata(pdev); |
2479 | struct spi_st *spi_st = spi_master_get_devdata(master); |
2480 | |
2481 | + pm_runtime_disable(&pdev->dev); |
2482 | + |
2483 | clk_disable_unprepare(spi_st->clk); |
2484 | |
2485 | pinctrl_pm_select_sleep_state(&pdev->dev); |
2486 | diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
2487 | index af2880d0c112..cf2a329fd895 100644 |
2488 | --- a/drivers/spi/spi-tegra20-slink.c |
2489 | +++ b/drivers/spi/spi-tegra20-slink.c |
2490 | @@ -1078,7 +1078,7 @@ static int tegra_slink_probe(struct platform_device *pdev) |
2491 | ret = clk_enable(tspi->clk); |
2492 | if (ret < 0) { |
2493 | dev_err(&pdev->dev, "Clock enable failed %d\n", ret); |
2494 | - goto exit_free_master; |
2495 | + goto exit_clk_unprepare; |
2496 | } |
2497 | |
2498 | spi_irq = platform_get_irq(pdev, 0); |
2499 | @@ -1151,6 +1151,8 @@ exit_free_irq: |
2500 | free_irq(spi_irq, tspi); |
2501 | exit_clk_disable: |
2502 | clk_disable(tspi->clk); |
2503 | +exit_clk_unprepare: |
2504 | + clk_unprepare(tspi->clk); |
2505 | exit_free_master: |
2506 | spi_master_put(master); |
2507 | return ret; |
2508 | @@ -1164,6 +1166,7 @@ static int tegra_slink_remove(struct platform_device *pdev) |
2509 | free_irq(tspi->irq, tspi); |
2510 | |
2511 | clk_disable(tspi->clk); |
2512 | + clk_unprepare(tspi->clk); |
2513 | |
2514 | if (tspi->tx_dma_chan) |
2515 | tegra_slink_deinit_dma_param(tspi, false); |
2516 | diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
2517 | index f4ea286b0121..a685c6114a8d 100644 |
2518 | --- a/drivers/spi/spidev.c |
2519 | +++ b/drivers/spi/spidev.c |
2520 | @@ -663,6 +663,9 @@ static int spidev_release(struct inode *inode, struct file *filp) |
2521 | if (dofree) |
2522 | kfree(spidev); |
2523 | } |
2524 | +#ifdef CONFIG_SPI_SLAVE |
2525 | + spi_slave_abort(spidev->spi); |
2526 | +#endif |
2527 | mutex_unlock(&device_list_lock); |
2528 | |
2529 | return 0; |
2530 | diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c |
2531 | index e5b948405fd9..a09631f9d813 100644 |
2532 | --- a/drivers/staging/comedi/drivers/gsc_hpdi.c |
2533 | +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c |
2534 | @@ -632,6 +632,11 @@ static int gsc_hpdi_auto_attach(struct comedi_device *dev, |
2535 | dma_alloc_coherent(&pcidev->dev, DMA_BUFFER_SIZE, |
2536 | &devpriv->dio_buffer_phys_addr[i], |
2537 | GFP_KERNEL); |
2538 | + if (!devpriv->dio_buffer[i]) { |
2539 | + dev_warn(dev->class_dev, |
2540 | + "failed to allocate DMA buffer\n"); |
2541 | + return -ENOMEM; |
2542 | + } |
2543 | } |
2544 | /* allocate dma descriptors */ |
2545 | devpriv->dma_desc = dma_alloc_coherent(&pcidev->dev, |
2546 | @@ -639,6 +644,11 @@ static int gsc_hpdi_auto_attach(struct comedi_device *dev, |
2547 | NUM_DMA_DESCRIPTORS, |
2548 | &devpriv->dma_desc_phys_addr, |
2549 | GFP_KERNEL); |
2550 | + if (!devpriv->dma_desc) { |
2551 | + dev_warn(dev->class_dev, |
2552 | + "failed to allocate DMA descriptors\n"); |
2553 | + return -ENOMEM; |
2554 | + } |
2555 | if (devpriv->dma_desc_phys_addr & 0xf) { |
2556 | dev_warn(dev->class_dev, |
2557 | " dma descriptors not quad-word aligned (bug)\n"); |
2558 | diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c |
2559 | index d9ba8c0f1353..ece713d02660 100644 |
2560 | --- a/drivers/staging/fbtft/fbtft-core.c |
2561 | +++ b/drivers/staging/fbtft/fbtft-core.c |
2562 | @@ -766,7 +766,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, |
2563 | fbdefio->deferred_io = fbtft_deferred_io; |
2564 | fb_deferred_io_init(info); |
2565 | |
2566 | - strncpy(info->fix.id, dev->driver->name, 16); |
2567 | + snprintf(info->fix.id, sizeof(info->fix.id), "%s", dev->driver->name); |
2568 | info->fix.type = FB_TYPE_PACKED_PIXELS; |
2569 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
2570 | info->fix.xpanstep = 0; |
2571 | diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
2572 | index 0f8b8e0bffdf..dedc313e9dea 100644 |
2573 | --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c |
2574 | +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
2575 | @@ -805,7 +805,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr |
2576 | memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN); |
2577 | memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN); |
2578 | |
2579 | - if (psta->qos_option) |
2580 | + if (psta && psta->qos_option) |
2581 | qos_option = true; |
2582 | } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || |
2583 | check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { |
2584 | @@ -813,7 +813,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr |
2585 | memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); |
2586 | memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); |
2587 | |
2588 | - if (psta->qos_option) |
2589 | + if (psta && psta->qos_option) |
2590 | qos_option = true; |
2591 | } else { |
2592 | RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x is not allowed to xmit frame\n", get_fwstate(pmlmepriv))); |
2593 | diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c |
2594 | index 5fe95937d811..6ec379056650 100644 |
2595 | --- a/drivers/staging/rtl8192u/r8192U_core.c |
2596 | +++ b/drivers/staging/rtl8192u/r8192U_core.c |
2597 | @@ -1509,7 +1509,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
2598 | (tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN); |
2599 | struct usb_device *udev = priv->udev; |
2600 | int pend; |
2601 | - int status; |
2602 | + int status, rt = -1; |
2603 | struct urb *tx_urb = NULL, *tx_urb_zero = NULL; |
2604 | unsigned int idx_pipe; |
2605 | |
2606 | @@ -1653,8 +1653,10 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
2607 | } |
2608 | if (bSend0Byte) { |
2609 | tx_urb_zero = usb_alloc_urb(0, GFP_ATOMIC); |
2610 | - if (!tx_urb_zero) |
2611 | - return -ENOMEM; |
2612 | + if (!tx_urb_zero) { |
2613 | + rt = -ENOMEM; |
2614 | + goto error; |
2615 | + } |
2616 | usb_fill_bulk_urb(tx_urb_zero, udev, |
2617 | usb_sndbulkpipe(udev, idx_pipe), |
2618 | &zero, 0, tx_zero_isr, dev); |
2619 | @@ -1664,7 +1666,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
2620 | "Error TX URB for zero byte %d, error %d", |
2621 | atomic_read(&priv->tx_pending[tcb_desc->queue_index]), |
2622 | status); |
2623 | - return -1; |
2624 | + goto error; |
2625 | } |
2626 | } |
2627 | netif_trans_update(dev); |
2628 | @@ -1675,7 +1677,12 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) |
2629 | RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", |
2630 | atomic_read(&priv->tx_pending[tcb_desc->queue_index]), |
2631 | status); |
2632 | - return -1; |
2633 | + |
2634 | +error: |
2635 | + dev_kfree_skb_any(skb); |
2636 | + usb_free_urb(tx_urb); |
2637 | + usb_free_urb(tx_urb_zero); |
2638 | + return rt; |
2639 | } |
2640 | |
2641 | static short rtl8192_usb_initendpoints(struct net_device *dev) |
2642 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
2643 | index b6c4f55f79e7..e5674e5857bf 100644 |
2644 | --- a/drivers/target/iscsi/iscsi_target.c |
2645 | +++ b/drivers/target/iscsi/iscsi_target.c |
2646 | @@ -1168,7 +1168,9 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
2647 | hdr->cmdsn, be32_to_cpu(hdr->data_length), payload_length, |
2648 | conn->cid); |
2649 | |
2650 | - target_get_sess_cmd(&cmd->se_cmd, true); |
2651 | + if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) |
2652 | + return iscsit_add_reject_cmd(cmd, |
2653 | + ISCSI_REASON_WAITING_FOR_LOGOUT, buf); |
2654 | |
2655 | cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd, |
2656 | scsilun_to_int(&hdr->lun)); |
2657 | @@ -1986,7 +1988,9 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
2658 | conn->sess->se_sess, 0, DMA_NONE, |
2659 | TCM_SIMPLE_TAG, cmd->sense_buffer + 2); |
2660 | |
2661 | - target_get_sess_cmd(&cmd->se_cmd, true); |
2662 | + if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) |
2663 | + return iscsit_add_reject_cmd(cmd, |
2664 | + ISCSI_REASON_WAITING_FOR_LOGOUT, buf); |
2665 | |
2666 | /* |
2667 | * TASK_REASSIGN for ERL=2 / connection stays inside of |
2668 | @@ -4243,6 +4247,8 @@ int iscsit_close_connection( |
2669 | * must wait until they have completed. |
2670 | */ |
2671 | iscsit_check_conn_usage_count(conn); |
2672 | + target_sess_cmd_list_set_waiting(sess->se_sess); |
2673 | + target_wait_for_sess_cmds(sess->se_sess); |
2674 | |
2675 | ahash_request_free(conn->conn_tx_hash); |
2676 | if (conn->conn_rx_hash) { |
2677 | diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c |
2678 | index f0d97305575d..aa3f98994c7d 100644 |
2679 | --- a/drivers/target/iscsi/iscsi_target_auth.c |
2680 | +++ b/drivers/target/iscsi/iscsi_target_auth.c |
2681 | @@ -74,7 +74,7 @@ static int chap_check_algorithm(const char *a_str) |
2682 | if (!token) |
2683 | goto out; |
2684 | |
2685 | - if (!strncmp(token, "5", 1)) { |
2686 | + if (!strcmp(token, "5")) { |
2687 | pr_debug("Selected MD5 Algorithm\n"); |
2688 | kfree(orig); |
2689 | return CHAP_DIGEST_MD5; |
2690 | diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c |
2691 | index 578242239daa..325f9db2da86 100644 |
2692 | --- a/drivers/tty/serial/atmel_serial.c |
2693 | +++ b/drivers/tty/serial/atmel_serial.c |
2694 | @@ -2200,27 +2200,6 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
2695 | mode |= ATMEL_US_USMODE_NORMAL; |
2696 | } |
2697 | |
2698 | - /* set the mode, clock divisor, parity, stop bits and data size */ |
2699 | - atmel_uart_writel(port, ATMEL_US_MR, mode); |
2700 | - |
2701 | - /* |
2702 | - * when switching the mode, set the RTS line state according to the |
2703 | - * new mode, otherwise keep the former state |
2704 | - */ |
2705 | - if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) { |
2706 | - unsigned int rts_state; |
2707 | - |
2708 | - if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) { |
2709 | - /* let the hardware control the RTS line */ |
2710 | - rts_state = ATMEL_US_RTSDIS; |
2711 | - } else { |
2712 | - /* force RTS line to low level */ |
2713 | - rts_state = ATMEL_US_RTSEN; |
2714 | - } |
2715 | - |
2716 | - atmel_uart_writel(port, ATMEL_US_CR, rts_state); |
2717 | - } |
2718 | - |
2719 | /* |
2720 | * Set the baud rate: |
2721 | * Fractional baudrate allows to setup output frequency more |
2722 | @@ -2247,6 +2226,28 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, |
2723 | quot = cd | fp << ATMEL_US_FP_OFFSET; |
2724 | |
2725 | atmel_uart_writel(port, ATMEL_US_BRGR, quot); |
2726 | + |
2727 | + /* set the mode, clock divisor, parity, stop bits and data size */ |
2728 | + atmel_uart_writel(port, ATMEL_US_MR, mode); |
2729 | + |
2730 | + /* |
2731 | + * when switching the mode, set the RTS line state according to the |
2732 | + * new mode, otherwise keep the former state |
2733 | + */ |
2734 | + if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) { |
2735 | + unsigned int rts_state; |
2736 | + |
2737 | + if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) { |
2738 | + /* let the hardware control the RTS line */ |
2739 | + rts_state = ATMEL_US_RTSDIS; |
2740 | + } else { |
2741 | + /* force RTS line to low level */ |
2742 | + rts_state = ATMEL_US_RTSEN; |
2743 | + } |
2744 | + |
2745 | + atmel_uart_writel(port, ATMEL_US_CR, rts_state); |
2746 | + } |
2747 | + |
2748 | atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
2749 | atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); |
2750 | |
2751 | diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
2752 | index 06a8f645106b..059e71d71b66 100644 |
2753 | --- a/drivers/usb/core/devio.c |
2754 | +++ b/drivers/usb/core/devio.c |
2755 | @@ -754,8 +754,15 @@ static int claimintf(struct usb_dev_state *ps, unsigned int ifnum) |
2756 | intf = usb_ifnum_to_if(dev, ifnum); |
2757 | if (!intf) |
2758 | err = -ENOENT; |
2759 | - else |
2760 | + else { |
2761 | + unsigned int old_suppress; |
2762 | + |
2763 | + /* suppress uevents while claiming interface */ |
2764 | + old_suppress = dev_get_uevent_suppress(&intf->dev); |
2765 | + dev_set_uevent_suppress(&intf->dev, 1); |
2766 | err = usb_driver_claim_interface(&usbfs_driver, intf, ps); |
2767 | + dev_set_uevent_suppress(&intf->dev, old_suppress); |
2768 | + } |
2769 | if (err == 0) |
2770 | set_bit(ifnum, &ps->ifclaimed); |
2771 | return err; |
2772 | @@ -775,7 +782,13 @@ static int releaseintf(struct usb_dev_state *ps, unsigned int ifnum) |
2773 | if (!intf) |
2774 | err = -ENOENT; |
2775 | else if (test_and_clear_bit(ifnum, &ps->ifclaimed)) { |
2776 | + unsigned int old_suppress; |
2777 | + |
2778 | + /* suppress uevents while releasing interface */ |
2779 | + old_suppress = dev_get_uevent_suppress(&intf->dev); |
2780 | + dev_set_uevent_suppress(&intf->dev, 1); |
2781 | usb_driver_release_interface(&usbfs_driver, intf); |
2782 | + dev_set_uevent_suppress(&intf->dev, old_suppress); |
2783 | err = 0; |
2784 | } |
2785 | return err; |
2786 | diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c |
2787 | index eca3710d8fc4..7e72e04708e3 100644 |
2788 | --- a/drivers/usb/host/ehci-q.c |
2789 | +++ b/drivers/usb/host/ehci-q.c |
2790 | @@ -40,6 +40,10 @@ |
2791 | |
2792 | /*-------------------------------------------------------------------------*/ |
2793 | |
2794 | +/* PID Codes that are used here, from EHCI specification, Table 3-16. */ |
2795 | +#define PID_CODE_IN 1 |
2796 | +#define PID_CODE_SETUP 2 |
2797 | + |
2798 | /* fill a qtd, returning how much of the buffer we were able to queue up */ |
2799 | |
2800 | static int |
2801 | @@ -203,7 +207,7 @@ static int qtd_copy_status ( |
2802 | int status = -EINPROGRESS; |
2803 | |
2804 | /* count IN/OUT bytes, not SETUP (even short packets) */ |
2805 | - if (likely (QTD_PID (token) != 2)) |
2806 | + if (likely(QTD_PID(token) != PID_CODE_SETUP)) |
2807 | urb->actual_length += length - QTD_LENGTH (token); |
2808 | |
2809 | /* don't modify error codes */ |
2810 | @@ -219,6 +223,13 @@ static int qtd_copy_status ( |
2811 | if (token & QTD_STS_BABBLE) { |
2812 | /* FIXME "must" disable babbling device's port too */ |
2813 | status = -EOVERFLOW; |
2814 | + /* |
2815 | + * When MMF is active and PID Code is IN, queue is halted. |
2816 | + * EHCI Specification, Table 4-13. |
2817 | + */ |
2818 | + } else if ((token & QTD_STS_MMF) && |
2819 | + (QTD_PID(token) == PID_CODE_IN)) { |
2820 | + status = -EPROTO; |
2821 | /* CERR nonzero + halt --> stall */ |
2822 | } else if (QTD_CERR(token)) { |
2823 | status = -EPIPE; |
2824 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
2825 | index 99bef8518fd2..aec6b20262e9 100644 |
2826 | --- a/drivers/usb/host/xhci-pci.c |
2827 | +++ b/drivers/usb/host/xhci-pci.c |
2828 | @@ -468,7 +468,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
2829 | retval = xhci_resume(xhci, hibernated); |
2830 | return retval; |
2831 | } |
2832 | -#endif /* CONFIG_PM */ |
2833 | |
2834 | static void xhci_pci_shutdown(struct usb_hcd *hcd) |
2835 | { |
2836 | @@ -481,6 +480,7 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd) |
2837 | if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
2838 | pci_set_power_state(pdev, PCI_D3hot); |
2839 | } |
2840 | +#endif /* CONFIG_PM */ |
2841 | |
2842 | /*-------------------------------------------------------------------------*/ |
2843 | |
2844 | diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h |
2845 | index b8620aa6b72e..8424c165f732 100644 |
2846 | --- a/drivers/usb/renesas_usbhs/common.h |
2847 | +++ b/drivers/usb/renesas_usbhs/common.h |
2848 | @@ -163,11 +163,12 @@ struct usbhs_priv; |
2849 | #define VBSTS (1 << 7) /* VBUS_0 and VBUSIN_0 Input Status */ |
2850 | #define VALID (1 << 3) /* USB Request Receive */ |
2851 | |
2852 | -#define DVSQ_MASK (0x3 << 4) /* Device State */ |
2853 | +#define DVSQ_MASK (0x7 << 4) /* Device State */ |
2854 | #define POWER_STATE (0 << 4) |
2855 | #define DEFAULT_STATE (1 << 4) |
2856 | #define ADDRESS_STATE (2 << 4) |
2857 | #define CONFIGURATION_STATE (3 << 4) |
2858 | +#define SUSPENDED_STATE (4 << 4) |
2859 | |
2860 | #define CTSQ_MASK (0x7) /* Control Transfer Stage */ |
2861 | #define IDLE_SETUP_STAGE 0 /* Idle stage or setup stage */ |
2862 | diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c |
2863 | index 6898ca1ef98c..b0397bcfe1f6 100644 |
2864 | --- a/drivers/usb/renesas_usbhs/mod_gadget.c |
2865 | +++ b/drivers/usb/renesas_usbhs/mod_gadget.c |
2866 | @@ -465,12 +465,18 @@ static int usbhsg_irq_dev_state(struct usbhs_priv *priv, |
2867 | { |
2868 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); |
2869 | struct device *dev = usbhsg_gpriv_to_dev(gpriv); |
2870 | + int state = usbhs_status_get_device_state(irq_state); |
2871 | |
2872 | gpriv->gadget.speed = usbhs_bus_get_speed(priv); |
2873 | |
2874 | - dev_dbg(dev, "state = %x : speed : %d\n", |
2875 | - usbhs_status_get_device_state(irq_state), |
2876 | - gpriv->gadget.speed); |
2877 | + dev_dbg(dev, "state = %x : speed : %d\n", state, gpriv->gadget.speed); |
2878 | + |
2879 | + if (gpriv->gadget.speed != USB_SPEED_UNKNOWN && |
2880 | + (state & SUSPENDED_STATE)) { |
2881 | + if (gpriv->driver && gpriv->driver->suspend) |
2882 | + gpriv->driver->suspend(&gpriv->gadget); |
2883 | + usb_gadget_set_state(&gpriv->gadget, USB_STATE_SUSPENDED); |
2884 | + } |
2885 | |
2886 | return 0; |
2887 | } |
2888 | diff --git a/drivers/usb/usbip/vhci_rx.c b/drivers/usb/usbip/vhci_rx.c |
2889 | index 5943deeec115..a4f65aacf335 100644 |
2890 | --- a/drivers/usb/usbip/vhci_rx.c |
2891 | +++ b/drivers/usb/usbip/vhci_rx.c |
2892 | @@ -90,16 +90,21 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, |
2893 | usbip_pack_pdu(pdu, urb, USBIP_RET_SUBMIT, 0); |
2894 | |
2895 | /* recv transfer buffer */ |
2896 | - if (usbip_recv_xbuff(ud, urb) < 0) |
2897 | - return; |
2898 | + if (usbip_recv_xbuff(ud, urb) < 0) { |
2899 | + urb->status = -EPROTO; |
2900 | + goto error; |
2901 | + } |
2902 | |
2903 | /* recv iso_packet_descriptor */ |
2904 | - if (usbip_recv_iso(ud, urb) < 0) |
2905 | - return; |
2906 | + if (usbip_recv_iso(ud, urb) < 0) { |
2907 | + urb->status = -EPROTO; |
2908 | + goto error; |
2909 | + } |
2910 | |
2911 | /* restore the padding in iso packets */ |
2912 | usbip_pad_iso(ud, urb); |
2913 | |
2914 | +error: |
2915 | if (usbip_dbg_flag_vhci_rx) |
2916 | usbip_dump_urb(urb); |
2917 | |
2918 | diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c |
2919 | index a775493b7b67..2e37097916b5 100644 |
2920 | --- a/drivers/vhost/vsock.c |
2921 | +++ b/drivers/vhost/vsock.c |
2922 | @@ -399,7 +399,9 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work) |
2923 | len = pkt->len; |
2924 | |
2925 | /* Only accept correctly addressed packets */ |
2926 | - if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid) |
2927 | + if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid && |
2928 | + le64_to_cpu(pkt->hdr.dst_cid) == |
2929 | + vhost_transport_get_local_cid()) |
2930 | virtio_transport_recv_pkt(pkt); |
2931 | else |
2932 | virtio_transport_free_pkt(pkt); |
2933 | diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c |
2934 | index ff0b0be92d61..a3de11d52ad0 100644 |
2935 | --- a/fs/btrfs/async-thread.c |
2936 | +++ b/fs/btrfs/async-thread.c |
2937 | @@ -265,16 +265,17 @@ out: |
2938 | } |
2939 | } |
2940 | |
2941 | -static void run_ordered_work(struct __btrfs_workqueue *wq) |
2942 | +static void run_ordered_work(struct __btrfs_workqueue *wq, |
2943 | + struct btrfs_work *self) |
2944 | { |
2945 | struct list_head *list = &wq->ordered_list; |
2946 | struct btrfs_work *work; |
2947 | spinlock_t *lock = &wq->list_lock; |
2948 | unsigned long flags; |
2949 | + void *wtag; |
2950 | + bool free_self = false; |
2951 | |
2952 | while (1) { |
2953 | - void *wtag; |
2954 | - |
2955 | spin_lock_irqsave(lock, flags); |
2956 | if (list_empty(list)) |
2957 | break; |
2958 | @@ -300,16 +301,47 @@ static void run_ordered_work(struct __btrfs_workqueue *wq) |
2959 | list_del(&work->ordered_list); |
2960 | spin_unlock_irqrestore(lock, flags); |
2961 | |
2962 | - /* |
2963 | - * We don't want to call the ordered free functions with the |
2964 | - * lock held though. Save the work as tag for the trace event, |
2965 | - * because the callback could free the structure. |
2966 | - */ |
2967 | - wtag = work; |
2968 | - work->ordered_free(work); |
2969 | - trace_btrfs_all_work_done(wq->fs_info, wtag); |
2970 | + if (work == self) { |
2971 | + /* |
2972 | + * This is the work item that the worker is currently |
2973 | + * executing. |
2974 | + * |
2975 | + * The kernel workqueue code guarantees non-reentrancy |
2976 | + * of work items. I.e., if a work item with the same |
2977 | + * address and work function is queued twice, the second |
2978 | + * execution is blocked until the first one finishes. A |
2979 | + * work item may be freed and recycled with the same |
2980 | + * work function; the workqueue code assumes that the |
2981 | + * original work item cannot depend on the recycled work |
2982 | + * item in that case (see find_worker_executing_work()). |
2983 | + * |
2984 | + * Note that the work of one Btrfs filesystem may depend |
2985 | + * on the work of another Btrfs filesystem via, e.g., a |
2986 | + * loop device. Therefore, we must not allow the current |
2987 | + * work item to be recycled until we are really done, |
2988 | + * otherwise we break the above assumption and can |
2989 | + * deadlock. |
2990 | + */ |
2991 | + free_self = true; |
2992 | + } else { |
2993 | + /* |
2994 | + * We don't want to call the ordered free functions with |
2995 | + * the lock held though. Save the work as tag for the |
2996 | + * trace event, because the callback could free the |
2997 | + * structure. |
2998 | + */ |
2999 | + wtag = work; |
3000 | + work->ordered_free(work); |
3001 | + trace_btrfs_all_work_done(wq->fs_info, wtag); |
3002 | + } |
3003 | } |
3004 | spin_unlock_irqrestore(lock, flags); |
3005 | + |
3006 | + if (free_self) { |
3007 | + wtag = self; |
3008 | + self->ordered_free(self); |
3009 | + trace_btrfs_all_work_done(wq->fs_info, wtag); |
3010 | + } |
3011 | } |
3012 | |
3013 | static void normal_work_helper(struct btrfs_work *work) |
3014 | @@ -337,7 +369,7 @@ static void normal_work_helper(struct btrfs_work *work) |
3015 | work->func(work); |
3016 | if (need_order) { |
3017 | set_bit(WORK_DONE_BIT, &work->flags); |
3018 | - run_ordered_work(wq); |
3019 | + run_ordered_work(wq, work); |
3020 | } |
3021 | if (!need_order) |
3022 | trace_btrfs_all_work_done(wq->fs_info, wtag); |
3023 | diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
3024 | index 3faccbf35e9f..305deb6e59c3 100644 |
3025 | --- a/fs/btrfs/ctree.c |
3026 | +++ b/fs/btrfs/ctree.c |
3027 | @@ -424,7 +424,7 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info, |
3028 | for (node = rb_first(tm_root); node; node = next) { |
3029 | next = rb_next(node); |
3030 | tm = container_of(node, struct tree_mod_elem, node); |
3031 | - if (tm->seq > min_seq) |
3032 | + if (tm->seq >= min_seq) |
3033 | continue; |
3034 | rb_erase(node, tm_root); |
3035 | kfree(tm); |
3036 | diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
3037 | index 9d3352fe8dc9..b37519241eb1 100644 |
3038 | --- a/fs/btrfs/disk-io.c |
3039 | +++ b/fs/btrfs/disk-io.c |
3040 | @@ -1712,8 +1712,8 @@ static void end_workqueue_fn(struct btrfs_work *work) |
3041 | bio->bi_error = end_io_wq->error; |
3042 | bio->bi_private = end_io_wq->private; |
3043 | bio->bi_end_io = end_io_wq->end_io; |
3044 | - kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
3045 | bio_endio(bio); |
3046 | + kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
3047 | } |
3048 | |
3049 | static int cleaner_kthread(void *arg) |
3050 | diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
3051 | index 4d901200be13..37a28e2369b9 100644 |
3052 | --- a/fs/btrfs/extent_io.c |
3053 | +++ b/fs/btrfs/extent_io.c |
3054 | @@ -4994,12 +4994,14 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, |
3055 | return eb; |
3056 | eb = alloc_dummy_extent_buffer(fs_info, start, nodesize); |
3057 | if (!eb) |
3058 | - return NULL; |
3059 | + return ERR_PTR(-ENOMEM); |
3060 | eb->fs_info = fs_info; |
3061 | again: |
3062 | ret = radix_tree_preload(GFP_NOFS); |
3063 | - if (ret) |
3064 | + if (ret) { |
3065 | + exists = ERR_PTR(ret); |
3066 | goto free_eb; |
3067 | + } |
3068 | spin_lock(&fs_info->buffer_lock); |
3069 | ret = radix_tree_insert(&fs_info->buffer_radix, |
3070 | start >> PAGE_SHIFT, eb); |
3071 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
3072 | index 80937c5ca477..250c8403ec67 100644 |
3073 | --- a/fs/btrfs/inode.c |
3074 | +++ b/fs/btrfs/inode.c |
3075 | @@ -5576,7 +5576,6 @@ static void inode_tree_del(struct inode *inode) |
3076 | spin_unlock(&root->inode_lock); |
3077 | |
3078 | if (empty && btrfs_root_refs(&root->root_item) == 0) { |
3079 | - synchronize_srcu(&root->fs_info->subvol_srcu); |
3080 | spin_lock(&root->inode_lock); |
3081 | empty = RB_EMPTY_ROOT(&root->inode_tree); |
3082 | spin_unlock(&root->inode_lock); |
3083 | @@ -9597,9 +9596,8 @@ static int btrfs_rename_exchange(struct inode *old_dir, |
3084 | return -EXDEV; |
3085 | |
3086 | /* close the race window with snapshot create/destroy ioctl */ |
3087 | - if (old_ino == BTRFS_FIRST_FREE_OBJECTID) |
3088 | - down_read(&root->fs_info->subvol_sem); |
3089 | - if (new_ino == BTRFS_FIRST_FREE_OBJECTID) |
3090 | + if (old_ino == BTRFS_FIRST_FREE_OBJECTID || |
3091 | + new_ino == BTRFS_FIRST_FREE_OBJECTID) |
3092 | down_read(&dest->fs_info->subvol_sem); |
3093 | |
3094 | /* |
3095 | @@ -9785,9 +9783,8 @@ out_fail: |
3096 | ret2 = btrfs_end_transaction(trans, root); |
3097 | ret = ret ? ret : ret2; |
3098 | out_notrans: |
3099 | - if (new_ino == BTRFS_FIRST_FREE_OBJECTID) |
3100 | - up_read(&dest->fs_info->subvol_sem); |
3101 | - if (old_ino == BTRFS_FIRST_FREE_OBJECTID) |
3102 | + if (new_ino == BTRFS_FIRST_FREE_OBJECTID || |
3103 | + old_ino == BTRFS_FIRST_FREE_OBJECTID) |
3104 | up_read(&root->fs_info->subvol_sem); |
3105 | |
3106 | return ret; |
3107 | diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
3108 | index a67143c579aa..eefe103c65da 100644 |
3109 | --- a/fs/btrfs/ioctl.c |
3110 | +++ b/fs/btrfs/ioctl.c |
3111 | @@ -610,12 +610,18 @@ static noinline int create_subvol(struct inode *dir, |
3112 | |
3113 | btrfs_i_size_write(dir, dir->i_size + namelen * 2); |
3114 | ret = btrfs_update_inode(trans, root, dir); |
3115 | - BUG_ON(ret); |
3116 | + if (ret) { |
3117 | + btrfs_abort_transaction(trans, ret); |
3118 | + goto fail; |
3119 | + } |
3120 | |
3121 | ret = btrfs_add_root_ref(trans, root->fs_info->tree_root, |
3122 | objectid, root->root_key.objectid, |
3123 | btrfs_ino(dir), index, name, namelen); |
3124 | - BUG_ON(ret); |
3125 | + if (ret) { |
3126 | + btrfs_abort_transaction(trans, ret); |
3127 | + goto fail; |
3128 | + } |
3129 | |
3130 | ret = btrfs_uuid_tree_add(trans, root->fs_info->uuid_root, |
3131 | root_item->uuid, BTRFS_UUID_KEY_SUBVOL, |
3132 | diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c |
3133 | index 94441fdb1ecf..0d1565d71231 100644 |
3134 | --- a/fs/btrfs/reada.c |
3135 | +++ b/fs/btrfs/reada.c |
3136 | @@ -734,21 +734,19 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info, |
3137 | static void reada_start_machine_worker(struct btrfs_work *work) |
3138 | { |
3139 | struct reada_machine_work *rmw; |
3140 | - struct btrfs_fs_info *fs_info; |
3141 | int old_ioprio; |
3142 | |
3143 | rmw = container_of(work, struct reada_machine_work, work); |
3144 | - fs_info = rmw->fs_info; |
3145 | - |
3146 | - kfree(rmw); |
3147 | |
3148 | old_ioprio = IOPRIO_PRIO_VALUE(task_nice_ioclass(current), |
3149 | task_nice_ioprio(current)); |
3150 | set_task_ioprio(current, BTRFS_IOPRIO_READA); |
3151 | - __reada_start_machine(fs_info); |
3152 | + __reada_start_machine(rmw->fs_info); |
3153 | set_task_ioprio(current, old_ioprio); |
3154 | |
3155 | - atomic_dec(&fs_info->reada_works_cnt); |
3156 | + atomic_dec(&rmw->fs_info->reada_works_cnt); |
3157 | + |
3158 | + kfree(rmw); |
3159 | } |
3160 | |
3161 | static void __reada_start_machine(struct btrfs_fs_info *fs_info) |
3162 | diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c |
3163 | index b0c3a6afe664..b106d365257d 100644 |
3164 | --- a/fs/btrfs/relocation.c |
3165 | +++ b/fs/btrfs/relocation.c |
3166 | @@ -4587,6 +4587,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) |
3167 | reloc_root->root_key.offset); |
3168 | if (IS_ERR(fs_root)) { |
3169 | err = PTR_ERR(fs_root); |
3170 | + list_add_tail(&reloc_root->root_list, &reloc_roots); |
3171 | goto out_free; |
3172 | } |
3173 | |
3174 | diff --git a/fs/btrfs/tests/free-space-tree-tests.c b/fs/btrfs/tests/free-space-tree-tests.c |
3175 | index a724d9a79bd2..5e3b875d87e2 100644 |
3176 | --- a/fs/btrfs/tests/free-space-tree-tests.c |
3177 | +++ b/fs/btrfs/tests/free-space-tree-tests.c |
3178 | @@ -476,9 +476,9 @@ static int run_test(test_func_t test_func, int bitmaps, u32 sectorsize, |
3179 | |
3180 | root->node = alloc_test_extent_buffer(root->fs_info, |
3181 | nodesize, nodesize); |
3182 | - if (!root->node) { |
3183 | - test_msg("Couldn't allocate dummy buffer\n"); |
3184 | - ret = -ENOMEM; |
3185 | + if (IS_ERR(root->node)) { |
3186 | + test_msg("couldn't allocate dummy buffer\n"); |
3187 | + ret = PTR_ERR(root->node); |
3188 | goto out; |
3189 | } |
3190 | btrfs_set_header_level(root->node, 0); |
3191 | diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c |
3192 | index 9c6666692341..e0aa6b9786fa 100644 |
3193 | --- a/fs/btrfs/tests/qgroup-tests.c |
3194 | +++ b/fs/btrfs/tests/qgroup-tests.c |
3195 | @@ -488,9 +488,9 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize) |
3196 | */ |
3197 | root->node = alloc_test_extent_buffer(root->fs_info, nodesize, |
3198 | nodesize); |
3199 | - if (!root->node) { |
3200 | + if (IS_ERR(root->node)) { |
3201 | test_msg("Couldn't allocate dummy buffer\n"); |
3202 | - ret = -ENOMEM; |
3203 | + ret = PTR_ERR(root->node); |
3204 | goto out; |
3205 | } |
3206 | btrfs_set_header_level(root->node, 0); |
3207 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
3208 | index 65e1eaa5df84..7ee573cddde9 100644 |
3209 | --- a/fs/btrfs/tree-log.c |
3210 | +++ b/fs/btrfs/tree-log.c |
3211 | @@ -5702,9 +5702,28 @@ again: |
3212 | wc.replay_dest = btrfs_read_fs_root_no_name(fs_info, &tmp_key); |
3213 | if (IS_ERR(wc.replay_dest)) { |
3214 | ret = PTR_ERR(wc.replay_dest); |
3215 | + |
3216 | + /* |
3217 | + * We didn't find the subvol, likely because it was |
3218 | + * deleted. This is ok, simply skip this log and go to |
3219 | + * the next one. |
3220 | + * |
3221 | + * We need to exclude the root because we can't have |
3222 | + * other log replays overwriting this log as we'll read |
3223 | + * it back in a few more times. This will keep our |
3224 | + * block from being modified, and we'll just bail for |
3225 | + * each subsequent pass. |
3226 | + */ |
3227 | + if (ret == -ENOENT) |
3228 | + ret = btrfs_pin_extent_for_log_replay(fs_info->extent_root, |
3229 | + log->node->start, |
3230 | + log->node->len); |
3231 | free_extent_buffer(log->node); |
3232 | free_extent_buffer(log->commit_root); |
3233 | kfree(log); |
3234 | + |
3235 | + if (!ret) |
3236 | + goto next; |
3237 | btrfs_handle_fs_error(fs_info, ret, |
3238 | "Couldn't read target root for tree log recovery."); |
3239 | goto error; |
3240 | @@ -5736,7 +5755,6 @@ again: |
3241 | &root->highest_objectid); |
3242 | } |
3243 | |
3244 | - key.offset = found_key.offset - 1; |
3245 | wc.replay_dest->log_root = NULL; |
3246 | free_extent_buffer(log->node); |
3247 | free_extent_buffer(log->commit_root); |
3248 | @@ -5744,9 +5762,10 @@ again: |
3249 | |
3250 | if (ret) |
3251 | goto error; |
3252 | - |
3253 | +next: |
3254 | if (found_key.offset == 0) |
3255 | break; |
3256 | + key.offset = found_key.offset - 1; |
3257 | } |
3258 | btrfs_release_path(path); |
3259 | |
3260 | diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c |
3261 | index 83bb2f2aa83c..ee1c76cf8886 100644 |
3262 | --- a/fs/btrfs/uuid-tree.c |
3263 | +++ b/fs/btrfs/uuid-tree.c |
3264 | @@ -335,6 +335,8 @@ again_search_slot: |
3265 | } |
3266 | if (ret < 0 && ret != -ENOENT) |
3267 | goto out; |
3268 | + key.offset++; |
3269 | + goto again_search_slot; |
3270 | } |
3271 | item_size -= sizeof(subid_le); |
3272 | offset += sizeof(subid_le); |
3273 | diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c |
3274 | index 0c83bffa7927..7fb8df7b6a43 100644 |
3275 | --- a/fs/ext4/dir.c |
3276 | +++ b/fs/ext4/dir.c |
3277 | @@ -75,6 +75,11 @@ int __ext4_check_dir_entry(const char *function, unsigned int line, |
3278 | error_msg = "rec_len is too small for name_len"; |
3279 | else if (unlikely(((char *) de - buf) + rlen > size)) |
3280 | error_msg = "directory entry overrun"; |
3281 | + else if (unlikely(((char *) de - buf) + rlen > |
3282 | + size - EXT4_DIR_REC_LEN(1) && |
3283 | + ((char *) de - buf) + rlen != size)) { |
3284 | + error_msg = "directory entry too close to block end"; |
3285 | + } |
3286 | else if (unlikely(le32_to_cpu(de->inode) > |
3287 | le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count))) |
3288 | error_msg = "inode out of bounds"; |
3289 | diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
3290 | index 29dc02758a52..f0ce535d514c 100644 |
3291 | --- a/fs/ext4/namei.c |
3292 | +++ b/fs/ext4/namei.c |
3293 | @@ -2721,7 +2721,7 @@ bool ext4_empty_dir(struct inode *inode) |
3294 | { |
3295 | unsigned int offset; |
3296 | struct buffer_head *bh; |
3297 | - struct ext4_dir_entry_2 *de, *de1; |
3298 | + struct ext4_dir_entry_2 *de; |
3299 | struct super_block *sb; |
3300 | |
3301 | if (ext4_has_inline_data(inode)) { |
3302 | @@ -2746,19 +2746,25 @@ bool ext4_empty_dir(struct inode *inode) |
3303 | return true; |
3304 | |
3305 | de = (struct ext4_dir_entry_2 *) bh->b_data; |
3306 | - de1 = ext4_next_entry(de, sb->s_blocksize); |
3307 | - if (le32_to_cpu(de->inode) != inode->i_ino || |
3308 | - le32_to_cpu(de1->inode) == 0 || |
3309 | - strcmp(".", de->name) || strcmp("..", de1->name)) { |
3310 | - ext4_warning_inode(inode, "directory missing '.' and/or '..'"); |
3311 | + if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, |
3312 | + 0) || |
3313 | + le32_to_cpu(de->inode) != inode->i_ino || strcmp(".", de->name)) { |
3314 | + ext4_warning_inode(inode, "directory missing '.'"); |
3315 | + brelse(bh); |
3316 | + return true; |
3317 | + } |
3318 | + offset = ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
3319 | + de = ext4_next_entry(de, sb->s_blocksize); |
3320 | + if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, |
3321 | + offset) || |
3322 | + le32_to_cpu(de->inode) == 0 || strcmp("..", de->name)) { |
3323 | + ext4_warning_inode(inode, "directory missing '..'"); |
3324 | brelse(bh); |
3325 | return true; |
3326 | } |
3327 | - offset = ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize) + |
3328 | - ext4_rec_len_from_disk(de1->rec_len, sb->s_blocksize); |
3329 | - de = ext4_next_entry(de1, sb->s_blocksize); |
3330 | + offset += ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
3331 | while (offset < inode->i_size) { |
3332 | - if ((void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { |
3333 | + if (!(offset & (sb->s_blocksize - 1))) { |
3334 | unsigned int lblock; |
3335 | brelse(bh); |
3336 | lblock = offset >> EXT4_BLOCK_SIZE_BITS(sb); |
3337 | @@ -2769,12 +2775,11 @@ bool ext4_empty_dir(struct inode *inode) |
3338 | } |
3339 | if (IS_ERR(bh)) |
3340 | return true; |
3341 | - de = (struct ext4_dir_entry_2 *) bh->b_data; |
3342 | } |
3343 | + de = (struct ext4_dir_entry_2 *) (bh->b_data + |
3344 | + (offset & (sb->s_blocksize - 1))); |
3345 | if (ext4_check_dir_entry(inode, NULL, de, bh, |
3346 | bh->b_data, bh->b_size, offset)) { |
3347 | - de = (struct ext4_dir_entry_2 *)(bh->b_data + |
3348 | - sb->s_blocksize); |
3349 | offset = (offset | (sb->s_blocksize - 1)) + 1; |
3350 | continue; |
3351 | } |
3352 | @@ -2783,7 +2788,6 @@ bool ext4_empty_dir(struct inode *inode) |
3353 | return false; |
3354 | } |
3355 | offset += ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize); |
3356 | - de = ext4_next_entry(de, sb->s_blocksize); |
3357 | } |
3358 | brelse(bh); |
3359 | return true; |
3360 | @@ -3078,18 +3082,17 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) |
3361 | if (IS_DIRSYNC(dir)) |
3362 | ext4_handle_sync(handle); |
3363 | |
3364 | - if (inode->i_nlink == 0) { |
3365 | - ext4_warning_inode(inode, "Deleting file '%.*s' with no links", |
3366 | - dentry->d_name.len, dentry->d_name.name); |
3367 | - set_nlink(inode, 1); |
3368 | - } |
3369 | retval = ext4_delete_entry(handle, dir, de, bh); |
3370 | if (retval) |
3371 | goto end_unlink; |
3372 | dir->i_ctime = dir->i_mtime = ext4_current_time(dir); |
3373 | ext4_update_dx_flag(dir); |
3374 | ext4_mark_inode_dirty(handle, dir); |
3375 | - drop_nlink(inode); |
3376 | + if (inode->i_nlink == 0) |
3377 | + ext4_warning_inode(inode, "Deleting file '%.*s' with no links", |
3378 | + dentry->d_name.len, dentry->d_name.name); |
3379 | + else |
3380 | + drop_nlink(inode); |
3381 | if (!inode->i_nlink) |
3382 | ext4_orphan_add(handle, inode); |
3383 | inode->i_ctime = ext4_current_time(inode); |
3384 | diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c |
3385 | index 10ec27676191..d002b2b6895f 100644 |
3386 | --- a/fs/jbd2/commit.c |
3387 | +++ b/fs/jbd2/commit.c |
3388 | @@ -722,7 +722,6 @@ start_journal_io: |
3389 | submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh); |
3390 | } |
3391 | cond_resched(); |
3392 | - stats.run.rs_blocks_logged += bufs; |
3393 | |
3394 | /* Force a new descriptor to be generated next |
3395 | time round the loop. */ |
3396 | @@ -809,6 +808,7 @@ start_journal_io: |
3397 | if (unlikely(!buffer_uptodate(bh))) |
3398 | err = -EIO; |
3399 | jbd2_unfile_log_bh(bh); |
3400 | + stats.run.rs_blocks_logged++; |
3401 | |
3402 | /* |
3403 | * The list contains temporary buffer heads created by |
3404 | @@ -854,6 +854,7 @@ start_journal_io: |
3405 | BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); |
3406 | clear_buffer_jwrite(bh); |
3407 | jbd2_unfile_log_bh(bh); |
3408 | + stats.run.rs_blocks_logged++; |
3409 | __brelse(bh); /* One for getblk */ |
3410 | /* AKPM: bforget here */ |
3411 | } |
3412 | @@ -875,6 +876,7 @@ start_journal_io: |
3413 | } |
3414 | if (cbh) |
3415 | err = journal_wait_on_commit_record(journal, cbh); |
3416 | + stats.run.rs_blocks_logged++; |
3417 | if (jbd2_has_feature_async_commit(journal) && |
3418 | journal->j_flags & JBD2_BARRIER) { |
3419 | blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL); |
3420 | diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c |
3421 | index ee8dbbae78b6..6dc714a56c37 100644 |
3422 | --- a/fs/ocfs2/acl.c |
3423 | +++ b/fs/ocfs2/acl.c |
3424 | @@ -338,8 +338,8 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh) |
3425 | down_read(&OCFS2_I(inode)->ip_xattr_sem); |
3426 | acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh); |
3427 | up_read(&OCFS2_I(inode)->ip_xattr_sem); |
3428 | - if (IS_ERR(acl) || !acl) |
3429 | - return PTR_ERR(acl); |
3430 | + if (IS_ERR_OR_NULL(acl)) |
3431 | + return PTR_ERR_OR_ZERO(acl); |
3432 | ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); |
3433 | if (ret) |
3434 | return ret; |
3435 | diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c |
3436 | index a7c6611e0056..82a5ecbe2da9 100644 |
3437 | --- a/fs/quota/dquot.c |
3438 | +++ b/fs/quota/dquot.c |
3439 | @@ -2849,68 +2849,73 @@ EXPORT_SYMBOL(dquot_quotactl_sysfile_ops); |
3440 | static int do_proc_dqstats(struct ctl_table *table, int write, |
3441 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3442 | { |
3443 | - unsigned int type = (int *)table->data - dqstats.stat; |
3444 | + unsigned int type = (unsigned long *)table->data - dqstats.stat; |
3445 | + s64 value = percpu_counter_sum(&dqstats.counter[type]); |
3446 | + |
3447 | + /* Filter negative values for non-monotonic counters */ |
3448 | + if (value < 0 && (type == DQST_ALLOC_DQUOTS || |
3449 | + type == DQST_FREE_DQUOTS)) |
3450 | + value = 0; |
3451 | |
3452 | /* Update global table */ |
3453 | - dqstats.stat[type] = |
3454 | - percpu_counter_sum_positive(&dqstats.counter[type]); |
3455 | - return proc_dointvec(table, write, buffer, lenp, ppos); |
3456 | + dqstats.stat[type] = value; |
3457 | + return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); |
3458 | } |
3459 | |
3460 | static struct ctl_table fs_dqstats_table[] = { |
3461 | { |
3462 | .procname = "lookups", |
3463 | .data = &dqstats.stat[DQST_LOOKUPS], |
3464 | - .maxlen = sizeof(int), |
3465 | + .maxlen = sizeof(unsigned long), |
3466 | .mode = 0444, |
3467 | .proc_handler = do_proc_dqstats, |
3468 | }, |
3469 | { |
3470 | .procname = "drops", |
3471 | .data = &dqstats.stat[DQST_DROPS], |
3472 | - .maxlen = sizeof(int), |
3473 | + .maxlen = sizeof(unsigned long), |
3474 | .mode = 0444, |
3475 | .proc_handler = do_proc_dqstats, |
3476 | }, |
3477 | { |
3478 | .procname = "reads", |
3479 | .data = &dqstats.stat[DQST_READS], |
3480 | - .maxlen = sizeof(int), |
3481 | + .maxlen = sizeof(unsigned long), |
3482 | .mode = 0444, |
3483 | .proc_handler = do_proc_dqstats, |
3484 | }, |
3485 | { |
3486 | .procname = "writes", |
3487 | .data = &dqstats.stat[DQST_WRITES], |
3488 | - .maxlen = sizeof(int), |
3489 | + .maxlen = sizeof(unsigned long), |
3490 | .mode = 0444, |
3491 | .proc_handler = do_proc_dqstats, |
3492 | }, |
3493 | { |
3494 | .procname = "cache_hits", |
3495 | .data = &dqstats.stat[DQST_CACHE_HITS], |
3496 | - .maxlen = sizeof(int), |
3497 | + .maxlen = sizeof(unsigned long), |
3498 | .mode = 0444, |
3499 | .proc_handler = do_proc_dqstats, |
3500 | }, |
3501 | { |
3502 | .procname = "allocated_dquots", |
3503 | .data = &dqstats.stat[DQST_ALLOC_DQUOTS], |
3504 | - .maxlen = sizeof(int), |
3505 | + .maxlen = sizeof(unsigned long), |
3506 | .mode = 0444, |
3507 | .proc_handler = do_proc_dqstats, |
3508 | }, |
3509 | { |
3510 | .procname = "free_dquots", |
3511 | .data = &dqstats.stat[DQST_FREE_DQUOTS], |
3512 | - .maxlen = sizeof(int), |
3513 | + .maxlen = sizeof(unsigned long), |
3514 | .mode = 0444, |
3515 | .proc_handler = do_proc_dqstats, |
3516 | }, |
3517 | { |
3518 | .procname = "syncs", |
3519 | .data = &dqstats.stat[DQST_SYNCS], |
3520 | - .maxlen = sizeof(int), |
3521 | + .maxlen = sizeof(unsigned long), |
3522 | .mode = 0444, |
3523 | .proc_handler = do_proc_dqstats, |
3524 | }, |
3525 | diff --git a/fs/readdir.c b/fs/readdir.c |
3526 | index 9d0212c374d6..1059f2a9be0b 100644 |
3527 | --- a/fs/readdir.c |
3528 | +++ b/fs/readdir.c |
3529 | @@ -63,6 +63,40 @@ out: |
3530 | } |
3531 | EXPORT_SYMBOL(iterate_dir); |
3532 | |
3533 | +/* |
3534 | + * POSIX says that a dirent name cannot contain NULL or a '/'. |
3535 | + * |
3536 | + * It's not 100% clear what we should really do in this case. |
3537 | + * The filesystem is clearly corrupted, but returning a hard |
3538 | + * error means that you now don't see any of the other names |
3539 | + * either, so that isn't a perfect alternative. |
3540 | + * |
3541 | + * And if you return an error, what error do you use? Several |
3542 | + * filesystems seem to have decided on EUCLEAN being the error |
3543 | + * code for EFSCORRUPTED, and that may be the error to use. Or |
3544 | + * just EIO, which is perhaps more obvious to users. |
3545 | + * |
3546 | + * In order to see the other file names in the directory, the |
3547 | + * caller might want to make this a "soft" error: skip the |
3548 | + * entry, and return the error at the end instead. |
3549 | + * |
3550 | + * Note that this should likely do a "memchr(name, 0, len)" |
3551 | + * check too, since that would be filesystem corruption as |
3552 | + * well. However, that case can't actually confuse user space, |
3553 | + * which has to do a strlen() on the name anyway to find the |
3554 | + * filename length, and the above "soft error" worry means |
3555 | + * that it's probably better left alone until we have that |
3556 | + * issue clarified. |
3557 | + */ |
3558 | +static int verify_dirent_name(const char *name, int len) |
3559 | +{ |
3560 | + if (!len) |
3561 | + return -EIO; |
3562 | + if (memchr(name, '/', len)) |
3563 | + return -EIO; |
3564 | + return 0; |
3565 | +} |
3566 | + |
3567 | /* |
3568 | * Traditional linux readdir() handling.. |
3569 | * |
3570 | @@ -172,6 +206,9 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, |
3571 | int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, |
3572 | sizeof(long)); |
3573 | |
3574 | + buf->error = verify_dirent_name(name, namlen); |
3575 | + if (unlikely(buf->error)) |
3576 | + return buf->error; |
3577 | buf->error = -EINVAL; /* only used if we fail.. */ |
3578 | if (reclen > buf->count) |
3579 | return -EINVAL; |
3580 | @@ -258,6 +295,9 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen, |
3581 | int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, |
3582 | sizeof(u64)); |
3583 | |
3584 | + buf->error = verify_dirent_name(name, namlen); |
3585 | + if (unlikely(buf->error)) |
3586 | + return buf->error; |
3587 | buf->error = -EINVAL; /* only used if we fail.. */ |
3588 | if (reclen > buf->count) |
3589 | return -EINVAL; |
3590 | diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h |
3591 | index 003207670597..c0542de64690 100644 |
3592 | --- a/include/drm/drm_dp_mst_helper.h |
3593 | +++ b/include/drm/drm_dp_mst_helper.h |
3594 | @@ -312,7 +312,7 @@ struct drm_dp_resource_status_notify { |
3595 | |
3596 | struct drm_dp_query_payload_ack_reply { |
3597 | u8 port_number; |
3598 | - u8 allocated_pbn; |
3599 | + u16 allocated_pbn; |
3600 | }; |
3601 | |
3602 | struct drm_dp_sideband_msg_req_body { |
3603 | diff --git a/include/linux/cec-funcs.h b/include/linux/cec-funcs.h |
3604 | index 138bbf721e70..a844749a2855 100644 |
3605 | --- a/include/linux/cec-funcs.h |
3606 | +++ b/include/linux/cec-funcs.h |
3607 | @@ -956,7 +956,8 @@ static inline void cec_msg_give_deck_status(struct cec_msg *msg, |
3608 | msg->len = 3; |
3609 | msg->msg[1] = CEC_MSG_GIVE_DECK_STATUS; |
3610 | msg->msg[2] = status_req; |
3611 | - msg->reply = reply ? CEC_MSG_DECK_STATUS : 0; |
3612 | + msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ? |
3613 | + CEC_MSG_DECK_STATUS : 0; |
3614 | } |
3615 | |
3616 | static inline void cec_ops_give_deck_status(const struct cec_msg *msg, |
3617 | @@ -1060,7 +1061,8 @@ static inline void cec_msg_give_tuner_device_status(struct cec_msg *msg, |
3618 | msg->len = 3; |
3619 | msg->msg[1] = CEC_MSG_GIVE_TUNER_DEVICE_STATUS; |
3620 | msg->msg[2] = status_req; |
3621 | - msg->reply = reply ? CEC_MSG_TUNER_DEVICE_STATUS : 0; |
3622 | + msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ? |
3623 | + CEC_MSG_TUNER_DEVICE_STATUS : 0; |
3624 | } |
3625 | |
3626 | static inline void cec_ops_give_tuner_device_status(const struct cec_msg *msg, |
3627 | diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h |
3628 | index 5e00f80b1535..5ae70d2f9a2f 100644 |
3629 | --- a/include/linux/hrtimer.h |
3630 | +++ b/include/linux/hrtimer.h |
3631 | @@ -424,12 +424,18 @@ extern u64 hrtimer_get_next_event(void); |
3632 | |
3633 | extern bool hrtimer_active(const struct hrtimer *timer); |
3634 | |
3635 | -/* |
3636 | - * Helper function to check, whether the timer is on one of the queues |
3637 | +/** |
3638 | + * hrtimer_is_queued = check, whether the timer is on one of the queues |
3639 | + * @timer: Timer to check |
3640 | + * |
3641 | + * Returns: True if the timer is queued, false otherwise |
3642 | + * |
3643 | + * The function can be used lockless, but it gives only a current snapshot. |
3644 | */ |
3645 | -static inline int hrtimer_is_queued(struct hrtimer *timer) |
3646 | +static inline bool hrtimer_is_queued(struct hrtimer *timer) |
3647 | { |
3648 | - return timer->state & HRTIMER_STATE_ENQUEUED; |
3649 | + /* The READ_ONCE pairs with the update functions of timer->state */ |
3650 | + return !!(READ_ONCE(timer->state) & HRTIMER_STATE_ENQUEUED); |
3651 | } |
3652 | |
3653 | /* |
3654 | diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h |
3655 | index 8850e243c940..bd0a55821177 100644 |
3656 | --- a/include/linux/libfdt_env.h |
3657 | +++ b/include/linux/libfdt_env.h |
3658 | @@ -6,6 +6,9 @@ |
3659 | |
3660 | #include <asm/byteorder.h> |
3661 | |
3662 | +#define INT32_MAX S32_MAX |
3663 | +#define UINT32_MAX U32_MAX |
3664 | + |
3665 | typedef __be16 fdt16_t; |
3666 | typedef __be32 fdt32_t; |
3667 | typedef __be64 fdt64_t; |
3668 | diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h |
3669 | index ed84c07f6a51..1abfe37314a0 100644 |
3670 | --- a/include/linux/mod_devicetable.h |
3671 | +++ b/include/linux/mod_devicetable.h |
3672 | @@ -502,9 +502,9 @@ struct platform_device_id { |
3673 | |
3674 | #define MDIO_MODULE_PREFIX "mdio:" |
3675 | |
3676 | -#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" |
3677 | +#define MDIO_ID_FMT "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u" |
3678 | #define MDIO_ID_ARGS(_id) \ |
3679 | - (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ |
3680 | + ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ |
3681 | ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ |
3682 | ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ |
3683 | ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \ |
3684 | diff --git a/include/linux/quota.h b/include/linux/quota.h |
3685 | index 55107a8ff887..23eb8ea07def 100644 |
3686 | --- a/include/linux/quota.h |
3687 | +++ b/include/linux/quota.h |
3688 | @@ -263,7 +263,7 @@ enum { |
3689 | }; |
3690 | |
3691 | struct dqstats { |
3692 | - int stat[_DQST_DQSTAT_LAST]; |
3693 | + unsigned long stat[_DQST_DQSTAT_LAST]; |
3694 | struct percpu_counter counter[_DQST_DQSTAT_LAST]; |
3695 | }; |
3696 | |
3697 | diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h |
3698 | index 2720b2fbfb86..106f4e0d7bd3 100644 |
3699 | --- a/include/linux/rculist_nulls.h |
3700 | +++ b/include/linux/rculist_nulls.h |
3701 | @@ -99,6 +99,43 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n, |
3702 | first->pprev = &n->next; |
3703 | } |
3704 | |
3705 | +/** |
3706 | + * hlist_nulls_add_tail_rcu |
3707 | + * @n: the element to add to the hash list. |
3708 | + * @h: the list to add to. |
3709 | + * |
3710 | + * Description: |
3711 | + * Adds the specified element to the specified hlist_nulls, |
3712 | + * while permitting racing traversals. |
3713 | + * |
3714 | + * The caller must take whatever precautions are necessary |
3715 | + * (such as holding appropriate locks) to avoid racing |
3716 | + * with another list-mutation primitive, such as hlist_nulls_add_head_rcu() |
3717 | + * or hlist_nulls_del_rcu(), running on this same list. |
3718 | + * However, it is perfectly legal to run concurrently with |
3719 | + * the _rcu list-traversal primitives, such as |
3720 | + * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency |
3721 | + * problems on Alpha CPUs. Regardless of the type of CPU, the |
3722 | + * list-traversal primitive must be guarded by rcu_read_lock(). |
3723 | + */ |
3724 | +static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n, |
3725 | + struct hlist_nulls_head *h) |
3726 | +{ |
3727 | + struct hlist_nulls_node *i, *last = NULL; |
3728 | + |
3729 | + /* Note: write side code, so rcu accessors are not needed. */ |
3730 | + for (i = h->first; !is_a_nulls(i); i = i->next) |
3731 | + last = i; |
3732 | + |
3733 | + if (last) { |
3734 | + n->next = last->next; |
3735 | + n->pprev = &last->next; |
3736 | + rcu_assign_pointer(hlist_next_rcu(last), n); |
3737 | + } else { |
3738 | + hlist_nulls_add_head_rcu(n, h); |
3739 | + } |
3740 | +} |
3741 | + |
3742 | /** |
3743 | * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type |
3744 | * @tpos: the type * to use as a loop cursor. |
3745 | diff --git a/include/net/dst.h b/include/net/dst.h |
3746 | index ddcff17615da..e57e8fb9a43d 100644 |
3747 | --- a/include/net/dst.h |
3748 | +++ b/include/net/dst.h |
3749 | @@ -110,7 +110,7 @@ struct dst_entry { |
3750 | struct dst_metrics { |
3751 | u32 metrics[RTAX_MAX]; |
3752 | atomic_t refcnt; |
3753 | -}; |
3754 | +} __aligned(4); /* Low pointer bits contain DST_METRICS_FLAGS */ |
3755 | extern const struct dst_metrics dst_default_metrics; |
3756 | |
3757 | u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); |
3758 | diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h |
3759 | index 0574493e3899..fc445e7ccadf 100644 |
3760 | --- a/include/net/inet_hashtables.h |
3761 | +++ b/include/net/inet_hashtables.h |
3762 | @@ -98,12 +98,18 @@ struct inet_bind_hashbucket { |
3763 | struct hlist_head chain; |
3764 | }; |
3765 | |
3766 | -/* |
3767 | - * Sockets can be hashed in established or listening table |
3768 | +/* Sockets can be hashed in established or listening table. |
3769 | + * We must use different 'nulls' end-of-chain value for all hash buckets : |
3770 | + * A socket might transition from ESTABLISH to LISTEN state without |
3771 | + * RCU grace period. A lookup in ehash table needs to handle this case. |
3772 | */ |
3773 | +#define LISTENING_NULLS_BASE (1U << 29) |
3774 | struct inet_listen_hashbucket { |
3775 | spinlock_t lock; |
3776 | - struct hlist_head head; |
3777 | + union { |
3778 | + struct hlist_head head; |
3779 | + struct hlist_nulls_head nulls_head; |
3780 | + }; |
3781 | }; |
3782 | |
3783 | /* This is for listening sockets, thus all sockets which possess wildcards. */ |
3784 | diff --git a/include/net/sock.h b/include/net/sock.h |
3785 | index aed436567d70..d6bce19ca261 100644 |
3786 | --- a/include/net/sock.h |
3787 | +++ b/include/net/sock.h |
3788 | @@ -661,6 +661,11 @@ static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_h |
3789 | hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); |
3790 | } |
3791 | |
3792 | +static inline void __sk_nulls_add_node_tail_rcu(struct sock *sk, struct hlist_nulls_head *list) |
3793 | +{ |
3794 | + hlist_nulls_add_tail_rcu(&sk->sk_nulls_node, list); |
3795 | +} |
3796 | + |
3797 | static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) |
3798 | { |
3799 | sock_hold(sk); |
3800 | diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h |
3801 | index c1260d80ef30..1a2ae0862e23 100644 |
3802 | --- a/include/scsi/iscsi_proto.h |
3803 | +++ b/include/scsi/iscsi_proto.h |
3804 | @@ -638,6 +638,7 @@ struct iscsi_reject { |
3805 | #define ISCSI_REASON_BOOKMARK_INVALID 9 |
3806 | #define ISCSI_REASON_BOOKMARK_NO_RESOURCES 10 |
3807 | #define ISCSI_REASON_NEGOTIATION_RESET 11 |
3808 | +#define ISCSI_REASON_WAITING_FOR_LOGOUT 12 |
3809 | |
3810 | /* Max. number of Key=Value pairs in a text message */ |
3811 | #define MAX_KEY_VALUE_PAIRS 8192 |
3812 | diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
3813 | index 6af1ac551ea3..34449ec0689d 100644 |
3814 | --- a/kernel/sysctl.c |
3815 | +++ b/kernel/sysctl.c |
3816 | @@ -1398,7 +1398,7 @@ static struct ctl_table vm_table[] = { |
3817 | .procname = "drop_caches", |
3818 | .data = &sysctl_drop_caches, |
3819 | .maxlen = sizeof(int), |
3820 | - .mode = 0644, |
3821 | + .mode = 0200, |
3822 | .proc_handler = drop_caches_sysctl_handler, |
3823 | .extra1 = &one, |
3824 | .extra2 = &four, |
3825 | diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c |
3826 | index c93729661be0..f31637ced7fa 100644 |
3827 | --- a/kernel/time/hrtimer.c |
3828 | +++ b/kernel/time/hrtimer.c |
3829 | @@ -870,7 +870,8 @@ static int enqueue_hrtimer(struct hrtimer *timer, |
3830 | |
3831 | base->cpu_base->active_bases |= 1 << base->index; |
3832 | |
3833 | - timer->state = HRTIMER_STATE_ENQUEUED; |
3834 | + /* Pairs with the lockless read in hrtimer_is_queued() */ |
3835 | + WRITE_ONCE(timer->state, HRTIMER_STATE_ENQUEUED); |
3836 | |
3837 | return timerqueue_add(&base->active, &timer->node); |
3838 | } |
3839 | @@ -892,7 +893,8 @@ static void __remove_hrtimer(struct hrtimer *timer, |
3840 | struct hrtimer_cpu_base *cpu_base = base->cpu_base; |
3841 | u8 state = timer->state; |
3842 | |
3843 | - timer->state = newstate; |
3844 | + /* Pairs with the lockless read in hrtimer_is_queued() */ |
3845 | + WRITE_ONCE(timer->state, newstate); |
3846 | if (!(state & HRTIMER_STATE_ENQUEUED)) |
3847 | return; |
3848 | |
3849 | @@ -919,8 +921,9 @@ static void __remove_hrtimer(struct hrtimer *timer, |
3850 | static inline int |
3851 | remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart) |
3852 | { |
3853 | - if (hrtimer_is_queued(timer)) { |
3854 | - u8 state = timer->state; |
3855 | + u8 state = timer->state; |
3856 | + |
3857 | + if (state & HRTIMER_STATE_ENQUEUED) { |
3858 | int reprogram; |
3859 | |
3860 | /* |
3861 | diff --git a/lib/dma-debug.c b/lib/dma-debug.c |
3862 | index 8971370bfb16..4435bec55fb5 100644 |
3863 | --- a/lib/dma-debug.c |
3864 | +++ b/lib/dma-debug.c |
3865 | @@ -435,6 +435,7 @@ void debug_dma_dump_mappings(struct device *dev) |
3866 | } |
3867 | |
3868 | spin_unlock_irqrestore(&bucket->lock, flags); |
3869 | + cond_resched(); |
3870 | } |
3871 | } |
3872 | EXPORT_SYMBOL(debug_dma_dump_mappings); |
3873 | diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
3874 | index 4bd72d2fe415..a70b078ceb3c 100644 |
3875 | --- a/net/bluetooth/hci_core.c |
3876 | +++ b/net/bluetooth/hci_core.c |
3877 | @@ -4180,7 +4180,14 @@ static void hci_rx_work(struct work_struct *work) |
3878 | hci_send_to_sock(hdev, skb); |
3879 | } |
3880 | |
3881 | - if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { |
3882 | + /* If the device has been opened in HCI_USER_CHANNEL, |
3883 | + * the userspace has exclusive access to device. |
3884 | + * When device is HCI_INIT, we still need to process |
3885 | + * the data packets to the driver in order |
3886 | + * to complete its setup(). |
3887 | + */ |
3888 | + if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && |
3889 | + !test_bit(HCI_INIT, &hdev->flags)) { |
3890 | kfree_skb(skb); |
3891 | continue; |
3892 | } |
3893 | diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c |
3894 | index 1015d9c8d97d..4a89e121d662 100644 |
3895 | --- a/net/bluetooth/hci_request.c |
3896 | +++ b/net/bluetooth/hci_request.c |
3897 | @@ -1093,6 +1093,14 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) |
3898 | |
3899 | instance_flags = get_adv_instance_flags(hdev, instance); |
3900 | |
3901 | + /* If instance already has the flags set skip adding it once |
3902 | + * again. |
3903 | + */ |
3904 | + if (adv_instance && eir_get_data(adv_instance->adv_data, |
3905 | + adv_instance->adv_data_len, EIR_FLAGS, |
3906 | + NULL)) |
3907 | + goto skip_flags; |
3908 | + |
3909 | /* The Add Advertising command allows userspace to set both the general |
3910 | * and limited discoverable flags. |
3911 | */ |
3912 | @@ -1125,6 +1133,7 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) |
3913 | } |
3914 | } |
3915 | |
3916 | +skip_flags: |
3917 | if (adv_instance) { |
3918 | memcpy(ptr, adv_instance->adv_data, |
3919 | adv_instance->adv_data_len); |
3920 | diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
3921 | index 0c96773d1829..62e045c9d452 100644 |
3922 | --- a/net/bridge/br_netfilter_hooks.c |
3923 | +++ b/net/bridge/br_netfilter_hooks.c |
3924 | @@ -643,6 +643,9 @@ static unsigned int br_nf_forward_arp(void *priv, |
3925 | nf_bridge_pull_encap_header(skb); |
3926 | } |
3927 | |
3928 | + if (unlikely(!pskb_may_pull(skb, sizeof(struct arphdr)))) |
3929 | + return NF_DROP; |
3930 | + |
3931 | if (arp_hdr(skb)->ar_pln != 4) { |
3932 | if (IS_VLAN_ARP(skb)) |
3933 | nf_bridge_push_encap_header(skb); |
3934 | diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c |
3935 | index 4a47918b504f..56b7197f0373 100644 |
3936 | --- a/net/bridge/netfilter/ebtables.c |
3937 | +++ b/net/bridge/netfilter/ebtables.c |
3938 | @@ -1894,7 +1894,7 @@ static int ebt_buf_count(struct ebt_entries_buf_state *state, unsigned int sz) |
3939 | } |
3940 | |
3941 | static int ebt_buf_add(struct ebt_entries_buf_state *state, |
3942 | - void *data, unsigned int sz) |
3943 | + const void *data, unsigned int sz) |
3944 | { |
3945 | if (state->buf_kern_start == NULL) |
3946 | goto count_only; |
3947 | @@ -1928,7 +1928,7 @@ enum compat_mwt { |
3948 | EBT_COMPAT_TARGET, |
3949 | }; |
3950 | |
3951 | -static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, |
3952 | +static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt, |
3953 | enum compat_mwt compat_mwt, |
3954 | struct ebt_entries_buf_state *state, |
3955 | const unsigned char *base) |
3956 | @@ -2004,22 +2004,23 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, |
3957 | /* return size of all matches, watchers or target, including necessary |
3958 | * alignment and padding. |
3959 | */ |
3960 | -static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, |
3961 | +static int ebt_size_mwt(const struct compat_ebt_entry_mwt *match32, |
3962 | unsigned int size_left, enum compat_mwt type, |
3963 | struct ebt_entries_buf_state *state, const void *base) |
3964 | { |
3965 | + const char *buf = (const char *)match32; |
3966 | int growth = 0; |
3967 | - char *buf; |
3968 | |
3969 | if (size_left == 0) |
3970 | return 0; |
3971 | |
3972 | - buf = (char *) match32; |
3973 | - |
3974 | - while (size_left >= sizeof(*match32)) { |
3975 | + do { |
3976 | struct ebt_entry_match *match_kern; |
3977 | int ret; |
3978 | |
3979 | + if (size_left < sizeof(*match32)) |
3980 | + return -EINVAL; |
3981 | + |
3982 | match_kern = (struct ebt_entry_match *) state->buf_kern_start; |
3983 | if (match_kern) { |
3984 | char *tmp; |
3985 | @@ -2056,22 +2057,18 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, |
3986 | if (match_kern) |
3987 | match_kern->match_size = ret; |
3988 | |
3989 | - /* rule should have no remaining data after target */ |
3990 | - if (type == EBT_COMPAT_TARGET && size_left) |
3991 | - return -EINVAL; |
3992 | - |
3993 | match32 = (struct compat_ebt_entry_mwt *) buf; |
3994 | - } |
3995 | + } while (size_left); |
3996 | |
3997 | return growth; |
3998 | } |
3999 | |
4000 | /* called for all ebt_entry structures. */ |
4001 | -static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, |
4002 | +static int size_entry_mwt(const struct ebt_entry *entry, const unsigned char *base, |
4003 | unsigned int *total, |
4004 | struct ebt_entries_buf_state *state) |
4005 | { |
4006 | - unsigned int i, j, startoff, new_offset = 0; |
4007 | + unsigned int i, j, startoff, next_expected_off, new_offset = 0; |
4008 | /* stores match/watchers/targets & offset of next struct ebt_entry: */ |
4009 | unsigned int offsets[4]; |
4010 | unsigned int *offsets_update = NULL; |
4011 | @@ -2158,11 +2155,13 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, |
4012 | return ret; |
4013 | } |
4014 | |
4015 | - startoff = state->buf_user_offset - startoff; |
4016 | + next_expected_off = state->buf_user_offset - startoff; |
4017 | + if (next_expected_off != entry->next_offset) |
4018 | + return -EINVAL; |
4019 | |
4020 | - if (WARN_ON(*total < startoff)) |
4021 | + if (*total < entry->next_offset) |
4022 | return -EINVAL; |
4023 | - *total -= startoff; |
4024 | + *total -= entry->next_offset; |
4025 | return 0; |
4026 | } |
4027 | |
4028 | diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c |
4029 | index a6fc82704f0c..b4318c1b5b96 100644 |
4030 | --- a/net/core/sysctl_net_core.c |
4031 | +++ b/net/core/sysctl_net_core.c |
4032 | @@ -255,6 +255,7 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, |
4033 | return ret; |
4034 | } |
4035 | |
4036 | +# ifdef CONFIG_HAVE_EBPF_JIT |
4037 | static int |
4038 | proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
4039 | void __user *buffer, size_t *lenp, |
4040 | @@ -265,6 +266,7 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
4041 | |
4042 | return proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
4043 | } |
4044 | +# endif /* CONFIG_HAVE_EBPF_JIT */ |
4045 | |
4046 | static int |
4047 | proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
4048 | diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
4049 | index 172d3dfed0c4..cc5c8d598e5e 100644 |
4050 | --- a/net/ipv4/icmp.c |
4051 | +++ b/net/ipv4/icmp.c |
4052 | @@ -256,10 +256,11 @@ bool icmp_global_allow(void) |
4053 | bool rc = false; |
4054 | |
4055 | /* Check if token bucket is empty and cannot be refilled |
4056 | - * without taking the spinlock. |
4057 | + * without taking the spinlock. The READ_ONCE() are paired |
4058 | + * with the following WRITE_ONCE() in this same function. |
4059 | */ |
4060 | - if (!icmp_global.credit) { |
4061 | - delta = min_t(u32, now - icmp_global.stamp, HZ); |
4062 | + if (!READ_ONCE(icmp_global.credit)) { |
4063 | + delta = min_t(u32, now - READ_ONCE(icmp_global.stamp), HZ); |
4064 | if (delta < HZ / 50) |
4065 | return false; |
4066 | } |
4067 | @@ -269,14 +270,14 @@ bool icmp_global_allow(void) |
4068 | if (delta >= HZ / 50) { |
4069 | incr = sysctl_icmp_msgs_per_sec * delta / HZ ; |
4070 | if (incr) |
4071 | - icmp_global.stamp = now; |
4072 | + WRITE_ONCE(icmp_global.stamp, now); |
4073 | } |
4074 | credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); |
4075 | if (credit) { |
4076 | credit--; |
4077 | rc = true; |
4078 | } |
4079 | - icmp_global.credit = credit; |
4080 | + WRITE_ONCE(icmp_global.credit, credit); |
4081 | spin_unlock(&icmp_global.lock); |
4082 | return rc; |
4083 | } |
4084 | diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c |
4085 | index e4d16fc5bbb3..4273576e1475 100644 |
4086 | --- a/net/ipv4/inet_diag.c |
4087 | +++ b/net/ipv4/inet_diag.c |
4088 | @@ -868,12 +868,13 @@ void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb, |
4089 | |
4090 | for (i = s_i; i < INET_LHTABLE_SIZE; i++) { |
4091 | struct inet_listen_hashbucket *ilb; |
4092 | + struct hlist_nulls_node *node; |
4093 | struct sock *sk; |
4094 | |
4095 | num = 0; |
4096 | ilb = &hashinfo->listening_hash[i]; |
4097 | spin_lock_bh(&ilb->lock); |
4098 | - sk_for_each(sk, &ilb->head) { |
4099 | + sk_nulls_for_each(sk, node, &ilb->nulls_head) { |
4100 | struct inet_sock *inet = inet_sk(sk); |
4101 | |
4102 | if (!net_eq(sock_net(sk), net)) |
4103 | diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c |
4104 | index b9bcf3db3af9..4bf542f4d980 100644 |
4105 | --- a/net/ipv4/inet_hashtables.c |
4106 | +++ b/net/ipv4/inet_hashtables.c |
4107 | @@ -218,9 +218,10 @@ struct sock *__inet_lookup_listener(struct net *net, |
4108 | int score, hiscore = 0, matches = 0, reuseport = 0; |
4109 | bool exact_dif = inet_exact_dif_match(net, skb); |
4110 | struct sock *sk, *result = NULL; |
4111 | + struct hlist_nulls_node *node; |
4112 | u32 phash = 0; |
4113 | |
4114 | - sk_for_each_rcu(sk, &ilb->head) { |
4115 | + sk_nulls_for_each_rcu(sk, node, &ilb->nulls_head) { |
4116 | score = compute_score(sk, net, hnum, daddr, dif, exact_dif); |
4117 | if (score > hiscore) { |
4118 | reuseport = sk->sk_reuseport; |
4119 | @@ -441,10 +442,11 @@ static int inet_reuseport_add_sock(struct sock *sk, |
4120 | bool match_wildcard)) |
4121 | { |
4122 | struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash; |
4123 | + const struct hlist_nulls_node *node; |
4124 | struct sock *sk2; |
4125 | kuid_t uid = sock_i_uid(sk); |
4126 | |
4127 | - sk_for_each_rcu(sk2, &ilb->head) { |
4128 | + sk_nulls_for_each_rcu(sk2, node, &ilb->nulls_head) { |
4129 | if (sk2 != sk && |
4130 | sk2->sk_family == sk->sk_family && |
4131 | ipv6_only_sock(sk2) == ipv6_only_sock(sk) && |
4132 | @@ -482,9 +484,9 @@ int __inet_hash(struct sock *sk, struct sock *osk, |
4133 | } |
4134 | if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport && |
4135 | sk->sk_family == AF_INET6) |
4136 | - hlist_add_tail_rcu(&sk->sk_node, &ilb->head); |
4137 | + __sk_nulls_add_node_tail_rcu(sk, &ilb->nulls_head); |
4138 | else |
4139 | - hlist_add_head_rcu(&sk->sk_node, &ilb->head); |
4140 | + __sk_nulls_add_node_rcu(sk, &ilb->nulls_head); |
4141 | sock_set_flag(sk, SOCK_RCU_FREE); |
4142 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
4143 | unlock: |
4144 | @@ -527,10 +529,7 @@ void inet_unhash(struct sock *sk) |
4145 | spin_lock_bh(lock); |
4146 | if (rcu_access_pointer(sk->sk_reuseport_cb)) |
4147 | reuseport_detach_sock(sk); |
4148 | - if (listener) |
4149 | - done = __sk_del_node_init(sk); |
4150 | - else |
4151 | - done = __sk_nulls_del_node_init_rcu(sk); |
4152 | + done = __sk_nulls_del_node_init_rcu(sk); |
4153 | if (done) |
4154 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); |
4155 | spin_unlock_bh(lock); |
4156 | @@ -666,7 +665,8 @@ void inet_hashinfo_init(struct inet_hashinfo *h) |
4157 | |
4158 | for (i = 0; i < INET_LHTABLE_SIZE; i++) { |
4159 | spin_lock_init(&h->listening_hash[i].lock); |
4160 | - INIT_HLIST_HEAD(&h->listening_hash[i].head); |
4161 | + INIT_HLIST_NULLS_HEAD(&h->listening_hash[i].nulls_head, |
4162 | + i + LISTENING_NULLS_BASE); |
4163 | } |
4164 | } |
4165 | EXPORT_SYMBOL_GPL(inet_hashinfo_init); |
4166 | diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
4167 | index cced424e1176..e1cf810140b0 100644 |
4168 | --- a/net/ipv4/tcp_ipv4.c |
4169 | +++ b/net/ipv4/tcp_ipv4.c |
4170 | @@ -1917,13 +1917,14 @@ static void *listening_get_next(struct seq_file *seq, void *cur) |
4171 | struct tcp_iter_state *st = seq->private; |
4172 | struct net *net = seq_file_net(seq); |
4173 | struct inet_listen_hashbucket *ilb; |
4174 | + struct hlist_nulls_node *node; |
4175 | struct sock *sk = cur; |
4176 | |
4177 | if (!sk) { |
4178 | get_head: |
4179 | ilb = &tcp_hashinfo.listening_hash[st->bucket]; |
4180 | spin_lock_bh(&ilb->lock); |
4181 | - sk = sk_head(&ilb->head); |
4182 | + sk = sk_nulls_head(&ilb->nulls_head); |
4183 | st->offset = 0; |
4184 | goto get_sk; |
4185 | } |
4186 | @@ -1931,9 +1932,9 @@ get_head: |
4187 | ++st->num; |
4188 | ++st->offset; |
4189 | |
4190 | - sk = sk_next(sk); |
4191 | + sk = sk_nulls_next(sk); |
4192 | get_sk: |
4193 | - sk_for_each_from(sk) { |
4194 | + sk_nulls_for_each_from(sk, node) { |
4195 | if (!net_eq(sock_net(sk), net)) |
4196 | continue; |
4197 | if (sk->sk_family == st->family) |
4198 | diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
4199 | index 73766c9c485d..ea7e9308c555 100644 |
4200 | --- a/net/ipv4/tcp_output.c |
4201 | +++ b/net/ipv4/tcp_output.c |
4202 | @@ -2233,6 +2233,14 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, |
4203 | if (tcp_small_queue_check(sk, skb, 0)) |
4204 | break; |
4205 | |
4206 | + /* Argh, we hit an empty skb(), presumably a thread |
4207 | + * is sleeping in sendmsg()/sk_stream_wait_memory(). |
4208 | + * We do not want to send a pure-ack packet and have |
4209 | + * a strange looking rtx queue with empty packet(s). |
4210 | + */ |
4211 | + if (TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq) |
4212 | + break; |
4213 | + |
4214 | if (unlikely(tcp_transmit_skb(sk, skb, 1, gfp))) |
4215 | break; |
4216 | |
4217 | diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c |
4218 | index 02761c9fe43e..d47cab6d7c6d 100644 |
4219 | --- a/net/ipv6/inet6_hashtables.c |
4220 | +++ b/net/ipv6/inet6_hashtables.c |
4221 | @@ -133,9 +133,10 @@ struct sock *inet6_lookup_listener(struct net *net, |
4222 | int score, hiscore = 0, matches = 0, reuseport = 0; |
4223 | bool exact_dif = inet6_exact_dif_match(net, skb); |
4224 | struct sock *sk, *result = NULL; |
4225 | + struct hlist_nulls_node *node; |
4226 | u32 phash = 0; |
4227 | |
4228 | - sk_for_each(sk, &ilb->head) { |
4229 | + sk_nulls_for_each(sk, node, &ilb->nulls_head) { |
4230 | score = compute_score(sk, net, hnum, daddr, dif, exact_dif); |
4231 | if (score > hiscore) { |
4232 | reuseport = sk->sk_reuseport; |
4233 | diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c |
4234 | index c468eabd6943..90268b642907 100644 |
4235 | --- a/net/nfc/nci/uart.c |
4236 | +++ b/net/nfc/nci/uart.c |
4237 | @@ -348,7 +348,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, |
4238 | nu->rx_packet_len = -1; |
4239 | nu->rx_skb = nci_skb_alloc(nu->ndev, |
4240 | NCI_MAX_PACKET_SIZE, |
4241 | - GFP_KERNEL); |
4242 | + GFP_ATOMIC); |
4243 | if (!nu->rx_skb) |
4244 | return -ENOMEM; |
4245 | } |
4246 | diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
4247 | index b1dbea544d64..40cade140222 100644 |
4248 | --- a/net/packet/af_packet.c |
4249 | +++ b/net/packet/af_packet.c |
4250 | @@ -587,7 +587,8 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po, |
4251 | msec = 1; |
4252 | div = ecmd.base.speed / 1000; |
4253 | } |
4254 | - } |
4255 | + } else |
4256 | + return DEFAULT_PRB_RETIRE_TOV; |
4257 | |
4258 | mbits = (blk_size_in_bytes * 8) / (1024 * 1024); |
4259 | |
4260 | diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c |
4261 | index 9cb06ca4eaba..446503d3b80c 100644 |
4262 | --- a/net/sctp/protocol.c |
4263 | +++ b/net/sctp/protocol.c |
4264 | @@ -257,6 +257,7 @@ static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk) |
4265 | addr->v4.sin_family = AF_INET; |
4266 | addr->v4.sin_port = 0; |
4267 | addr->v4.sin_addr.s_addr = inet_sk(sk)->inet_rcv_saddr; |
4268 | + memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
4269 | } |
4270 | |
4271 | /* Initialize sk->sk_rcv_saddr from sctp_addr. */ |
4272 | @@ -279,6 +280,7 @@ static void sctp_v4_from_addr_param(union sctp_addr *addr, |
4273 | addr->v4.sin_family = AF_INET; |
4274 | addr->v4.sin_port = port; |
4275 | addr->v4.sin_addr.s_addr = param->v4.addr.s_addr; |
4276 | + memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
4277 | } |
4278 | |
4279 | /* Initialize an address parameter from a sctp_addr and return the length |
4280 | @@ -303,6 +305,7 @@ static void sctp_v4_dst_saddr(union sctp_addr *saddr, struct flowi4 *fl4, |
4281 | saddr->v4.sin_family = AF_INET; |
4282 | saddr->v4.sin_port = port; |
4283 | saddr->v4.sin_addr.s_addr = fl4->saddr; |
4284 | + memset(saddr->v4.sin_zero, 0, sizeof(saddr->v4.sin_zero)); |
4285 | } |
4286 | |
4287 | /* Compare two addresses exactly. */ |
4288 | @@ -325,6 +328,7 @@ static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port) |
4289 | addr->v4.sin_family = AF_INET; |
4290 | addr->v4.sin_addr.s_addr = htonl(INADDR_ANY); |
4291 | addr->v4.sin_port = port; |
4292 | + memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
4293 | } |
4294 | |
4295 | /* Is this a wildcard address? */ |
4296 | diff --git a/samples/pktgen/functions.sh b/samples/pktgen/functions.sh |
4297 | index 205e4cde4601..065a7e296ee3 100644 |
4298 | --- a/samples/pktgen/functions.sh |
4299 | +++ b/samples/pktgen/functions.sh |
4300 | @@ -5,6 +5,8 @@ |
4301 | # Author: Jesper Dangaaard Brouer |
4302 | # License: GPL |
4303 | |
4304 | +set -o errexit |
4305 | + |
4306 | ## -- General shell logging cmds -- |
4307 | function err() { |
4308 | local exitcode=$1 |
4309 | @@ -58,6 +60,7 @@ function pg_set() { |
4310 | function proc_cmd() { |
4311 | local result |
4312 | local proc_file=$1 |
4313 | + local status=0 |
4314 | # after shift, the remaining args are contained in $@ |
4315 | shift |
4316 | local proc_ctrl=${PROC_DIR}/$proc_file |
4317 | @@ -73,13 +76,13 @@ function proc_cmd() { |
4318 | echo "cmd: $@ > $proc_ctrl" |
4319 | fi |
4320 | # Quoting of "$@" is important for space expansion |
4321 | - echo "$@" > "$proc_ctrl" |
4322 | - local status=$? |
4323 | + echo "$@" > "$proc_ctrl" || status=$? |
4324 | |
4325 | - result=$(grep "Result: OK:" $proc_ctrl) |
4326 | - # Due to pgctrl, cannot use exit code $? from grep |
4327 | - if [[ "$result" == "" ]]; then |
4328 | - grep "Result:" $proc_ctrl >&2 |
4329 | + if [[ "$proc_file" != "pgctrl" ]]; then |
4330 | + result=$(grep "Result: OK:" $proc_ctrl) || true |
4331 | + if [[ "$result" == "" ]]; then |
4332 | + grep "Result:" $proc_ctrl >&2 |
4333 | + fi |
4334 | fi |
4335 | if (( $status != 0 )); then |
4336 | err 5 "Write error($status) occurred cmd: \"$@ > $proc_ctrl\"" |
4337 | @@ -105,6 +108,8 @@ function pgset() { |
4338 | fi |
4339 | } |
4340 | |
4341 | +[[ $EUID -eq 0 ]] && trap 'pg_ctrl "reset"' EXIT |
4342 | + |
4343 | ## -- General shell tricks -- |
4344 | |
4345 | function root_check_run_with_sudo() { |
4346 | diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c |
4347 | index 2c8b8c662da5..6402b0d36291 100644 |
4348 | --- a/scripts/kallsyms.c |
4349 | +++ b/scripts/kallsyms.c |
4350 | @@ -498,6 +498,8 @@ static void build_initial_tok_table(void) |
4351 | table[pos] = table[i]; |
4352 | learn_symbol(table[pos].sym, table[pos].len); |
4353 | pos++; |
4354 | + } else { |
4355 | + free(table[i].sym); |
4356 | } |
4357 | } |
4358 | table_cnt = pos; |
4359 | diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c |
4360 | index b4809844bb1c..2376b09c35cf 100644 |
4361 | --- a/sound/core/pcm_native.c |
4362 | +++ b/sound/core/pcm_native.c |
4363 | @@ -587,6 +587,10 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
4364 | while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) |
4365 | runtime->boundary *= 2; |
4366 | |
4367 | + /* clear the buffer for avoiding possible kernel info leaks */ |
4368 | + if (runtime->dma_area) |
4369 | + memset(runtime->dma_area, 0, runtime->dma_bytes); |
4370 | + |
4371 | snd_pcm_timer_resolution_change(substream); |
4372 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP); |
4373 | |
4374 | diff --git a/sound/core/timer.c b/sound/core/timer.c |
4375 | index e944d27f79c3..f8a4b2a2f8f6 100644 |
4376 | --- a/sound/core/timer.c |
4377 | +++ b/sound/core/timer.c |
4378 | @@ -87,6 +87,9 @@ static LIST_HEAD(snd_timer_slave_list); |
4379 | /* lock for slave active lists */ |
4380 | static DEFINE_SPINLOCK(slave_active_lock); |
4381 | |
4382 | +#define MAX_SLAVE_INSTANCES 1000 |
4383 | +static int num_slaves; |
4384 | + |
4385 | static DEFINE_MUTEX(register_mutex); |
4386 | |
4387 | static int snd_timer_free(struct snd_timer *timer); |
4388 | @@ -265,6 +268,10 @@ int snd_timer_open(struct snd_timer_instance **ti, |
4389 | err = -EINVAL; |
4390 | goto unlock; |
4391 | } |
4392 | + if (num_slaves >= MAX_SLAVE_INSTANCES) { |
4393 | + err = -EBUSY; |
4394 | + goto unlock; |
4395 | + } |
4396 | timeri = snd_timer_instance_new(owner, NULL); |
4397 | if (!timeri) { |
4398 | err = -ENOMEM; |
4399 | @@ -274,6 +281,7 @@ int snd_timer_open(struct snd_timer_instance **ti, |
4400 | timeri->slave_id = tid->device; |
4401 | timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; |
4402 | list_add_tail(&timeri->open_list, &snd_timer_slave_list); |
4403 | + num_slaves++; |
4404 | err = snd_timer_check_slave(timeri); |
4405 | if (err < 0) { |
4406 | snd_timer_close_locked(timeri, &card_dev_to_put); |
4407 | @@ -363,6 +371,8 @@ static int snd_timer_close_locked(struct snd_timer_instance *timeri, |
4408 | struct snd_timer_instance *slave, *tmp; |
4409 | |
4410 | list_del(&timeri->open_list); |
4411 | + if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) |
4412 | + num_slaves--; |
4413 | |
4414 | /* force to stop the timer */ |
4415 | snd_timer_stop(timeri); |
4416 | diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c |
4417 | index c5e82329348b..bd0e4710d15d 100644 |
4418 | --- a/sound/pci/hda/hda_controller.c |
4419 | +++ b/sound/pci/hda/hda_controller.c |
4420 | @@ -872,7 +872,7 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, |
4421 | return -EAGAIN; /* give a chance to retry */ |
4422 | } |
4423 | |
4424 | - dev_WARN(chip->card->dev, |
4425 | + dev_err(chip->card->dev, |
4426 | "azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n", |
4427 | bus->last_cmd[addr]); |
4428 | chip->single_cmd = 1; |
4429 | diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c |
4430 | index 475b2c6c43d6..bf7593f234f6 100644 |
4431 | --- a/sound/pci/hda/patch_ca0132.c |
4432 | +++ b/sound/pci/hda/patch_ca0132.c |
4433 | @@ -1300,13 +1300,14 @@ struct scp_msg { |
4434 | |
4435 | static void dspio_clear_response_queue(struct hda_codec *codec) |
4436 | { |
4437 | + unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
4438 | unsigned int dummy = 0; |
4439 | - int status = -1; |
4440 | + int status; |
4441 | |
4442 | /* clear all from the response queue */ |
4443 | do { |
4444 | status = dspio_read(codec, &dummy); |
4445 | - } while (status == 0); |
4446 | + } while (status == 0 && time_before(jiffies, timeout)); |
4447 | } |
4448 | |
4449 | static int dspio_get_response_data(struct hda_codec *codec) |
4450 | @@ -4424,12 +4425,14 @@ static void ca0132_process_dsp_response(struct hda_codec *codec, |
4451 | struct ca0132_spec *spec = codec->spec; |
4452 | |
4453 | codec_dbg(codec, "ca0132_process_dsp_response\n"); |
4454 | + snd_hda_power_up_pm(codec); |
4455 | if (spec->wait_scp) { |
4456 | if (dspio_get_response_data(codec) >= 0) |
4457 | spec->wait_scp = 0; |
4458 | } |
4459 | |
4460 | dspio_clear_response_queue(codec); |
4461 | + snd_hda_power_down_pm(codec); |
4462 | } |
4463 | |
4464 | static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
4465 | diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c |
4466 | index 65ac4518ad06..49ab26e69f2f 100644 |
4467 | --- a/sound/soc/codecs/rt5677.c |
4468 | +++ b/sound/soc/codecs/rt5677.c |
4469 | @@ -305,6 +305,7 @@ static bool rt5677_volatile_register(struct device *dev, unsigned int reg) |
4470 | case RT5677_I2C_MASTER_CTRL7: |
4471 | case RT5677_I2C_MASTER_CTRL8: |
4472 | case RT5677_HAP_GENE_CTRL2: |
4473 | + case RT5677_PWR_ANLG2: /* Modified by DSP firmware */ |
4474 | case RT5677_PWR_DSP_ST: |
4475 | case RT5677_PRIV_DATA: |
4476 | case RT5677_ASRC_22: |
4477 | diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c |
4478 | index 5e10ba796a6f..569bceff5f51 100644 |
4479 | --- a/tools/lib/traceevent/parse-filter.c |
4480 | +++ b/tools/lib/traceevent/parse-filter.c |
4481 | @@ -1492,8 +1492,10 @@ static int copy_filter_type(struct event_filter *filter, |
4482 | if (strcmp(str, "TRUE") == 0 || strcmp(str, "FALSE") == 0) { |
4483 | /* Add trivial event */ |
4484 | arg = allocate_arg(); |
4485 | - if (arg == NULL) |
4486 | + if (arg == NULL) { |
4487 | + free(str); |
4488 | return -1; |
4489 | + } |
4490 | |
4491 | arg->type = FILTER_ARG_BOOLEAN; |
4492 | if (strcmp(str, "TRUE") == 0) |
4493 | @@ -1502,8 +1504,11 @@ static int copy_filter_type(struct event_filter *filter, |
4494 | arg->boolean.value = 0; |
4495 | |
4496 | filter_type = add_filter_type(filter, event->id); |
4497 | - if (filter_type == NULL) |
4498 | + if (filter_type == NULL) { |
4499 | + free(str); |
4500 | + free_arg(arg); |
4501 | return -1; |
4502 | + } |
4503 | |
4504 | filter_type->filter = arg; |
4505 | |
4506 | diff --git a/tools/objtool/arch/x86/lib/x86-opcode-map.txt b/tools/objtool/arch/x86/lib/x86-opcode-map.txt |
4507 | index 1754e094bc28..0f7eb4f5bdb7 100644 |
4508 | --- a/tools/objtool/arch/x86/lib/x86-opcode-map.txt |
4509 | +++ b/tools/objtool/arch/x86/lib/x86-opcode-map.txt |
4510 | @@ -333,7 +333,7 @@ AVXcode: 1 |
4511 | 06: CLTS |
4512 | 07: SYSRET (o64) |
4513 | 08: INVD |
4514 | -09: WBINVD |
4515 | +09: WBINVD | WBNOINVD (F3) |
4516 | 0a: |
4517 | 0b: UD2 (1B) |
4518 | 0c: |
4519 | @@ -364,7 +364,7 @@ AVXcode: 1 |
4520 | # a ModR/M byte. |
4521 | 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev |
4522 | 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv |
4523 | -1c: |
4524 | +1c: Grp20 (1A),(1C) |
4525 | 1d: |
4526 | 1e: |
4527 | 1f: NOP Ev |
4528 | @@ -792,6 +792,8 @@ f3: Grp17 (1A) |
4529 | f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) |
4530 | f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) |
4531 | f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) |
4532 | +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) |
4533 | +f9: MOVDIRI My,Gy |
4534 | EndTable |
4535 | |
4536 | Table: 3-byte opcode 2 (0x0f 0x3a) |
4537 | @@ -943,9 +945,9 @@ GrpTable: Grp6 |
4538 | EndTable |
4539 | |
4540 | GrpTable: Grp7 |
4541 | -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) |
4542 | -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) |
4543 | -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) |
4544 | +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) |
4545 | +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) |
4546 | +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) |
4547 | 3: LIDT Ms |
4548 | 4: SMSW Mw/Rv |
4549 | 5: rdpkru (110),(11B) | wrpkru (111),(11B) |
4550 | @@ -1011,7 +1013,7 @@ GrpTable: Grp15 |
4551 | 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) |
4552 | 4: XSAVE |
4553 | 5: XRSTOR | lfence (11B) |
4554 | -6: XSAVEOPT | clwb (66) | mfence (11B) |
4555 | +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) |
4556 | 7: clflush | clflushopt (66) | sfence (11B) |
4557 | EndTable |
4558 | |
4559 | @@ -1042,6 +1044,10 @@ GrpTable: Grp19 |
4560 | 6: vscatterpf1qps/d Wx (66),(ev) |
4561 | EndTable |
4562 | |
4563 | +GrpTable: Grp20 |
4564 | +0: cldemote Mb |
4565 | +EndTable |
4566 | + |
4567 | # AMD's Prefetch Group |
4568 | GrpTable: GrpP |
4569 | 0: PREFETCH |
4570 | diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c |
4571 | index 6e88460cd13d..33ff5c843346 100644 |
4572 | --- a/tools/perf/builtin-report.c |
4573 | +++ b/tools/perf/builtin-report.c |
4574 | @@ -292,6 +292,13 @@ static int report__setup_sample_type(struct report *rep) |
4575 | PERF_SAMPLE_BRANCH_ANY)) |
4576 | rep->nonany_branch_mode = true; |
4577 | |
4578 | +#ifndef HAVE_LIBUNWIND_SUPPORT |
4579 | + if (dwarf_callchain_users) { |
4580 | + ui__warning("Please install libunwind development packages " |
4581 | + "during the perf build.\n"); |
4582 | + } |
4583 | +#endif |
4584 | + |
4585 | return 0; |
4586 | } |
4587 | |
4588 | diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c |
4589 | index b0d005d295a9..de2ddfe0f7c3 100644 |
4590 | --- a/tools/perf/tests/task-exit.c |
4591 | +++ b/tools/perf/tests/task-exit.c |
4592 | @@ -98,6 +98,7 @@ int test__task_exit(int subtest __maybe_unused) |
4593 | if (perf_evlist__mmap(evlist, 128, true) < 0) { |
4594 | pr_debug("failed to mmap events: %d (%s)\n", errno, |
4595 | str_error_r(errno, sbuf, sizeof(sbuf))); |
4596 | + err = -1; |
4597 | goto out_delete_evlist; |
4598 | } |
4599 | |
4600 | diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c |
4601 | index 41e068e94349..fb4e1d2839c5 100644 |
4602 | --- a/tools/perf/util/dwarf-aux.c |
4603 | +++ b/tools/perf/util/dwarf-aux.c |
4604 | @@ -317,21 +317,51 @@ bool die_is_func_def(Dwarf_Die *dw_die) |
4605 | dwarf_attr(dw_die, DW_AT_declaration, &attr) == NULL); |
4606 | } |
4607 | |
4608 | +/** |
4609 | + * die_entrypc - Returns entry PC (the lowest address) of a DIE |
4610 | + * @dw_die: a DIE |
4611 | + * @addr: where to store entry PC |
4612 | + * |
4613 | + * Since dwarf_entrypc() does not return entry PC if the DIE has only address |
4614 | + * range, we have to use this to retrieve the lowest address from the address |
4615 | + * range attribute. |
4616 | + */ |
4617 | +int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
4618 | +{ |
4619 | + Dwarf_Addr base, end; |
4620 | + |
4621 | + if (!addr) |
4622 | + return -EINVAL; |
4623 | + |
4624 | + if (dwarf_entrypc(dw_die, addr) == 0) |
4625 | + return 0; |
4626 | + |
4627 | + return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; |
4628 | +} |
4629 | + |
4630 | /** |
4631 | * die_is_func_instance - Ensure that this DIE is an instance of a subprogram |
4632 | * @dw_die: a DIE |
4633 | * |
4634 | * Ensure that this DIE is an instance (which has an entry address). |
4635 | - * This returns true if @dw_die is a function instance. If not, you need to |
4636 | - * call die_walk_instances() to find actual instances. |
4637 | + * This returns true if @dw_die is a function instance. If not, the @dw_die |
4638 | + * must be a prototype. You can use die_walk_instances() to find actual |
4639 | + * instances. |
4640 | **/ |
4641 | bool die_is_func_instance(Dwarf_Die *dw_die) |
4642 | { |
4643 | Dwarf_Addr tmp; |
4644 | + Dwarf_Attribute attr_mem; |
4645 | + int tag = dwarf_tag(dw_die); |
4646 | |
4647 | - /* Actually gcc optimizes non-inline as like as inlined */ |
4648 | - return !dwarf_func_inline(dw_die) && dwarf_entrypc(dw_die, &tmp) == 0; |
4649 | + if (tag != DW_TAG_subprogram && |
4650 | + tag != DW_TAG_inlined_subroutine) |
4651 | + return false; |
4652 | + |
4653 | + return dwarf_entrypc(dw_die, &tmp) == 0 || |
4654 | + dwarf_attr(dw_die, DW_AT_ranges, &attr_mem) != NULL; |
4655 | } |
4656 | + |
4657 | /** |
4658 | * die_get_data_member_location - Get the data-member offset |
4659 | * @mb_die: a DIE of a member of a data structure |
4660 | @@ -608,6 +638,9 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data) |
4661 | Dwarf_Die *origin; |
4662 | int tmp; |
4663 | |
4664 | + if (!die_is_func_instance(inst)) |
4665 | + return DIE_FIND_CB_CONTINUE; |
4666 | + |
4667 | attr = dwarf_attr(inst, DW_AT_abstract_origin, &attr_mem); |
4668 | if (attr == NULL) |
4669 | return DIE_FIND_CB_CONTINUE; |
4670 | @@ -679,15 +712,14 @@ static int __die_walk_funclines_cb(Dwarf_Die *in_die, void *data) |
4671 | if (dwarf_tag(in_die) == DW_TAG_inlined_subroutine) { |
4672 | fname = die_get_call_file(in_die); |
4673 | lineno = die_get_call_lineno(in_die); |
4674 | - if (fname && lineno > 0 && dwarf_entrypc(in_die, &addr) == 0) { |
4675 | + if (fname && lineno > 0 && die_entrypc(in_die, &addr) == 0) { |
4676 | lw->retval = lw->callback(fname, lineno, addr, lw->data); |
4677 | if (lw->retval != 0) |
4678 | return DIE_FIND_CB_END; |
4679 | } |
4680 | + if (!lw->recursive) |
4681 | + return DIE_FIND_CB_SIBLING; |
4682 | } |
4683 | - if (!lw->recursive) |
4684 | - /* Don't need to search recursively */ |
4685 | - return DIE_FIND_CB_SIBLING; |
4686 | |
4687 | if (addr) { |
4688 | fname = dwarf_decl_file(in_die); |
4689 | @@ -720,7 +752,7 @@ static int __die_walk_funclines(Dwarf_Die *sp_die, bool recursive, |
4690 | /* Handle function declaration line */ |
4691 | fname = dwarf_decl_file(sp_die); |
4692 | if (fname && dwarf_decl_line(sp_die, &lineno) == 0 && |
4693 | - dwarf_entrypc(sp_die, &addr) == 0) { |
4694 | + die_entrypc(sp_die, &addr) == 0) { |
4695 | lw.retval = callback(fname, lineno, addr, data); |
4696 | if (lw.retval != 0) |
4697 | goto done; |
4698 | @@ -734,6 +766,10 @@ static int __die_walk_culines_cb(Dwarf_Die *sp_die, void *data) |
4699 | { |
4700 | struct __line_walk_param *lw = data; |
4701 | |
4702 | + /* |
4703 | + * Since inlined function can include another inlined function in |
4704 | + * the same file, we need to walk in it recursively. |
4705 | + */ |
4706 | lw->retval = __die_walk_funclines(sp_die, true, lw->callback, lw->data); |
4707 | if (lw->retval != 0) |
4708 | return DWARF_CB_ABORT; |
4709 | @@ -758,11 +794,12 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
4710 | Dwarf_Lines *lines; |
4711 | Dwarf_Line *line; |
4712 | Dwarf_Addr addr; |
4713 | - const char *fname, *decf = NULL; |
4714 | + const char *fname, *decf = NULL, *inf = NULL; |
4715 | int lineno, ret = 0; |
4716 | int decl = 0, inl; |
4717 | Dwarf_Die die_mem, *cu_die; |
4718 | size_t nlines, i; |
4719 | + bool flag; |
4720 | |
4721 | /* Get the CU die */ |
4722 | if (dwarf_tag(rt_die) != DW_TAG_compile_unit) { |
4723 | @@ -793,6 +830,12 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
4724 | "Possible error in debuginfo.\n"); |
4725 | continue; |
4726 | } |
4727 | + /* Skip end-of-sequence */ |
4728 | + if (dwarf_lineendsequence(line, &flag) != 0 || flag) |
4729 | + continue; |
4730 | + /* Skip Non statement line-info */ |
4731 | + if (dwarf_linebeginstatement(line, &flag) != 0 || !flag) |
4732 | + continue; |
4733 | /* Filter lines based on address */ |
4734 | if (rt_die != cu_die) { |
4735 | /* |
4736 | @@ -802,13 +845,21 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
4737 | */ |
4738 | if (!dwarf_haspc(rt_die, addr)) |
4739 | continue; |
4740 | + |
4741 | if (die_find_inlinefunc(rt_die, addr, &die_mem)) { |
4742 | + /* Call-site check */ |
4743 | + inf = die_get_call_file(&die_mem); |
4744 | + if ((inf && !strcmp(inf, decf)) && |
4745 | + die_get_call_lineno(&die_mem) == lineno) |
4746 | + goto found; |
4747 | + |
4748 | dwarf_decl_line(&die_mem, &inl); |
4749 | if (inl != decl || |
4750 | decf != dwarf_decl_file(&die_mem)) |
4751 | continue; |
4752 | } |
4753 | } |
4754 | +found: |
4755 | /* Get source line */ |
4756 | fname = dwarf_linesrc(line, NULL, NULL); |
4757 | |
4758 | @@ -823,8 +874,9 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
4759 | */ |
4760 | if (rt_die != cu_die) |
4761 | /* |
4762 | - * Don't need walk functions recursively, because nested |
4763 | - * inlined functions don't have lines of the specified DIE. |
4764 | + * Don't need walk inlined functions recursively, because |
4765 | + * inner inlined functions don't have the lines of the |
4766 | + * specified function. |
4767 | */ |
4768 | ret = __die_walk_funclines(rt_die, false, callback, data); |
4769 | else { |
4770 | @@ -999,7 +1051,7 @@ static int die_get_var_innermost_scope(Dwarf_Die *sp_die, Dwarf_Die *vr_die, |
4771 | bool first = true; |
4772 | const char *name; |
4773 | |
4774 | - ret = dwarf_entrypc(sp_die, &entry); |
4775 | + ret = die_entrypc(sp_die, &entry); |
4776 | if (ret) |
4777 | return ret; |
4778 | |
4779 | @@ -1062,7 +1114,7 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf) |
4780 | bool first = true; |
4781 | const char *name; |
4782 | |
4783 | - ret = dwarf_entrypc(sp_die, &entry); |
4784 | + ret = die_entrypc(sp_die, &entry); |
4785 | if (ret) |
4786 | return ret; |
4787 | |
4788 | diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h |
4789 | index 8ac53bf1ec4e..ee15fac4e1d0 100644 |
4790 | --- a/tools/perf/util/dwarf-aux.h |
4791 | +++ b/tools/perf/util/dwarf-aux.h |
4792 | @@ -41,6 +41,9 @@ int cu_walk_functions_at(Dwarf_Die *cu_die, Dwarf_Addr addr, |
4793 | /* Get DW_AT_linkage_name (should be NULL for C binary) */ |
4794 | const char *die_get_linkage_name(Dwarf_Die *dw_die); |
4795 | |
4796 | +/* Get the lowest PC in DIE (including range list) */ |
4797 | +int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr); |
4798 | + |
4799 | /* Ensure that this DIE is a subprogram and definition (not declaration) */ |
4800 | bool die_is_func_def(Dwarf_Die *dw_die); |
4801 | |
4802 | diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h |
4803 | index 679d6e493962..e6324397b295 100644 |
4804 | --- a/tools/perf/util/perf_regs.h |
4805 | +++ b/tools/perf/util/perf_regs.h |
4806 | @@ -26,7 +26,7 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); |
4807 | |
4808 | static inline const char *perf_reg_name(int id __maybe_unused) |
4809 | { |
4810 | - return NULL; |
4811 | + return "unknown"; |
4812 | } |
4813 | |
4814 | static inline int perf_reg_value(u64 *valp __maybe_unused, |
4815 | diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c |
4816 | index 0d9d6e0803b8..6ca804a01cf9 100644 |
4817 | --- a/tools/perf/util/probe-finder.c |
4818 | +++ b/tools/perf/util/probe-finder.c |
4819 | @@ -764,6 +764,16 @@ static int find_best_scope_cb(Dwarf_Die *fn_die, void *data) |
4820 | return 0; |
4821 | } |
4822 | |
4823 | +/* Return innermost DIE */ |
4824 | +static int find_inner_scope_cb(Dwarf_Die *fn_die, void *data) |
4825 | +{ |
4826 | + struct find_scope_param *fsp = data; |
4827 | + |
4828 | + memcpy(fsp->die_mem, fn_die, sizeof(Dwarf_Die)); |
4829 | + fsp->found = true; |
4830 | + return 1; |
4831 | +} |
4832 | + |
4833 | /* Find an appropriate scope fits to given conditions */ |
4834 | static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) |
4835 | { |
4836 | @@ -775,8 +785,13 @@ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) |
4837 | .die_mem = die_mem, |
4838 | .found = false, |
4839 | }; |
4840 | + int ret; |
4841 | |
4842 | - cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, &fsp); |
4843 | + ret = cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, |
4844 | + &fsp); |
4845 | + if (!ret && !fsp.found) |
4846 | + cu_walk_functions_at(&pf->cu_die, pf->addr, |
4847 | + find_inner_scope_cb, &fsp); |
4848 | |
4849 | return fsp.found ? die_mem : NULL; |
4850 | } |
4851 | @@ -950,7 +965,7 @@ static int probe_point_inline_cb(Dwarf_Die *in_die, void *data) |
4852 | ret = find_probe_point_lazy(in_die, pf); |
4853 | else { |
4854 | /* Get probe address */ |
4855 | - if (dwarf_entrypc(in_die, &addr) != 0) { |
4856 | + if (die_entrypc(in_die, &addr) != 0) { |
4857 | pr_warning("Failed to get entry address of %s.\n", |
4858 | dwarf_diename(in_die)); |
4859 | return -ENOENT; |
4860 | @@ -1002,7 +1017,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) |
4861 | param->retval = find_probe_point_by_line(pf); |
4862 | } else if (die_is_func_instance(sp_die)) { |
4863 | /* Instances always have the entry address */ |
4864 | - dwarf_entrypc(sp_die, &pf->addr); |
4865 | + die_entrypc(sp_die, &pf->addr); |
4866 | /* But in some case the entry address is 0 */ |
4867 | if (pf->addr == 0) { |
4868 | pr_debug("%s has no entry PC. Skipped\n", |
4869 | @@ -1414,6 +1429,18 @@ error: |
4870 | return DIE_FIND_CB_END; |
4871 | } |
4872 | |
4873 | +static bool available_var_finder_overlap(struct available_var_finder *af) |
4874 | +{ |
4875 | + int i; |
4876 | + |
4877 | + for (i = 0; i < af->nvls; i++) { |
4878 | + if (af->pf.addr == af->vls[i].point.address) |
4879 | + return true; |
4880 | + } |
4881 | + return false; |
4882 | + |
4883 | +} |
4884 | + |
4885 | /* Add a found vars into available variables list */ |
4886 | static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) |
4887 | { |
4888 | @@ -1424,6 +1451,14 @@ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) |
4889 | Dwarf_Die die_mem; |
4890 | int ret; |
4891 | |
4892 | + /* |
4893 | + * For some reason (e.g. different column assigned to same address), |
4894 | + * this callback can be called with the address which already passed. |
4895 | + * Ignore it first. |
4896 | + */ |
4897 | + if (available_var_finder_overlap(af)) |
4898 | + return 0; |
4899 | + |
4900 | /* Check number of tevs */ |
4901 | if (af->nvls == af->max_vls) { |
4902 | pr_warning("Too many( > %d) probe point found.\n", af->max_vls); |
4903 | @@ -1567,7 +1602,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, |
4904 | /* Get function entry information */ |
4905 | func = basefunc = dwarf_diename(&spdie); |
4906 | if (!func || |
4907 | - dwarf_entrypc(&spdie, &baseaddr) != 0 || |
4908 | + die_entrypc(&spdie, &baseaddr) != 0 || |
4909 | dwarf_decl_line(&spdie, &baseline) != 0) { |
4910 | lineno = 0; |
4911 | goto post; |
4912 | @@ -1584,7 +1619,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, |
4913 | while (die_find_top_inlinefunc(&spdie, (Dwarf_Addr)addr, |
4914 | &indie)) { |
4915 | /* There is an inline function */ |
4916 | - if (dwarf_entrypc(&indie, &_addr) == 0 && |
4917 | + if (die_entrypc(&indie, &_addr) == 0 && |
4918 | _addr == addr) { |
4919 | /* |
4920 | * addr is at an inline function entry. |
4921 | diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c |
4922 | index 842cf3fd9235..d7e5c247c103 100644 |
4923 | --- a/tools/perf/util/strbuf.c |
4924 | +++ b/tools/perf/util/strbuf.c |
4925 | @@ -116,7 +116,6 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap) |
4926 | return ret; |
4927 | } |
4928 | len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved); |
4929 | - va_end(ap_saved); |
4930 | if (len > strbuf_avail(sb)) { |
4931 | pr_debug("this should not happen, your vsnprintf is broken"); |
4932 | va_end(ap_saved); |
4933 | diff --git a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
4934 | index ebeaba6571a3..475e18e04318 100644 |
4935 | --- a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
4936 | +++ b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
4937 | @@ -40,7 +40,6 @@ static cstate_t hsw_ext_cstates[HSW_EXT_CSTATE_COUNT] = { |
4938 | { |
4939 | .name = "PC9", |
4940 | .desc = N_("Processor Package C9"), |
4941 | - .desc = N_("Processor Package C2"), |
4942 | .id = PC9, |
4943 | .range = RANGE_PACKAGE, |
4944 | .get_count_percent = hsw_ext_get_count_percent, |