1 |
commit: b6151a96591ba6674a268e51f970194e17e1c454 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 4 16:46:03 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 4 16:46:03 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b6151a96 |
7 |
|
8 |
Linux patch 4.4.208 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1207_linux-4.4.208.patch | 3292 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3296 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index b0c8418..9a294a8 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -871,6 +871,10 @@ Patch: 1206_linux-4.4.207.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.4.207 |
23 |
|
24 |
+Patch: 1207_linux-4.4.208.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.4.208 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1207_linux-4.4.208.patch b/1207_linux-4.4.208.patch |
33 |
new file mode 100644 |
34 |
index 0000000..c514720 |
35 |
--- /dev/null |
36 |
+++ b/1207_linux-4.4.208.patch |
37 |
@@ -0,0 +1,3292 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 4857306a8e4c..84d74ea25d70 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 4 |
45 |
+-SUBLEVEL = 207 |
46 |
++SUBLEVEL = 208 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Blurry Fish Butt |
49 |
+ |
50 |
+diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h |
51 |
+index 005bf4ff1b4c..f3ddd4f599e3 100644 |
52 |
+--- a/arch/arm/boot/compressed/libfdt_env.h |
53 |
++++ b/arch/arm/boot/compressed/libfdt_env.h |
54 |
+@@ -1,11 +1,13 @@ |
55 |
+ #ifndef _ARM_LIBFDT_ENV_H |
56 |
+ #define _ARM_LIBFDT_ENV_H |
57 |
+ |
58 |
++#include <linux/limits.h> |
59 |
+ #include <linux/types.h> |
60 |
+ #include <linux/string.h> |
61 |
+ #include <asm/byteorder.h> |
62 |
+ |
63 |
+-#define INT_MAX ((int)(~0U>>1)) |
64 |
++#define INT32_MAX S32_MAX |
65 |
++#define UINT32_MAX U32_MAX |
66 |
+ |
67 |
+ typedef __be16 fdt16_t; |
68 |
+ typedef __be32 fdt32_t; |
69 |
+diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c |
70 |
+index f67f35b6edb1..e6ad81556575 100644 |
71 |
+--- a/arch/arm64/kernel/psci.c |
72 |
++++ b/arch/arm64/kernel/psci.c |
73 |
+@@ -151,7 +151,8 @@ static void cpu_psci_cpu_die(unsigned int cpu) |
74 |
+ |
75 |
+ static int cpu_psci_cpu_kill(unsigned int cpu) |
76 |
+ { |
77 |
+- int err, i; |
78 |
++ int err; |
79 |
++ unsigned long start, end; |
80 |
+ |
81 |
+ if (!psci_ops.affinity_info) |
82 |
+ return 0; |
83 |
+@@ -161,16 +162,18 @@ static int cpu_psci_cpu_kill(unsigned int cpu) |
84 |
+ * while it is dying. So, try again a few times. |
85 |
+ */ |
86 |
+ |
87 |
+- for (i = 0; i < 10; i++) { |
88 |
++ start = jiffies; |
89 |
++ end = start + msecs_to_jiffies(100); |
90 |
++ do { |
91 |
+ err = psci_ops.affinity_info(cpu_logical_map(cpu), 0); |
92 |
+ if (err == PSCI_0_2_AFFINITY_LEVEL_OFF) { |
93 |
+- pr_info("CPU%d killed.\n", cpu); |
94 |
++ pr_info("CPU%d killed (polled %d ms)\n", cpu, |
95 |
++ jiffies_to_msecs(jiffies - start)); |
96 |
+ return 0; |
97 |
+ } |
98 |
+ |
99 |
+- msleep(10); |
100 |
+- pr_info("Retrying again to check for CPU kill\n"); |
101 |
+- } |
102 |
++ usleep_range(100, 1000); |
103 |
++ } while (time_before(jiffies, end)); |
104 |
+ |
105 |
+ pr_warn("CPU%d may not have shut down cleanly (AFFINITY_INFO reports %d)\n", |
106 |
+ cpu, err); |
107 |
+diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h |
108 |
+index 0b3db6322c79..5f2cb1c53e15 100644 |
109 |
+--- a/arch/powerpc/boot/libfdt_env.h |
110 |
++++ b/arch/powerpc/boot/libfdt_env.h |
111 |
+@@ -5,6 +5,8 @@ |
112 |
+ #include <string.h> |
113 |
+ |
114 |
+ #define INT_MAX ((int)(~0U>>1)) |
115 |
++#define UINT32_MAX ((u32)~0U) |
116 |
++#define INT32_MAX ((s32)(UINT32_MAX >> 1)) |
117 |
+ |
118 |
+ #include "of.h" |
119 |
+ |
120 |
+diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c |
121 |
+index 290559df1e8b..083c31d8459a 100644 |
122 |
+--- a/arch/powerpc/kernel/irq.c |
123 |
++++ b/arch/powerpc/kernel/irq.c |
124 |
+@@ -484,8 +484,6 @@ void __do_irq(struct pt_regs *regs) |
125 |
+ |
126 |
+ trace_irq_entry(regs); |
127 |
+ |
128 |
+- check_stack_overflow(); |
129 |
+- |
130 |
+ /* |
131 |
+ * Query the platform PIC for the interrupt & ack it. |
132 |
+ * |
133 |
+@@ -517,6 +515,8 @@ void do_IRQ(struct pt_regs *regs) |
134 |
+ irqtp = hardirq_ctx[raw_smp_processor_id()]; |
135 |
+ sirqtp = softirq_ctx[raw_smp_processor_id()]; |
136 |
+ |
137 |
++ check_stack_overflow(); |
138 |
++ |
139 |
+ /* Already there ? */ |
140 |
+ if (unlikely(curtp == irqtp || curtp == sirqtp)) { |
141 |
+ __do_irq(regs); |
142 |
+diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c |
143 |
+index 156cfe6d23b0..45778c83038f 100644 |
144 |
+--- a/arch/powerpc/kernel/security.c |
145 |
++++ b/arch/powerpc/kernel/security.c |
146 |
+@@ -135,32 +135,33 @@ ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, cha |
147 |
+ |
148 |
+ thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV); |
149 |
+ |
150 |
+- if (rfi_flush || thread_priv) { |
151 |
++ if (rfi_flush) { |
152 |
+ struct seq_buf s; |
153 |
+ seq_buf_init(&s, buf, PAGE_SIZE - 1); |
154 |
+ |
155 |
+- seq_buf_printf(&s, "Mitigation: "); |
156 |
+- |
157 |
+- if (rfi_flush) |
158 |
+- seq_buf_printf(&s, "RFI Flush"); |
159 |
+- |
160 |
+- if (rfi_flush && thread_priv) |
161 |
+- seq_buf_printf(&s, ", "); |
162 |
+- |
163 |
++ seq_buf_printf(&s, "Mitigation: RFI Flush"); |
164 |
+ if (thread_priv) |
165 |
+- seq_buf_printf(&s, "L1D private per thread"); |
166 |
++ seq_buf_printf(&s, ", L1D private per thread"); |
167 |
+ |
168 |
+ seq_buf_printf(&s, "\n"); |
169 |
+ |
170 |
+ return s.len; |
171 |
+ } |
172 |
+ |
173 |
++ if (thread_priv) |
174 |
++ return sprintf(buf, "Vulnerable: L1D private per thread\n"); |
175 |
++ |
176 |
+ if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) && |
177 |
+ !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR)) |
178 |
+ return sprintf(buf, "Not affected\n"); |
179 |
+ |
180 |
+ return sprintf(buf, "Vulnerable\n"); |
181 |
+ } |
182 |
++ |
183 |
++ssize_t cpu_show_l1tf(struct device *dev, struct device_attribute *attr, char *buf) |
184 |
++{ |
185 |
++ return cpu_show_meltdown(dev, attr, buf); |
186 |
++} |
187 |
+ #endif |
188 |
+ |
189 |
+ ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf) |
190 |
+diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c |
191 |
+index 2e9cae5f8d17..397076474a71 100644 |
192 |
+--- a/arch/powerpc/kernel/time.c |
193 |
++++ b/arch/powerpc/kernel/time.c |
194 |
+@@ -245,7 +245,7 @@ static u64 scan_dispatch_log(u64 stop_tb) |
195 |
+ * Accumulate stolen time by scanning the dispatch trace log. |
196 |
+ * Called on entry from user mode. |
197 |
+ */ |
198 |
+-void accumulate_stolen_time(void) |
199 |
++void notrace accumulate_stolen_time(void) |
200 |
+ { |
201 |
+ u64 sst, ust; |
202 |
+ |
203 |
+diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c |
204 |
+index fc44ad0475f8..b126ce49ae7b 100644 |
205 |
+--- a/arch/powerpc/platforms/pseries/cmm.c |
206 |
++++ b/arch/powerpc/platforms/pseries/cmm.c |
207 |
+@@ -391,6 +391,10 @@ static struct bus_type cmm_subsys = { |
208 |
+ .dev_name = "cmm", |
209 |
+ }; |
210 |
+ |
211 |
++static void cmm_release_device(struct device *dev) |
212 |
++{ |
213 |
++} |
214 |
++ |
215 |
+ /** |
216 |
+ * cmm_sysfs_register - Register with sysfs |
217 |
+ * |
218 |
+@@ -406,6 +410,7 @@ static int cmm_sysfs_register(struct device *dev) |
219 |
+ |
220 |
+ dev->id = 0; |
221 |
+ dev->bus = &cmm_subsys; |
222 |
++ dev->release = cmm_release_device; |
223 |
+ |
224 |
+ if ((rc = device_register(dev))) |
225 |
+ goto subsys_unregister; |
226 |
+diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c |
227 |
+index 874762a51c54..7490c52b2715 100644 |
228 |
+--- a/arch/s390/kernel/perf_cpum_sf.c |
229 |
++++ b/arch/s390/kernel/perf_cpum_sf.c |
230 |
+@@ -185,7 +185,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
231 |
+ unsigned long num_sdb, gfp_t gfp_flags) |
232 |
+ { |
233 |
+ int i, rc; |
234 |
+- unsigned long *new, *tail; |
235 |
++ unsigned long *new, *tail, *tail_prev = NULL; |
236 |
+ |
237 |
+ if (!sfb->sdbt || !sfb->tail) |
238 |
+ return -EINVAL; |
239 |
+@@ -224,6 +224,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
240 |
+ sfb->num_sdbt++; |
241 |
+ /* Link current page to tail of chain */ |
242 |
+ *tail = (unsigned long)(void *) new + 1; |
243 |
++ tail_prev = tail; |
244 |
+ tail = new; |
245 |
+ } |
246 |
+ |
247 |
+@@ -233,10 +234,22 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, |
248 |
+ * issue, a new realloc call (if required) might succeed. |
249 |
+ */ |
250 |
+ rc = alloc_sample_data_block(tail, gfp_flags); |
251 |
+- if (rc) |
252 |
++ if (rc) { |
253 |
++ /* Undo last SDBT. An SDBT with no SDB at its first |
254 |
++ * entry but with an SDBT entry instead can not be |
255 |
++ * handled by the interrupt handler code. |
256 |
++ * Avoid this situation. |
257 |
++ */ |
258 |
++ if (tail_prev) { |
259 |
++ sfb->num_sdbt--; |
260 |
++ free_page((unsigned long) new); |
261 |
++ tail = tail_prev; |
262 |
++ } |
263 |
+ break; |
264 |
++ } |
265 |
+ sfb->num_sdb++; |
266 |
+ tail++; |
267 |
++ tail_prev = new = NULL; /* Allocated at least one SBD */ |
268 |
+ } |
269 |
+ |
270 |
+ /* Link sampling buffer to its origin */ |
271 |
+diff --git a/arch/sh/include/cpu-sh4/cpu/sh7734.h b/arch/sh/include/cpu-sh4/cpu/sh7734.h |
272 |
+index 2fb9a7b71b41..a2667c9b5819 100644 |
273 |
+--- a/arch/sh/include/cpu-sh4/cpu/sh7734.h |
274 |
++++ b/arch/sh/include/cpu-sh4/cpu/sh7734.h |
275 |
+@@ -133,7 +133,7 @@ enum { |
276 |
+ GPIO_FN_EX_WAIT1, GPIO_FN_SD1_DAT0_A, GPIO_FN_DREQ2, GPIO_FN_CAN1_TX_C, |
277 |
+ GPIO_FN_ET0_LINK_C, GPIO_FN_ET0_ETXD5_A, |
278 |
+ GPIO_FN_EX_WAIT0, GPIO_FN_TCLK1_B, |
279 |
+- GPIO_FN_RD_WR, GPIO_FN_TCLK0, |
280 |
++ GPIO_FN_RD_WR, GPIO_FN_TCLK0, GPIO_FN_CAN_CLK_B, GPIO_FN_ET0_ETXD4, |
281 |
+ GPIO_FN_EX_CS5, GPIO_FN_SD1_CMD_A, GPIO_FN_ATADIR, GPIO_FN_QSSL_B, |
282 |
+ GPIO_FN_ET0_ETXD3_A, |
283 |
+ GPIO_FN_EX_CS4, GPIO_FN_SD1_WP_A, GPIO_FN_ATAWR, GPIO_FN_QMI_QIO1_B, |
284 |
+diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h |
285 |
+index f498411f2500..1b15304dd098 100644 |
286 |
+--- a/arch/x86/include/asm/crash.h |
287 |
++++ b/arch/x86/include/asm/crash.h |
288 |
+@@ -1,6 +1,8 @@ |
289 |
+ #ifndef _ASM_X86_CRASH_H |
290 |
+ #define _ASM_X86_CRASH_H |
291 |
+ |
292 |
++struct kimage; |
293 |
++ |
294 |
+ int crash_load_segments(struct kimage *image); |
295 |
+ int crash_copy_backup_region(struct kimage *image); |
296 |
+ int crash_setup_memmap_entries(struct kimage *image, |
297 |
+diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h |
298 |
+index f80d70009ff8..d0e39f54feee 100644 |
299 |
+--- a/arch/x86/include/asm/fixmap.h |
300 |
++++ b/arch/x86/include/asm/fixmap.h |
301 |
+@@ -147,7 +147,7 @@ extern pgprot_t kmap_prot; |
302 |
+ extern pte_t *pkmap_page_table; |
303 |
+ |
304 |
+ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); |
305 |
+-void native_set_fixmap(enum fixed_addresses idx, |
306 |
++void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, |
307 |
+ phys_addr_t phys, pgprot_t flags); |
308 |
+ |
309 |
+ #ifndef CONFIG_PARAVIRT |
310 |
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
311 |
+index 4d5e8ff3b5e5..5e8fc9809da3 100644 |
312 |
+--- a/arch/x86/kernel/apic/io_apic.c |
313 |
++++ b/arch/x86/kernel/apic/io_apic.c |
314 |
+@@ -1710,9 +1710,10 @@ static bool io_apic_level_ack_pending(struct mp_chip_data *data) |
315 |
+ |
316 |
+ static inline bool ioapic_irqd_mask(struct irq_data *data) |
317 |
+ { |
318 |
+- /* If we are moving the irq we need to mask it */ |
319 |
++ /* If we are moving the IRQ we need to mask it */ |
320 |
+ if (unlikely(irqd_is_setaffinity_pending(data))) { |
321 |
+- mask_ioapic_irq(data); |
322 |
++ if (!irqd_irq_masked(data)) |
323 |
++ mask_ioapic_irq(data); |
324 |
+ return true; |
325 |
+ } |
326 |
+ return false; |
327 |
+@@ -1749,7 +1750,9 @@ static inline void ioapic_irqd_unmask(struct irq_data *data, bool masked) |
328 |
+ */ |
329 |
+ if (!io_apic_level_ack_pending(data->chip_data)) |
330 |
+ irq_move_masked_irq(data); |
331 |
+- unmask_ioapic_irq(data); |
332 |
++ /* If the IRQ is masked in the core, leave it: */ |
333 |
++ if (!irqd_irq_masked(data)) |
334 |
++ unmask_ioapic_irq(data); |
335 |
+ } |
336 |
+ } |
337 |
+ #else |
338 |
+diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c |
339 |
+index 50f75768aadd..3ed4753280aa 100644 |
340 |
+--- a/arch/x86/mm/pgtable.c |
341 |
++++ b/arch/x86/mm/pgtable.c |
342 |
+@@ -567,8 +567,8 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) |
343 |
+ fixmaps_set++; |
344 |
+ } |
345 |
+ |
346 |
+-void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, |
347 |
+- pgprot_t flags) |
348 |
++void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, |
349 |
++ phys_addr_t phys, pgprot_t flags) |
350 |
+ { |
351 |
+ __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags)); |
352 |
+ } |
353 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
354 |
+index a352f09baef6..fc4bf8ff40ea 100644 |
355 |
+--- a/drivers/ata/libata-core.c |
356 |
++++ b/drivers/ata/libata-core.c |
357 |
+@@ -6355,6 +6355,9 @@ void ata_host_detach(struct ata_host *host) |
358 |
+ { |
359 |
+ int i; |
360 |
+ |
361 |
++ /* Ensure ata_port probe has completed */ |
362 |
++ async_synchronize_full(); |
363 |
++ |
364 |
+ for (i = 0; i < host->n_ports; i++) |
365 |
+ ata_port_detach(host->ports[i]); |
366 |
+ |
367 |
+diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c |
368 |
+index aee23092f50e..2c5feb6b4a99 100644 |
369 |
+--- a/drivers/cdrom/cdrom.c |
370 |
++++ b/drivers/cdrom/cdrom.c |
371 |
+@@ -998,6 +998,12 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype *tracks) |
372 |
+ tracks->xa = 0; |
373 |
+ tracks->error = 0; |
374 |
+ cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); |
375 |
++ |
376 |
++ if (!CDROM_CAN(CDC_PLAY_AUDIO)) { |
377 |
++ tracks->error = CDS_NO_INFO; |
378 |
++ return; |
379 |
++ } |
380 |
++ |
381 |
+ /* Grab the TOC header so we can see how many tracks there are */ |
382 |
+ ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header); |
383 |
+ if (ret) { |
384 |
+@@ -1164,7 +1170,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, |
385 |
+ ret = open_for_data(cdi); |
386 |
+ if (ret) |
387 |
+ goto err; |
388 |
+- cdrom_mmc3_profile(cdi); |
389 |
++ if (CDROM_CAN(CDC_GENERIC_PACKET)) |
390 |
++ cdrom_mmc3_profile(cdi); |
391 |
+ if (mode & FMODE_WRITE) { |
392 |
+ ret = -EROFS; |
393 |
+ if (cdrom_open_write(cdi)) |
394 |
+@@ -2863,6 +2870,9 @@ int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written) |
395 |
+ it doesn't give enough information or fails. then we return |
396 |
+ the toc contents. */ |
397 |
+ use_toc: |
398 |
++ if (!CDROM_CAN(CDC_PLAY_AUDIO)) |
399 |
++ return -ENOSYS; |
400 |
++ |
401 |
+ toc.cdte_format = CDROM_MSF; |
402 |
+ toc.cdte_track = CDROM_LEADOUT; |
403 |
+ if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &toc))) |
404 |
+diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c |
405 |
+index a405cdcd8dd2..4813f9406a8f 100644 |
406 |
+--- a/drivers/char/hw_random/omap3-rom-rng.c |
407 |
++++ b/drivers/char/hw_random/omap3-rom-rng.c |
408 |
+@@ -119,7 +119,8 @@ static int omap3_rom_rng_probe(struct platform_device *pdev) |
409 |
+ static int omap3_rom_rng_remove(struct platform_device *pdev) |
410 |
+ { |
411 |
+ hwrng_unregister(&omap3_rom_rng_ops); |
412 |
+- clk_disable_unprepare(rng_clk); |
413 |
++ if (!rng_idle) |
414 |
++ clk_disable_unprepare(rng_clk); |
415 |
+ return 0; |
416 |
+ } |
417 |
+ |
418 |
+diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c |
419 |
+index 5b82d30baf9f..bf47737b6672 100644 |
420 |
+--- a/drivers/clk/pxa/clk-pxa27x.c |
421 |
++++ b/drivers/clk/pxa/clk-pxa27x.c |
422 |
+@@ -362,6 +362,7 @@ struct dummy_clk { |
423 |
+ }; |
424 |
+ static struct dummy_clk dummy_clks[] __initdata = { |
425 |
+ DUMMY_CLK(NULL, "pxa27x-gpio", "osc_32_768khz"), |
426 |
++ DUMMY_CLK(NULL, "pxa-rtc", "osc_32_768khz"), |
427 |
+ DUMMY_CLK(NULL, "sa1100-rtc", "osc_32_768khz"), |
428 |
+ DUMMY_CLK("UARTCLK", "pxa2xx-ir", "STUART"), |
429 |
+ }; |
430 |
+diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c |
431 |
+index b544bb302f79..350a01f74870 100644 |
432 |
+--- a/drivers/clk/qcom/clk-rcg2.c |
433 |
++++ b/drivers/clk/qcom/clk-rcg2.c |
434 |
+@@ -196,6 +196,8 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, |
435 |
+ p = clk_hw_get_parent_by_index(hw, index); |
436 |
+ if (clk_flags & CLK_SET_RATE_PARENT) { |
437 |
+ if (f->pre_div) { |
438 |
++ if (!rate) |
439 |
++ rate = req->rate; |
440 |
+ rate /= 2; |
441 |
+ rate *= f->pre_div + 1; |
442 |
+ } |
443 |
+diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c |
444 |
+index 8fa477293ae0..d2f26577f5c0 100644 |
445 |
+--- a/drivers/clk/qcom/common.c |
446 |
++++ b/drivers/clk/qcom/common.c |
447 |
+@@ -36,6 +36,9 @@ struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate) |
448 |
+ if (!f) |
449 |
+ return NULL; |
450 |
+ |
451 |
++ if (!f->freq) |
452 |
++ return f; |
453 |
++ |
454 |
+ for (; f->freq; f++) |
455 |
+ if (rate <= f->freq) |
456 |
+ return f; |
457 |
+diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c |
458 |
+index 217438d39eb3..38a28240f84f 100644 |
459 |
+--- a/drivers/clocksource/asm9260_timer.c |
460 |
++++ b/drivers/clocksource/asm9260_timer.c |
461 |
+@@ -196,6 +196,10 @@ static void __init asm9260_timer_init(struct device_node *np) |
462 |
+ panic("%s: unable to map resource", np->name); |
463 |
+ |
464 |
+ clk = of_clk_get(np, 0); |
465 |
++ if (IS_ERR(clk)) { |
466 |
++ pr_err("Failed to get clk!\n"); |
467 |
++ return PTR_ERR(clk); |
468 |
++ } |
469 |
+ |
470 |
+ ret = clk_prepare_enable(clk); |
471 |
+ if (ret) |
472 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
473 |
+index 2239d42bdadd..49aa58e617db 100644 |
474 |
+--- a/drivers/cpufreq/cpufreq.c |
475 |
++++ b/drivers/cpufreq/cpufreq.c |
476 |
+@@ -2426,6 +2426,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) |
477 |
+ if (cpufreq_disabled()) |
478 |
+ return -ENODEV; |
479 |
+ |
480 |
++ /* |
481 |
++ * The cpufreq core depends heavily on the availability of device |
482 |
++ * structure, make sure they are available before proceeding further. |
483 |
++ */ |
484 |
++ if (!get_cpu_device(0)) |
485 |
++ return -EPROBE_DEFER; |
486 |
++ |
487 |
+ if (!driver_data || !driver_data->verify || !driver_data->init || |
488 |
+ !(driver_data->setpolicy || driver_data->target_index || |
489 |
+ driver_data->target) || |
490 |
+diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
491 |
+index ff8031498809..bff3cbd05c0a 100644 |
492 |
+--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
493 |
++++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
494 |
+@@ -245,8 +245,8 @@ int sun4i_hash_update(struct ahash_request *areq) |
495 |
+ */ |
496 |
+ while (op->len < 64 && i < end) { |
497 |
+ /* how many bytes we can read from current SG */ |
498 |
+- in_r = min3(mi.length - in_i, end - i, |
499 |
+- 64 - op->len); |
500 |
++ in_r = min(end - i, 64 - op->len); |
501 |
++ in_r = min_t(size_t, mi.length - in_i, in_r); |
502 |
+ memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
503 |
+ op->len += in_r; |
504 |
+ i += in_r; |
505 |
+@@ -266,8 +266,8 @@ int sun4i_hash_update(struct ahash_request *areq) |
506 |
+ } |
507 |
+ if (mi.length - in_i > 3 && i < end) { |
508 |
+ /* how many bytes we can read from current SG */ |
509 |
+- in_r = min3(mi.length - in_i, areq->nbytes - i, |
510 |
+- ((mi.length - in_i) / 4) * 4); |
511 |
++ in_r = min_t(size_t, mi.length - in_i, areq->nbytes - i); |
512 |
++ in_r = min_t(size_t, ((mi.length - in_i) / 4) * 4, in_r); |
513 |
+ /* how many bytes we can write in the device*/ |
514 |
+ todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4); |
515 |
+ writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo); |
516 |
+@@ -289,8 +289,8 @@ int sun4i_hash_update(struct ahash_request *areq) |
517 |
+ if ((areq->nbytes - i) < 64) { |
518 |
+ while (i < areq->nbytes && in_i < mi.length && op->len < 64) { |
519 |
+ /* how many bytes we can read from current SG */ |
520 |
+- in_r = min3(mi.length - in_i, areq->nbytes - i, |
521 |
+- 64 - op->len); |
522 |
++ in_r = min(areq->nbytes - i, 64 - op->len); |
523 |
++ in_r = min_t(size_t, mi.length - in_i, in_r); |
524 |
+ memcpy(op->buf + op->len, mi.addr + in_i, in_r); |
525 |
+ op->len += in_r; |
526 |
+ i += in_r; |
527 |
+diff --git a/drivers/crypto/vmx/Makefile b/drivers/crypto/vmx/Makefile |
528 |
+index d28ab96a2475..7663494809a0 100644 |
529 |
+--- a/drivers/crypto/vmx/Makefile |
530 |
++++ b/drivers/crypto/vmx/Makefile |
531 |
+@@ -2,13 +2,13 @@ obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o |
532 |
+ vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o ghash.o |
533 |
+ |
534 |
+ ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) |
535 |
+-TARGET := linux-ppc64le |
536 |
++override flavour := linux-ppc64le |
537 |
+ else |
538 |
+-TARGET := linux-ppc64 |
539 |
++override flavour := linux-ppc64 |
540 |
+ endif |
541 |
+ |
542 |
+ quiet_cmd_perl = PERL $@ |
543 |
+- cmd_perl = $(PERL) $(<) $(TARGET) > $(@) |
544 |
++ cmd_perl = $(PERL) $(<) $(flavour) > $(@) |
545 |
+ |
546 |
+ $(src)/aesp8-ppc.S: $(src)/aesp8-ppc.pl |
547 |
+ $(call cmd,perl) |
548 |
+diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c |
549 |
+index e3fa4390f846..4ddbf6604e2a 100644 |
550 |
+--- a/drivers/edac/ghes_edac.c |
551 |
++++ b/drivers/edac/ghes_edac.c |
552 |
+@@ -189,6 +189,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, |
553 |
+ /* Cleans the error report buffer */ |
554 |
+ memset(e, 0, sizeof (*e)); |
555 |
+ e->error_count = 1; |
556 |
++ e->grain = 1; |
557 |
+ strcpy(e->label, "unknown label"); |
558 |
+ e->msg = pvt->msg; |
559 |
+ e->other_detail = pvt->other_detail; |
560 |
+@@ -284,7 +285,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, |
561 |
+ |
562 |
+ /* Error grain */ |
563 |
+ if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) |
564 |
+- e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); |
565 |
++ e->grain = ~mem_err->physical_addr_mask + 1; |
566 |
+ |
567 |
+ /* Memory error location, mapped on e->location */ |
568 |
+ p = e->location; |
569 |
+@@ -391,8 +392,13 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, |
570 |
+ if (p > pvt->other_detail) |
571 |
+ *(p - 1) = '\0'; |
572 |
+ |
573 |
++ /* Sanity-check driver-supplied grain value. */ |
574 |
++ if (WARN_ON_ONCE(!e->grain)) |
575 |
++ e->grain = 1; |
576 |
++ |
577 |
++ grain_bits = fls_long(e->grain - 1); |
578 |
++ |
579 |
+ /* Generate the trace event */ |
580 |
+- grain_bits = fls_long(e->grain); |
581 |
+ snprintf(pvt->detail_location, sizeof(pvt->detail_location), |
582 |
+ "APEI location: %s %s", e->location, e->other_detail); |
583 |
+ trace_mc_event(type, e->msg, e->label, e->error_count, |
584 |
+diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c |
585 |
+index 7aac3cc7efd7..f63f9961ac12 100644 |
586 |
+--- a/drivers/extcon/extcon-sm5502.c |
587 |
++++ b/drivers/extcon/extcon-sm5502.c |
588 |
+@@ -69,6 +69,10 @@ struct sm5502_muic_info { |
589 |
+ /* Default value of SM5502 register to bring up MUIC device. */ |
590 |
+ static struct reg_data sm5502_reg_data[] = { |
591 |
+ { |
592 |
++ .reg = SM5502_REG_RESET, |
593 |
++ .val = SM5502_REG_RESET_MASK, |
594 |
++ .invert = true, |
595 |
++ }, { |
596 |
+ .reg = SM5502_REG_CONTROL, |
597 |
+ .val = SM5502_REG_CONTROL_MASK_INT_MASK, |
598 |
+ .invert = false, |
599 |
+diff --git a/drivers/extcon/extcon-sm5502.h b/drivers/extcon/extcon-sm5502.h |
600 |
+index 974b53222f56..12f8b01e5753 100644 |
601 |
+--- a/drivers/extcon/extcon-sm5502.h |
602 |
++++ b/drivers/extcon/extcon-sm5502.h |
603 |
+@@ -241,6 +241,8 @@ enum sm5502_reg { |
604 |
+ #define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ |
605 |
+ | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) |
606 |
+ |
607 |
++#define SM5502_REG_RESET_MASK (0x1) |
608 |
++ |
609 |
+ /* SM5502 Interrupts */ |
610 |
+ enum sm5502_irq { |
611 |
+ /* INT1 */ |
612 |
+diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c |
613 |
+index 9e02cb6afb0b..ce6e15167d0b 100644 |
614 |
+--- a/drivers/gpio/gpio-mpc8xxx.c |
615 |
++++ b/drivers/gpio/gpio-mpc8xxx.c |
616 |
+@@ -409,7 +409,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) |
617 |
+ * It's assumed that only a single type of gpio controller is available |
618 |
+ * on the current machine, so overwriting global data is fine. |
619 |
+ */ |
620 |
+- mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; |
621 |
++ if (devtype->irq_set_type) |
622 |
++ mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type; |
623 |
+ |
624 |
+ gc->direction_output = devtype->gpio_dir_out ?: mpc8xxx_gpio_dir_out; |
625 |
+ gc->get = devtype->gpio_get ?: mpc8xxx_gpio_get; |
626 |
+diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c |
627 |
+index 1048f0c7c6ce..31e0899035f9 100644 |
628 |
+--- a/drivers/gpu/drm/gma500/oaktrail_crtc.c |
629 |
++++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c |
630 |
+@@ -139,6 +139,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit, |
631 |
+ s32 freq_error, min_error = 100000; |
632 |
+ |
633 |
+ memset(best_clock, 0, sizeof(*best_clock)); |
634 |
++ memset(&clock, 0, sizeof(clock)); |
635 |
+ |
636 |
+ for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { |
637 |
+ for (clock.n = limit->n.min; clock.n <= limit->n.max; |
638 |
+@@ -195,6 +196,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit, |
639 |
+ int err = target; |
640 |
+ |
641 |
+ memset(best_clock, 0, sizeof(*best_clock)); |
642 |
++ memset(&clock, 0, sizeof(clock)); |
643 |
+ |
644 |
+ for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { |
645 |
+ for (clock.p1 = limit->p1.min; clock.p1 <= limit->p1.max; |
646 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
647 |
+index c60bb6f8eceb..7cd945575463 100644 |
648 |
+--- a/drivers/hid/hid-core.c |
649 |
++++ b/drivers/hid/hid-core.c |
650 |
+@@ -761,6 +761,10 @@ static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage) |
651 |
+ if (usage == 0xff0000c5 && parser->global.report_count == 256 && |
652 |
+ parser->global.report_size == 8) |
653 |
+ parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; |
654 |
++ |
655 |
++ if (usage == 0xff0000c6 && parser->global.report_count == 1 && |
656 |
++ parser->global.report_size == 8) |
657 |
++ parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8; |
658 |
+ } |
659 |
+ |
660 |
+ static void hid_scan_collection(struct hid_parser *parser, unsigned type) |
661 |
+diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c |
662 |
+index 41d495c6035e..7d5e4114e7a8 100644 |
663 |
+--- a/drivers/iio/adc/max1027.c |
664 |
++++ b/drivers/iio/adc/max1027.c |
665 |
+@@ -470,6 +470,14 @@ static int max1027_probe(struct spi_device *spi) |
666 |
+ goto fail_dev_register; |
667 |
+ } |
668 |
+ |
669 |
++ /* Internal reset */ |
670 |
++ st->reg = MAX1027_RST_REG; |
671 |
++ ret = spi_write(st->spi, &st->reg, 1); |
672 |
++ if (ret < 0) { |
673 |
++ dev_err(&indio_dev->dev, "Failed to reset the ADC\n"); |
674 |
++ return ret; |
675 |
++ } |
676 |
++ |
677 |
+ /* Disable averaging */ |
678 |
+ st->reg = MAX1027_AVG_REG; |
679 |
+ ret = spi_write(st->spi, &st->reg, 1); |
680 |
+diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c |
681 |
+index 8b4164343f20..0cf7032ccdc9 100644 |
682 |
+--- a/drivers/iio/light/bh1750.c |
683 |
++++ b/drivers/iio/light/bh1750.c |
684 |
+@@ -62,9 +62,9 @@ struct bh1750_chip_info { |
685 |
+ |
686 |
+ u16 int_time_low_mask; |
687 |
+ u16 int_time_high_mask; |
688 |
+-} |
689 |
++}; |
690 |
+ |
691 |
+-static const bh1750_chip_info_tbl[] = { |
692 |
++static const struct bh1750_chip_info bh1750_chip_info_tbl[] = { |
693 |
+ [BH1710] = { 140, 1022, 300, 400, 250000000, 2, 0x001F, 0x03E0 }, |
694 |
+ [BH1721] = { 140, 1020, 300, 400, 250000000, 2, 0x0010, 0x03E0 }, |
695 |
+ [BH1750] = { 31, 254, 69, 1740, 57500000, 1, 0x001F, 0x00E0 }, |
696 |
+diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c |
697 |
+index 9080161e01af..edb064f9f0f1 100644 |
698 |
+--- a/drivers/infiniband/ulp/iser/iscsi_iser.c |
699 |
++++ b/drivers/infiniband/ulp/iser/iscsi_iser.c |
700 |
+@@ -646,6 +646,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, |
701 |
+ if (ib_conn->pi_support) { |
702 |
+ u32 sig_caps = ib_conn->device->dev_attr.sig_prot_cap; |
703 |
+ |
704 |
++ shost->sg_prot_tablesize = shost->sg_tablesize; |
705 |
+ scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps)); |
706 |
+ scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP | |
707 |
+ SHOST_DIX_GUARD_CRC); |
708 |
+diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c |
709 |
+index be2f2521c1c5..d955841da57d 100644 |
710 |
+--- a/drivers/input/touchscreen/atmel_mxt_ts.c |
711 |
++++ b/drivers/input/touchscreen/atmel_mxt_ts.c |
712 |
+@@ -2701,6 +2701,8 @@ static int __maybe_unused mxt_suspend(struct device *dev) |
713 |
+ |
714 |
+ mutex_unlock(&input_dev->mutex); |
715 |
+ |
716 |
++ disable_irq(data->irq); |
717 |
++ |
718 |
+ return 0; |
719 |
+ } |
720 |
+ |
721 |
+@@ -2713,6 +2715,8 @@ static int __maybe_unused mxt_resume(struct device *dev) |
722 |
+ if (!input_dev) |
723 |
+ return 0; |
724 |
+ |
725 |
++ enable_irq(data->irq); |
726 |
++ |
727 |
+ mutex_lock(&input_dev->mutex); |
728 |
+ |
729 |
+ if (input_dev->users) |
730 |
+diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c |
731 |
+index c4eb293b1524..04cec050e42b 100644 |
732 |
+--- a/drivers/iommu/tegra-smmu.c |
733 |
++++ b/drivers/iommu/tegra-smmu.c |
734 |
+@@ -153,9 +153,9 @@ static bool smmu_dma_addr_valid(struct tegra_smmu *smmu, dma_addr_t addr) |
735 |
+ return (addr & smmu->pfn_mask) == addr; |
736 |
+ } |
737 |
+ |
738 |
+-static dma_addr_t smmu_pde_to_dma(u32 pde) |
739 |
++static dma_addr_t smmu_pde_to_dma(struct tegra_smmu *smmu, u32 pde) |
740 |
+ { |
741 |
+- return pde << 12; |
742 |
++ return (dma_addr_t)(pde & smmu->pfn_mask) << 12; |
743 |
+ } |
744 |
+ |
745 |
+ static void smmu_flush_ptc_all(struct tegra_smmu *smmu) |
746 |
+@@ -540,6 +540,7 @@ static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, |
747 |
+ dma_addr_t *dmap) |
748 |
+ { |
749 |
+ unsigned int pd_index = iova_pd_index(iova); |
750 |
++ struct tegra_smmu *smmu = as->smmu; |
751 |
+ struct page *pt_page; |
752 |
+ u32 *pd; |
753 |
+ |
754 |
+@@ -548,7 +549,7 @@ static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, |
755 |
+ return NULL; |
756 |
+ |
757 |
+ pd = page_address(as->pd); |
758 |
+- *dmap = smmu_pde_to_dma(pd[pd_index]); |
759 |
++ *dmap = smmu_pde_to_dma(smmu, pd[pd_index]); |
760 |
+ |
761 |
+ return tegra_smmu_pte_offset(pt_page, iova); |
762 |
+ } |
763 |
+@@ -590,7 +591,7 @@ static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova, |
764 |
+ } else { |
765 |
+ u32 *pd = page_address(as->pd); |
766 |
+ |
767 |
+- *dmap = smmu_pde_to_dma(pd[pde]); |
768 |
++ *dmap = smmu_pde_to_dma(smmu, pd[pde]); |
769 |
+ } |
770 |
+ |
771 |
+ return tegra_smmu_pte_offset(as->pts[pde], iova); |
772 |
+@@ -615,7 +616,7 @@ static void tegra_smmu_pte_put_use(struct tegra_smmu_as *as, unsigned long iova) |
773 |
+ if (--as->count[pde] == 0) { |
774 |
+ struct tegra_smmu *smmu = as->smmu; |
775 |
+ u32 *pd = page_address(as->pd); |
776 |
+- dma_addr_t pte_dma = smmu_pde_to_dma(pd[pde]); |
777 |
++ dma_addr_t pte_dma = smmu_pde_to_dma(smmu, pd[pde]); |
778 |
+ |
779 |
+ tegra_smmu_set_pde(as, iova, 0); |
780 |
+ |
781 |
+diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c |
782 |
+index 6fb34bf0f352..34e13623f29d 100644 |
783 |
+--- a/drivers/irqchip/irq-bcm7038-l1.c |
784 |
++++ b/drivers/irqchip/irq-bcm7038-l1.c |
785 |
+@@ -283,6 +283,10 @@ static int __init bcm7038_l1_init_one(struct device_node *dn, |
786 |
+ pr_err("failed to map parent interrupt %d\n", parent_irq); |
787 |
+ return -EINVAL; |
788 |
+ } |
789 |
++ |
790 |
++ if (of_property_read_bool(dn, "brcm,irq-can-wake")) |
791 |
++ enable_irq_wake(parent_irq); |
792 |
++ |
793 |
+ irq_set_chained_handler_and_data(parent_irq, bcm7038_l1_irq_handle, |
794 |
+ intc); |
795 |
+ |
796 |
+diff --git a/drivers/irqchip/irq-ingenic.c b/drivers/irqchip/irq-ingenic.c |
797 |
+index fc5953dea509..b2e16dca76a6 100644 |
798 |
+--- a/drivers/irqchip/irq-ingenic.c |
799 |
++++ b/drivers/irqchip/irq-ingenic.c |
800 |
+@@ -117,6 +117,14 @@ static int __init ingenic_intc_of_init(struct device_node *node, |
801 |
+ goto out_unmap_irq; |
802 |
+ } |
803 |
+ |
804 |
++ domain = irq_domain_add_legacy(node, num_chips * 32, |
805 |
++ JZ4740_IRQ_BASE, 0, |
806 |
++ &irq_domain_simple_ops, NULL); |
807 |
++ if (!domain) { |
808 |
++ err = -ENOMEM; |
809 |
++ goto out_unmap_base; |
810 |
++ } |
811 |
++ |
812 |
+ for (i = 0; i < num_chips; i++) { |
813 |
+ /* Mask all irqs */ |
814 |
+ writel(0xffffffff, intc->base + (i * CHIP_SIZE) + |
815 |
+@@ -143,14 +151,11 @@ static int __init ingenic_intc_of_init(struct device_node *node, |
816 |
+ IRQ_NOPROBE | IRQ_LEVEL); |
817 |
+ } |
818 |
+ |
819 |
+- domain = irq_domain_add_legacy(node, num_chips * 32, JZ4740_IRQ_BASE, 0, |
820 |
+- &irq_domain_simple_ops, NULL); |
821 |
+- if (!domain) |
822 |
+- pr_warn("unable to register IRQ domain\n"); |
823 |
+- |
824 |
+ setup_irq(parent_irq, &intc_cascade_action); |
825 |
+ return 0; |
826 |
+ |
827 |
++out_unmap_base: |
828 |
++ iounmap(intc->base); |
829 |
+ out_unmap_irq: |
830 |
+ irq_dispose_mapping(parent_irq); |
831 |
+ out_free: |
832 |
+diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
833 |
+index 05aa3ac1381b..5c93582c71cc 100644 |
834 |
+--- a/drivers/md/bcache/btree.c |
835 |
++++ b/drivers/md/bcache/btree.c |
836 |
+@@ -686,6 +686,8 @@ static unsigned long bch_mca_scan(struct shrinker *shrink, |
837 |
+ * IO can always make forward progress: |
838 |
+ */ |
839 |
+ nr /= c->btree_pages; |
840 |
++ if (nr == 0) |
841 |
++ nr = 1; |
842 |
+ nr = min_t(unsigned long, nr, mca_can_free(c)); |
843 |
+ |
844 |
+ i = 0; |
845 |
+diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c |
846 |
+index fadec1d70582..6eefb8bbb5b5 100644 |
847 |
+--- a/drivers/media/i2c/ov2659.c |
848 |
++++ b/drivers/media/i2c/ov2659.c |
849 |
+@@ -419,10 +419,14 @@ static struct sensor_register ov2659_720p[] = { |
850 |
+ { REG_TIMING_YINC, 0x11 }, |
851 |
+ { REG_TIMING_VERT_FORMAT, 0x80 }, |
852 |
+ { REG_TIMING_HORIZ_FORMAT, 0x00 }, |
853 |
++ { 0x370a, 0x12 }, |
854 |
+ { 0x3a03, 0xe8 }, |
855 |
+ { 0x3a09, 0x6f }, |
856 |
+ { 0x3a0b, 0x5d }, |
857 |
+ { 0x3a15, 0x9a }, |
858 |
++ { REG_VFIFO_READ_START_H, 0x00 }, |
859 |
++ { REG_VFIFO_READ_START_L, 0x80 }, |
860 |
++ { REG_ISP_CTRL02, 0x00 }, |
861 |
+ { REG_NULL, 0x00 }, |
862 |
+ }; |
863 |
+ |
864 |
+@@ -1204,11 +1208,15 @@ static int ov2659_s_stream(struct v4l2_subdev *sd, int on) |
865 |
+ goto unlock; |
866 |
+ } |
867 |
+ |
868 |
+- ov2659_set_pixel_clock(ov2659); |
869 |
+- ov2659_set_frame_size(ov2659); |
870 |
+- ov2659_set_format(ov2659); |
871 |
+- ov2659_set_streaming(ov2659, 1); |
872 |
+- ov2659->streaming = on; |
873 |
++ ret = ov2659_set_pixel_clock(ov2659); |
874 |
++ if (!ret) |
875 |
++ ret = ov2659_set_frame_size(ov2659); |
876 |
++ if (!ret) |
877 |
++ ret = ov2659_set_format(ov2659); |
878 |
++ if (!ret) { |
879 |
++ ov2659_set_streaming(ov2659, 1); |
880 |
++ ov2659->streaming = on; |
881 |
++ } |
882 |
+ |
883 |
+ unlock: |
884 |
+ mutex_unlock(&ov2659->lock); |
885 |
+diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c |
886 |
+index 4e19f5e5d8cf..bb55ddfbf733 100644 |
887 |
+--- a/drivers/media/i2c/soc_camera/ov6650.c |
888 |
++++ b/drivers/media/i2c/soc_camera/ov6650.c |
889 |
+@@ -611,7 +611,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
890 |
+ dev_err(&client->dev, "Pixel format not handled: 0x%x\n", code); |
891 |
+ return -EINVAL; |
892 |
+ } |
893 |
+- priv->code = code; |
894 |
+ |
895 |
+ if (code == MEDIA_BUS_FMT_Y8_1X8 || |
896 |
+ code == MEDIA_BUS_FMT_SBGGR8_1X8) { |
897 |
+@@ -637,7 +636,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
898 |
+ dev_dbg(&client->dev, "max resolution: CIF\n"); |
899 |
+ coma_mask |= COMA_QCIF; |
900 |
+ } |
901 |
+- priv->half_scale = half_scale; |
902 |
+ |
903 |
+ if (sense) { |
904 |
+ if (sense->master_clock == 8000000) { |
905 |
+@@ -677,8 +675,13 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
906 |
+ ret = ov6650_reg_rmw(client, REG_COMA, coma_set, coma_mask); |
907 |
+ if (!ret) |
908 |
+ ret = ov6650_reg_write(client, REG_CLKRC, clkrc); |
909 |
+- if (!ret) |
910 |
++ if (!ret) { |
911 |
++ priv->half_scale = half_scale; |
912 |
++ |
913 |
+ ret = ov6650_reg_rmw(client, REG_COML, coml_set, coml_mask); |
914 |
++ } |
915 |
++ if (!ret) |
916 |
++ priv->code = code; |
917 |
+ |
918 |
+ if (!ret) { |
919 |
+ mf->colorspace = priv->colorspace; |
920 |
+diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c |
921 |
+index 572bc043b62d..36add3c463f7 100644 |
922 |
+--- a/drivers/media/platform/am437x/am437x-vpfe.c |
923 |
++++ b/drivers/media/platform/am437x/am437x-vpfe.c |
924 |
+@@ -1847,6 +1847,10 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) |
925 |
+ if (!(sdinfo->inputs[0].capabilities & V4L2_IN_CAP_STD)) |
926 |
+ return -ENODATA; |
927 |
+ |
928 |
++ /* if trying to set the same std then nothing to do */ |
929 |
++ if (vpfe_standards[vpfe->std_index].std_id == std_id) |
930 |
++ return 0; |
931 |
++ |
932 |
+ /* If streaming is started, return error */ |
933 |
+ if (vb2_is_busy(&vpfe->buffer_queue)) { |
934 |
+ vpfe_err(vpfe, "%s device busy\n", __func__); |
935 |
+diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c |
936 |
+index de24effd984f..b5f8c425cd2e 100644 |
937 |
+--- a/drivers/media/platform/ti-vpe/vpe.c |
938 |
++++ b/drivers/media/platform/ti-vpe/vpe.c |
939 |
+@@ -330,20 +330,25 @@ enum { |
940 |
+ }; |
941 |
+ |
942 |
+ /* find our format description corresponding to the passed v4l2_format */ |
943 |
+-static struct vpe_fmt *find_format(struct v4l2_format *f) |
944 |
++static struct vpe_fmt *__find_format(u32 fourcc) |
945 |
+ { |
946 |
+ struct vpe_fmt *fmt; |
947 |
+ unsigned int k; |
948 |
+ |
949 |
+ for (k = 0; k < ARRAY_SIZE(vpe_formats); k++) { |
950 |
+ fmt = &vpe_formats[k]; |
951 |
+- if (fmt->fourcc == f->fmt.pix.pixelformat) |
952 |
++ if (fmt->fourcc == fourcc) |
953 |
+ return fmt; |
954 |
+ } |
955 |
+ |
956 |
+ return NULL; |
957 |
+ } |
958 |
+ |
959 |
++static struct vpe_fmt *find_format(struct v4l2_format *f) |
960 |
++{ |
961 |
++ return __find_format(f->fmt.pix.pixelformat); |
962 |
++} |
963 |
++ |
964 |
+ /* |
965 |
+ * there is one vpe_dev structure in the driver, it is shared by |
966 |
+ * all instances. |
967 |
+@@ -1294,6 +1299,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) |
968 |
+ d_vb->timecode = s_vb->timecode; |
969 |
+ |
970 |
+ d_vb->sequence = ctx->sequence; |
971 |
++ s_vb->sequence = ctx->sequence; |
972 |
+ |
973 |
+ d_q_data = &ctx->q_data[Q_DATA_DST]; |
974 |
+ if (d_q_data->flags & Q_DATA_INTERLACED) { |
975 |
+@@ -1434,9 +1440,9 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, |
976 |
+ int i, depth, depth_bytes; |
977 |
+ |
978 |
+ if (!fmt || !(fmt->types & type)) { |
979 |
+- vpe_err(ctx->dev, "Fourcc format (0x%08x) invalid.\n", |
980 |
++ vpe_dbg(ctx->dev, "Fourcc format (0x%08x) invalid.\n", |
981 |
+ pix->pixelformat); |
982 |
+- return -EINVAL; |
983 |
++ fmt = __find_format(V4L2_PIX_FMT_YUYV); |
984 |
+ } |
985 |
+ |
986 |
+ if (pix->field != V4L2_FIELD_NONE && pix->field != V4L2_FIELD_ALTERNATE) |
987 |
+@@ -1994,7 +2000,7 @@ static int vpe_open(struct file *file) |
988 |
+ v4l2_ctrl_handler_setup(hdl); |
989 |
+ |
990 |
+ s_q_data = &ctx->q_data[Q_DATA_SRC]; |
991 |
+- s_q_data->fmt = &vpe_formats[2]; |
992 |
++ s_q_data->fmt = __find_format(V4L2_PIX_FMT_YUYV); |
993 |
+ s_q_data->width = 1920; |
994 |
+ s_q_data->height = 1080; |
995 |
+ s_q_data->bytesperline[VPE_LUMA] = (s_q_data->width * |
996 |
+diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c |
997 |
+index 9326439bc49c..f9e1768b8d31 100644 |
998 |
+--- a/drivers/media/radio/si470x/radio-si470x-i2c.c |
999 |
++++ b/drivers/media/radio/si470x/radio-si470x-i2c.c |
1000 |
+@@ -460,6 +460,8 @@ static int si470x_i2c_remove(struct i2c_client *client) |
1001 |
+ video_unregister_device(&radio->videodev); |
1002 |
+ kfree(radio); |
1003 |
+ |
1004 |
++ v4l2_ctrl_handler_free(&radio->hdl); |
1005 |
++ v4l2_device_unregister(&radio->v4l2_dev); |
1006 |
+ return 0; |
1007 |
+ } |
1008 |
+ |
1009 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
1010 |
+index 83d3a5cf272f..932fa31e0624 100644 |
1011 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.c |
1012 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.c |
1013 |
+@@ -474,7 +474,13 @@ urb_error: |
1014 |
+ static int flexcop_usb_init(struct flexcop_usb *fc_usb) |
1015 |
+ { |
1016 |
+ /* use the alternate setting with the larges buffer */ |
1017 |
+- usb_set_interface(fc_usb->udev,0,1); |
1018 |
++ int ret = usb_set_interface(fc_usb->udev, 0, 1); |
1019 |
++ |
1020 |
++ if (ret) { |
1021 |
++ err("set interface failed."); |
1022 |
++ return ret; |
1023 |
++ } |
1024 |
++ |
1025 |
+ switch (fc_usb->udev->speed) { |
1026 |
+ case USB_SPEED_LOW: |
1027 |
+ err("cannot handle USB speed because it is too slow."); |
1028 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
1029 |
+index 1c5f85bf7ed4..2d6195e9a195 100644 |
1030 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
1031 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |
1032 |
+@@ -886,8 +886,12 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp) |
1033 |
+ pvr2_v4l2_dev_disassociate_parent(vp->dev_video); |
1034 |
+ pvr2_v4l2_dev_disassociate_parent(vp->dev_radio); |
1035 |
+ if (!list_empty(&vp->dev_video->devbase.fh_list) || |
1036 |
+- !list_empty(&vp->dev_radio->devbase.fh_list)) |
1037 |
++ (vp->dev_radio && |
1038 |
++ !list_empty(&vp->dev_radio->devbase.fh_list))) { |
1039 |
++ pvr2_trace(PVR2_TRACE_STRUCT, |
1040 |
++ "pvr2_v4l2 internal_check exit-empty id=%p", vp); |
1041 |
+ return; |
1042 |
++ } |
1043 |
+ pvr2_v4l2_destroy_no_lock(vp); |
1044 |
+ } |
1045 |
+ |
1046 |
+@@ -961,7 +965,8 @@ static int pvr2_v4l2_release(struct file *file) |
1047 |
+ kfree(fhp); |
1048 |
+ if (vp->channel.mc_head->disconnect_flag && |
1049 |
+ list_empty(&vp->dev_video->devbase.fh_list) && |
1050 |
+- list_empty(&vp->dev_radio->devbase.fh_list)) { |
1051 |
++ (!vp->dev_radio || |
1052 |
++ list_empty(&vp->dev_radio->devbase.fh_list))) { |
1053 |
+ pvr2_v4l2_destroy_no_lock(vp); |
1054 |
+ } |
1055 |
+ return 0; |
1056 |
+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
1057 |
+index 356b294c93c9..e78e7a874856 100644 |
1058 |
+--- a/drivers/mmc/host/sdhci-of-esdhc.c |
1059 |
++++ b/drivers/mmc/host/sdhci-of-esdhc.c |
1060 |
+@@ -625,8 +625,8 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) |
1061 |
+ host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ; |
1062 |
+ |
1063 |
+ if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) { |
1064 |
+- host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
1065 |
+- host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
1066 |
++ host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
1067 |
++ host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
1068 |
+ } |
1069 |
+ |
1070 |
+ if (of_device_is_compatible(np, "fsl,p5040-esdhc") || |
1071 |
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
1072 |
+index 1d6dfde1104d..2bae0214528b 100644 |
1073 |
+--- a/drivers/mmc/host/sdhci.c |
1074 |
++++ b/drivers/mmc/host/sdhci.c |
1075 |
+@@ -1452,9 +1452,7 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing) |
1076 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR104; |
1077 |
+ else if (timing == MMC_TIMING_UHS_SDR12) |
1078 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR12; |
1079 |
+- else if (timing == MMC_TIMING_SD_HS || |
1080 |
+- timing == MMC_TIMING_MMC_HS || |
1081 |
+- timing == MMC_TIMING_UHS_SDR25) |
1082 |
++ else if (timing == MMC_TIMING_UHS_SDR25) |
1083 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR25; |
1084 |
+ else if (timing == MMC_TIMING_UHS_SDR50) |
1085 |
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR50; |
1086 |
+@@ -2035,7 +2033,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) |
1087 |
+ spin_lock_irqsave(&host->lock, flags); |
1088 |
+ |
1089 |
+ if (!host->tuning_done) { |
1090 |
+- pr_info(DRIVER_NAME ": Timeout waiting for " |
1091 |
++ pr_debug(DRIVER_NAME ": Timeout waiting for " |
1092 |
+ "Buffer Read Ready interrupt during tuning " |
1093 |
+ "procedure, falling back to fixed sampling " |
1094 |
+ "clock\n"); |
1095 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1096 |
+index 5780830f78ad..55a7774e8ef5 100644 |
1097 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1098 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1099 |
+@@ -2384,15 +2384,21 @@ static int bnx2x_set_pf_tx_switching(struct bnx2x *bp, bool enable) |
1100 |
+ /* send the ramrod on all the queues of the PF */ |
1101 |
+ for_each_eth_queue(bp, i) { |
1102 |
+ struct bnx2x_fastpath *fp = &bp->fp[i]; |
1103 |
++ int tx_idx; |
1104 |
+ |
1105 |
+ /* Set the appropriate Queue object */ |
1106 |
+ q_params.q_obj = &bnx2x_sp_obj(bp, fp).q_obj; |
1107 |
+ |
1108 |
+- /* Update the Queue state */ |
1109 |
+- rc = bnx2x_queue_state_change(bp, &q_params); |
1110 |
+- if (rc) { |
1111 |
+- BNX2X_ERR("Failed to configure Tx switching\n"); |
1112 |
+- return rc; |
1113 |
++ for (tx_idx = FIRST_TX_COS_INDEX; |
1114 |
++ tx_idx < fp->max_cos; tx_idx++) { |
1115 |
++ q_params.params.update.cid_index = tx_idx; |
1116 |
++ |
1117 |
++ /* Update the Queue state */ |
1118 |
++ rc = bnx2x_queue_state_change(bp, &q_params); |
1119 |
++ if (rc) { |
1120 |
++ BNX2X_ERR("Failed to configure Tx switching\n"); |
1121 |
++ return rc; |
1122 |
++ } |
1123 |
+ } |
1124 |
+ } |
1125 |
+ |
1126 |
+diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c |
1127 |
+index 2a7dfac20546..09c51220b5ca 100644 |
1128 |
+--- a/drivers/net/ethernet/hisilicon/hip04_eth.c |
1129 |
++++ b/drivers/net/ethernet/hisilicon/hip04_eth.c |
1130 |
+@@ -455,9 +455,9 @@ static int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1131 |
+ skb_tx_timestamp(skb); |
1132 |
+ |
1133 |
+ hip04_set_xmit_desc(priv, phys); |
1134 |
+- priv->tx_head = TX_NEXT(tx_head); |
1135 |
+ count++; |
1136 |
+ netdev_sent_queue(ndev, skb->len); |
1137 |
++ priv->tx_head = TX_NEXT(tx_head); |
1138 |
+ |
1139 |
+ stats->tx_bytes += skb->len; |
1140 |
+ stats->tx_packets++; |
1141 |
+diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c |
1142 |
+index c653b97d84d5..f2cb77c3b199 100644 |
1143 |
+--- a/drivers/net/ethernet/qlogic/qla3xxx.c |
1144 |
++++ b/drivers/net/ethernet/qlogic/qla3xxx.c |
1145 |
+@@ -2752,6 +2752,9 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
1146 |
+ int err; |
1147 |
+ |
1148 |
+ for (i = 0; i < qdev->num_large_buffers; i++) { |
1149 |
++ lrg_buf_cb = &qdev->lrg_buf[i]; |
1150 |
++ memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); |
1151 |
++ |
1152 |
+ skb = netdev_alloc_skb(qdev->ndev, |
1153 |
+ qdev->lrg_buffer_len); |
1154 |
+ if (unlikely(!skb)) { |
1155 |
+@@ -2762,11 +2765,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
1156 |
+ ql_free_large_buffers(qdev); |
1157 |
+ return -ENOMEM; |
1158 |
+ } else { |
1159 |
+- |
1160 |
+- lrg_buf_cb = &qdev->lrg_buf[i]; |
1161 |
+- memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); |
1162 |
+ lrg_buf_cb->index = i; |
1163 |
+- lrg_buf_cb->skb = skb; |
1164 |
+ /* |
1165 |
+ * We save some space to copy the ethhdr from first |
1166 |
+ * buffer |
1167 |
+@@ -2788,6 +2787,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) |
1168 |
+ return -ENOMEM; |
1169 |
+ } |
1170 |
+ |
1171 |
++ lrg_buf_cb->skb = skb; |
1172 |
+ dma_unmap_addr_set(lrg_buf_cb, mapaddr, map); |
1173 |
+ dma_unmap_len_set(lrg_buf_cb, maplen, |
1174 |
+ qdev->lrg_buffer_len - |
1175 |
+diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c |
1176 |
+index 657b65bf5cac..18bf3a8fdc50 100644 |
1177 |
+--- a/drivers/net/ethernet/ti/davinci_cpdma.c |
1178 |
++++ b/drivers/net/ethernet/ti/davinci_cpdma.c |
1179 |
+@@ -82,7 +82,7 @@ struct cpdma_desc { |
1180 |
+ |
1181 |
+ struct cpdma_desc_pool { |
1182 |
+ phys_addr_t phys; |
1183 |
+- u32 hw_addr; |
1184 |
++ dma_addr_t hw_addr; |
1185 |
+ void __iomem *iomap; /* ioremap map */ |
1186 |
+ void *cpumap; /* dma_alloc map */ |
1187 |
+ int desc_size, mem_size; |
1188 |
+@@ -152,7 +152,7 @@ struct cpdma_chan { |
1189 |
+ * abstract out these details |
1190 |
+ */ |
1191 |
+ static struct cpdma_desc_pool * |
1192 |
+-cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr, |
1193 |
++cpdma_desc_pool_create(struct device *dev, u32 phys, dma_addr_t hw_addr, |
1194 |
+ int size, int align) |
1195 |
+ { |
1196 |
+ int bitmap_size; |
1197 |
+@@ -176,13 +176,13 @@ cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr, |
1198 |
+ |
1199 |
+ if (phys) { |
1200 |
+ pool->phys = phys; |
1201 |
+- pool->iomap = ioremap(phys, size); |
1202 |
++ pool->iomap = ioremap(phys, size); /* should be memremap? */ |
1203 |
+ pool->hw_addr = hw_addr; |
1204 |
+ } else { |
1205 |
+- pool->cpumap = dma_alloc_coherent(dev, size, &pool->phys, |
1206 |
++ pool->cpumap = dma_alloc_coherent(dev, size, &pool->hw_addr, |
1207 |
+ GFP_KERNEL); |
1208 |
+- pool->iomap = pool->cpumap; |
1209 |
+- pool->hw_addr = pool->phys; |
1210 |
++ pool->iomap = (void __iomem __force *)pool->cpumap; |
1211 |
++ pool->phys = pool->hw_addr; /* assumes no IOMMU, don't use this value */ |
1212 |
+ } |
1213 |
+ |
1214 |
+ if (pool->iomap) |
1215 |
+diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c |
1216 |
+index a539e831b4b1..d8fcdc2414d8 100644 |
1217 |
+--- a/drivers/net/fjes/fjes_main.c |
1218 |
++++ b/drivers/net/fjes/fjes_main.c |
1219 |
+@@ -149,6 +149,9 @@ static int fjes_acpi_add(struct acpi_device *device) |
1220 |
+ /* create platform_device */ |
1221 |
+ plat_dev = platform_device_register_simple(DRV_NAME, 0, fjes_resource, |
1222 |
+ ARRAY_SIZE(fjes_resource)); |
1223 |
++ if (IS_ERR(plat_dev)) |
1224 |
++ return PTR_ERR(plat_dev); |
1225 |
++ |
1226 |
+ device->driver_data = plat_dev; |
1227 |
+ |
1228 |
+ return 0; |
1229 |
+diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c |
1230 |
+index 5a1e98547031..732c68ed166a 100644 |
1231 |
+--- a/drivers/net/hamradio/6pack.c |
1232 |
++++ b/drivers/net/hamradio/6pack.c |
1233 |
+@@ -669,10 +669,10 @@ static void sixpack_close(struct tty_struct *tty) |
1234 |
+ { |
1235 |
+ struct sixpack *sp; |
1236 |
+ |
1237 |
+- write_lock_bh(&disc_data_lock); |
1238 |
++ write_lock_irq(&disc_data_lock); |
1239 |
+ sp = tty->disc_data; |
1240 |
+ tty->disc_data = NULL; |
1241 |
+- write_unlock_bh(&disc_data_lock); |
1242 |
++ write_unlock_irq(&disc_data_lock); |
1243 |
+ if (!sp) |
1244 |
+ return; |
1245 |
+ |
1246 |
+diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c |
1247 |
+index 0758d0816840..470d416f2b86 100644 |
1248 |
+--- a/drivers/net/hamradio/mkiss.c |
1249 |
++++ b/drivers/net/hamradio/mkiss.c |
1250 |
+@@ -783,10 +783,10 @@ static void mkiss_close(struct tty_struct *tty) |
1251 |
+ { |
1252 |
+ struct mkiss *ax; |
1253 |
+ |
1254 |
+- write_lock_bh(&disc_data_lock); |
1255 |
++ write_lock_irq(&disc_data_lock); |
1256 |
+ ax = tty->disc_data; |
1257 |
+ tty->disc_data = NULL; |
1258 |
+- write_unlock_bh(&disc_data_lock); |
1259 |
++ write_unlock_irq(&disc_data_lock); |
1260 |
+ |
1261 |
+ if (!ax) |
1262 |
+ return; |
1263 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
1264 |
+index c6a87834723d..b15eceb8b442 100644 |
1265 |
+--- a/drivers/net/phy/phy_device.c |
1266 |
++++ b/drivers/net/phy/phy_device.c |
1267 |
+@@ -161,8 +161,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, |
1268 |
+ |
1269 |
+ dev->dev.release = phy_device_release; |
1270 |
+ |
1271 |
+- dev->speed = 0; |
1272 |
+- dev->duplex = -1; |
1273 |
++ dev->speed = SPEED_UNKNOWN; |
1274 |
++ dev->duplex = DUPLEX_UNKNOWN; |
1275 |
+ dev->pause = 0; |
1276 |
+ dev->asym_pause = 0; |
1277 |
+ dev->link = 1; |
1278 |
+diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c |
1279 |
+index fc922f812280..c813c5345a52 100644 |
1280 |
+--- a/drivers/net/usb/lan78xx.c |
1281 |
++++ b/drivers/net/usb/lan78xx.c |
1282 |
+@@ -1448,6 +1448,7 @@ static int lan78xx_mdio_init(struct lan78xx_net *dev) |
1283 |
+ dev->mdiobus->read = lan78xx_mdiobus_read; |
1284 |
+ dev->mdiobus->write = lan78xx_mdiobus_write; |
1285 |
+ dev->mdiobus->name = "lan78xx-mdiobus"; |
1286 |
++ dev->mdiobus->parent = &dev->udev->dev; |
1287 |
+ |
1288 |
+ snprintf(dev->mdiobus->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", |
1289 |
+ dev->udev->bus->busnum, dev->udev->devnum); |
1290 |
+diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c |
1291 |
+index 6d1105ab4592..f9d0f8372e3f 100644 |
1292 |
+--- a/drivers/net/wireless/ath/ath10k/txrx.c |
1293 |
++++ b/drivers/net/wireless/ath/ath10k/txrx.c |
1294 |
+@@ -96,6 +96,8 @@ void ath10k_txrx_tx_unref(struct ath10k_htt *htt, |
1295 |
+ |
1296 |
+ info = IEEE80211_SKB_CB(msdu); |
1297 |
+ memset(&info->status, 0, sizeof(info->status)); |
1298 |
++ info->status.rates[0].idx = -1; |
1299 |
++ |
1300 |
+ trace_ath10k_txrx_tx_unref(ar, tx_done->msdu_id); |
1301 |
+ |
1302 |
+ if (tx_done->discard) { |
1303 |
+diff --git a/drivers/net/wireless/iwlwifi/dvm/led.c b/drivers/net/wireless/iwlwifi/dvm/led.c |
1304 |
+index ca4d6692cc4e..47e5fa70483d 100644 |
1305 |
+--- a/drivers/net/wireless/iwlwifi/dvm/led.c |
1306 |
++++ b/drivers/net/wireless/iwlwifi/dvm/led.c |
1307 |
+@@ -184,6 +184,9 @@ void iwl_leds_init(struct iwl_priv *priv) |
1308 |
+ |
1309 |
+ priv->led.name = kasprintf(GFP_KERNEL, "%s-led", |
1310 |
+ wiphy_name(priv->hw->wiphy)); |
1311 |
++ if (!priv->led.name) |
1312 |
++ return; |
1313 |
++ |
1314 |
+ priv->led.brightness_set = iwl_led_brightness_set; |
1315 |
+ priv->led.blink_set = iwl_led_blink_set; |
1316 |
+ priv->led.max_brightness = 1; |
1317 |
+diff --git a/drivers/net/wireless/iwlwifi/mvm/led.c b/drivers/net/wireless/iwlwifi/mvm/led.c |
1318 |
+index e3b3cf4dbd77..948be43e4d26 100644 |
1319 |
+--- a/drivers/net/wireless/iwlwifi/mvm/led.c |
1320 |
++++ b/drivers/net/wireless/iwlwifi/mvm/led.c |
1321 |
+@@ -109,6 +109,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm) |
1322 |
+ |
1323 |
+ mvm->led.name = kasprintf(GFP_KERNEL, "%s-led", |
1324 |
+ wiphy_name(mvm->hw->wiphy)); |
1325 |
++ if (!mvm->led.name) |
1326 |
++ return -ENOMEM; |
1327 |
++ |
1328 |
+ mvm->led.brightness_set = iwl_led_brightness_set; |
1329 |
+ mvm->led.max_brightness = 1; |
1330 |
+ |
1331 |
+diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c |
1332 |
+index 268e50ba88a5..4c0a65692899 100644 |
1333 |
+--- a/drivers/net/wireless/mwifiex/pcie.c |
1334 |
++++ b/drivers/net/wireless/mwifiex/pcie.c |
1335 |
+@@ -577,8 +577,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter) |
1336 |
+ skb_put(skb, MAX_EVENT_SIZE); |
1337 |
+ |
1338 |
+ if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, |
1339 |
+- PCI_DMA_FROMDEVICE)) |
1340 |
++ PCI_DMA_FROMDEVICE)) { |
1341 |
++ kfree_skb(skb); |
1342 |
++ kfree(card->evtbd_ring_vbase); |
1343 |
+ return -1; |
1344 |
++ } |
1345 |
+ |
1346 |
+ buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); |
1347 |
+ |
1348 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1349 |
+index 34ce06441d1b..137d7c8645da 100644 |
1350 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1351 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c |
1352 |
+@@ -1601,6 +1601,8 @@ static bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb) |
1353 |
+ * This is maybe necessary: |
1354 |
+ * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb); |
1355 |
+ */ |
1356 |
++ dev_kfree_skb(skb); |
1357 |
++ |
1358 |
+ return true; |
1359 |
+ } |
1360 |
+ |
1361 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c |
1362 |
+index ad8390d2997b..9408c1f8e397 100644 |
1363 |
+--- a/drivers/net/wireless/realtek/rtlwifi/usb.c |
1364 |
++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c |
1365 |
+@@ -1094,8 +1094,10 @@ int rtl_usb_probe(struct usb_interface *intf, |
1366 |
+ rtlpriv->hw = hw; |
1367 |
+ rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), |
1368 |
+ GFP_KERNEL); |
1369 |
+- if (!rtlpriv->usb_data) |
1370 |
++ if (!rtlpriv->usb_data) { |
1371 |
++ ieee80211_free_hw(hw); |
1372 |
+ return -ENOMEM; |
1373 |
++ } |
1374 |
+ |
1375 |
+ /* this spin lock must be initialized early */ |
1376 |
+ spin_lock_init(&rtlpriv->locks.usb_lock); |
1377 |
+@@ -1158,6 +1160,7 @@ error_out: |
1378 |
+ _rtl_usb_io_handler_release(hw); |
1379 |
+ usb_put_dev(udev); |
1380 |
+ complete(&rtlpriv->firmware_loading_complete); |
1381 |
++ kfree(rtlpriv->usb_data); |
1382 |
+ return -ENODEV; |
1383 |
+ } |
1384 |
+ EXPORT_SYMBOL(rtl_usb_probe); |
1385 |
+diff --git a/drivers/parport/share.c b/drivers/parport/share.c |
1386 |
+index f26af0214ab3..3be1f4a041d4 100644 |
1387 |
+--- a/drivers/parport/share.c |
1388 |
++++ b/drivers/parport/share.c |
1389 |
+@@ -228,6 +228,18 @@ static int port_check(struct device *dev, void *dev_drv) |
1390 |
+ return 0; |
1391 |
+ } |
1392 |
+ |
1393 |
++/* |
1394 |
++ * Iterates through all the devices connected to the bus and return 1 |
1395 |
++ * if the device is a parallel port. |
1396 |
++ */ |
1397 |
++ |
1398 |
++static int port_detect(struct device *dev, void *dev_drv) |
1399 |
++{ |
1400 |
++ if (is_parport(dev)) |
1401 |
++ return 1; |
1402 |
++ return 0; |
1403 |
++} |
1404 |
++ |
1405 |
+ /** |
1406 |
+ * parport_register_driver - register a parallel port device driver |
1407 |
+ * @drv: structure describing the driver |
1408 |
+@@ -280,6 +292,15 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner, |
1409 |
+ if (ret) |
1410 |
+ return ret; |
1411 |
+ |
1412 |
++ /* |
1413 |
++ * check if bus has any parallel port registered, if |
1414 |
++ * none is found then load the lowlevel driver. |
1415 |
++ */ |
1416 |
++ ret = bus_for_each_dev(&parport_bus_type, NULL, NULL, |
1417 |
++ port_detect); |
1418 |
++ if (!ret) |
1419 |
++ get_lowlevel_driver(); |
1420 |
++ |
1421 |
+ mutex_lock(®istration_lock); |
1422 |
+ if (drv->match_port) |
1423 |
+ bus_for_each_dev(&parport_bus_type, NULL, drv, |
1424 |
+diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
1425 |
+index c691b2e34374..ab09d385f95d 100644 |
1426 |
+--- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
1427 |
++++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c |
1428 |
+@@ -1458,7 +1458,7 @@ static const struct pinmux_func pinmux_func_gpios[] = { |
1429 |
+ GPIO_FN(ET0_ETXD2_A), |
1430 |
+ GPIO_FN(EX_CS5), GPIO_FN(SD1_CMD_A), GPIO_FN(ATADIR), GPIO_FN(QSSL_B), |
1431 |
+ GPIO_FN(ET0_ETXD3_A), |
1432 |
+- GPIO_FN(RD_WR), GPIO_FN(TCLK1_B), |
1433 |
++ GPIO_FN(RD_WR), GPIO_FN(TCLK0), GPIO_FN(CAN_CLK_B), GPIO_FN(ET0_ETXD4), |
1434 |
+ GPIO_FN(EX_WAIT0), GPIO_FN(TCLK1_B), |
1435 |
+ GPIO_FN(EX_WAIT1), GPIO_FN(SD1_DAT0_A), GPIO_FN(DREQ2), |
1436 |
+ GPIO_FN(CAN1_TX_C), GPIO_FN(ET0_LINK_C), GPIO_FN(ET0_ETXD5_A), |
1437 |
+@@ -1954,7 +1954,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
1438 |
+ /* IP3_20 [1] */ |
1439 |
+ FN_EX_WAIT0, FN_TCLK1_B, |
1440 |
+ /* IP3_19_18 [2] */ |
1441 |
+- FN_RD_WR, FN_TCLK1_B, 0, 0, |
1442 |
++ FN_RD_WR, FN_TCLK0, FN_CAN_CLK_B, FN_ET0_ETXD4, |
1443 |
+ /* IP3_17_15 [3] */ |
1444 |
+ FN_EX_CS5, FN_SD1_CMD_A, FN_ATADIR, FN_QSSL_B, |
1445 |
+ FN_ET0_ETXD3_A, 0, 0, 0, |
1446 |
+diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c |
1447 |
+index 530d8d9bbdbb..2c7d7d40cc70 100644 |
1448 |
+--- a/drivers/platform/x86/hp-wmi.c |
1449 |
++++ b/drivers/platform/x86/hp-wmi.c |
1450 |
+@@ -309,7 +309,7 @@ static int __init hp_wmi_bios_2008_later(void) |
1451 |
+ |
1452 |
+ static int __init hp_wmi_bios_2009_later(void) |
1453 |
+ { |
1454 |
+- int state = 0; |
1455 |
++ u8 state[128]; |
1456 |
+ int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, 0, &state, |
1457 |
+ sizeof(state), sizeof(state)); |
1458 |
+ if (!ret) |
1459 |
+diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c |
1460 |
+index 5e941db5ccaf..c7e70cfb581f 100644 |
1461 |
+--- a/drivers/regulator/max8907-regulator.c |
1462 |
++++ b/drivers/regulator/max8907-regulator.c |
1463 |
+@@ -299,7 +299,10 @@ static int max8907_regulator_probe(struct platform_device *pdev) |
1464 |
+ memcpy(pmic->desc, max8907_regulators, sizeof(pmic->desc)); |
1465 |
+ |
1466 |
+ /* Backwards compatibility with MAX8907B; SD1 uses different voltages */ |
1467 |
+- regmap_read(max8907->regmap_gen, MAX8907_REG_II2RR, &val); |
1468 |
++ ret = regmap_read(max8907->regmap_gen, MAX8907_REG_II2RR, &val); |
1469 |
++ if (ret) |
1470 |
++ return ret; |
1471 |
++ |
1472 |
+ if ((val & MAX8907_II2RR_VERSION_MASK) == |
1473 |
+ MAX8907_II2RR_VERSION_REV_B) { |
1474 |
+ pmic->desc[MAX8907_SD1].min_uV = 637500; |
1475 |
+@@ -336,14 +339,20 @@ static int max8907_regulator_probe(struct platform_device *pdev) |
1476 |
+ } |
1477 |
+ |
1478 |
+ if (pmic->desc[i].ops == &max8907_ldo_ops) { |
1479 |
+- regmap_read(config.regmap, pmic->desc[i].enable_reg, |
1480 |
++ ret = regmap_read(config.regmap, pmic->desc[i].enable_reg, |
1481 |
+ &val); |
1482 |
++ if (ret) |
1483 |
++ return ret; |
1484 |
++ |
1485 |
+ if ((val & MAX8907_MASK_LDO_SEQ) != |
1486 |
+ MAX8907_MASK_LDO_SEQ) |
1487 |
+ pmic->desc[i].ops = &max8907_ldo_hwctl_ops; |
1488 |
+ } else if (pmic->desc[i].ops == &max8907_out5v_ops) { |
1489 |
+- regmap_read(config.regmap, pmic->desc[i].enable_reg, |
1490 |
++ ret = regmap_read(config.regmap, pmic->desc[i].enable_reg, |
1491 |
+ &val); |
1492 |
++ if (ret) |
1493 |
++ return ret; |
1494 |
++ |
1495 |
+ if ((val & (MAX8907_MASK_OUT5V_VINEN | |
1496 |
+ MAX8907_MASK_OUT5V_ENSRC)) != |
1497 |
+ MAX8907_MASK_OUT5V_ENSRC) |
1498 |
+diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c |
1499 |
+index be5ee2d37815..957767d38361 100644 |
1500 |
+--- a/drivers/scsi/csiostor/csio_lnode.c |
1501 |
++++ b/drivers/scsi/csiostor/csio_lnode.c |
1502 |
+@@ -301,6 +301,7 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1503 |
+ struct fc_fdmi_port_name *port_name; |
1504 |
+ uint8_t buf[64]; |
1505 |
+ uint8_t *fc4_type; |
1506 |
++ unsigned long flags; |
1507 |
+ |
1508 |
+ if (fdmi_req->wr_status != FW_SUCCESS) { |
1509 |
+ csio_ln_dbg(ln, "WR error:%x in processing fdmi rhba cmd\n", |
1510 |
+@@ -377,13 +378,13 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1511 |
+ len = (uint32_t)(pld - (uint8_t *)cmd); |
1512 |
+ |
1513 |
+ /* Submit FDMI RPA request */ |
1514 |
+- spin_lock_irq(&hw->lock); |
1515 |
++ spin_lock_irqsave(&hw->lock, flags); |
1516 |
+ if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_done, |
1517 |
+ FCOE_CT, &fdmi_req->dma_buf, len)) { |
1518 |
+ CSIO_INC_STATS(ln, n_fdmi_err); |
1519 |
+ csio_ln_dbg(ln, "Failed to issue fdmi rpa req\n"); |
1520 |
+ } |
1521 |
+- spin_unlock_irq(&hw->lock); |
1522 |
++ spin_unlock_irqrestore(&hw->lock, flags); |
1523 |
+ } |
1524 |
+ |
1525 |
+ /* |
1526 |
+@@ -404,6 +405,7 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1527 |
+ struct fc_fdmi_rpl *reg_pl; |
1528 |
+ struct fs_fdmi_attrs *attrib_blk; |
1529 |
+ uint8_t buf[64]; |
1530 |
++ unsigned long flags; |
1531 |
+ |
1532 |
+ if (fdmi_req->wr_status != FW_SUCCESS) { |
1533 |
+ csio_ln_dbg(ln, "WR error:%x in processing fdmi dprt cmd\n", |
1534 |
+@@ -483,13 +485,13 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1535 |
+ attrib_blk->numattrs = htonl(numattrs); |
1536 |
+ |
1537 |
+ /* Submit FDMI RHBA request */ |
1538 |
+- spin_lock_irq(&hw->lock); |
1539 |
++ spin_lock_irqsave(&hw->lock, flags); |
1540 |
+ if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_rhba_cbfn, |
1541 |
+ FCOE_CT, &fdmi_req->dma_buf, len)) { |
1542 |
+ CSIO_INC_STATS(ln, n_fdmi_err); |
1543 |
+ csio_ln_dbg(ln, "Failed to issue fdmi rhba req\n"); |
1544 |
+ } |
1545 |
+- spin_unlock_irq(&hw->lock); |
1546 |
++ spin_unlock_irqrestore(&hw->lock, flags); |
1547 |
+ } |
1548 |
+ |
1549 |
+ /* |
1550 |
+@@ -504,6 +506,7 @@ csio_ln_fdmi_dhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1551 |
+ void *cmd; |
1552 |
+ struct fc_fdmi_port_name *port_name; |
1553 |
+ uint32_t len; |
1554 |
++ unsigned long flags; |
1555 |
+ |
1556 |
+ if (fdmi_req->wr_status != FW_SUCCESS) { |
1557 |
+ csio_ln_dbg(ln, "WR error:%x in processing fdmi dhba cmd\n", |
1558 |
+@@ -534,13 +537,13 @@ csio_ln_fdmi_dhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) |
1559 |
+ len += sizeof(*port_name); |
1560 |
+ |
1561 |
+ /* Submit FDMI request */ |
1562 |
+- spin_lock_irq(&hw->lock); |
1563 |
++ spin_lock_irqsave(&hw->lock, flags); |
1564 |
+ if (csio_ln_mgmt_submit_req(fdmi_req, csio_ln_fdmi_dprt_cbfn, |
1565 |
+ FCOE_CT, &fdmi_req->dma_buf, len)) { |
1566 |
+ CSIO_INC_STATS(ln, n_fdmi_err); |
1567 |
+ csio_ln_dbg(ln, "Failed to issue fdmi dprt req\n"); |
1568 |
+ } |
1569 |
+- spin_unlock_irq(&hw->lock); |
1570 |
++ spin_unlock_irqrestore(&hw->lock, flags); |
1571 |
+ } |
1572 |
+ |
1573 |
+ /** |
1574 |
+diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
1575 |
+index 7ca8c2522c92..530b7df21322 100644 |
1576 |
+--- a/drivers/scsi/lpfc/lpfc_els.c |
1577 |
++++ b/drivers/scsi/lpfc/lpfc_els.c |
1578 |
+@@ -3839,7 +3839,7 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
1579 |
+ mempool_free(mbox, phba->mbox_mem_pool); |
1580 |
+ } |
1581 |
+ out: |
1582 |
+- if (ndlp && NLP_CHK_NODE_ACT(ndlp)) { |
1583 |
++ if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) { |
1584 |
+ spin_lock_irq(shost->host_lock); |
1585 |
+ ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI); |
1586 |
+ spin_unlock_irq(shost->host_lock); |
1587 |
+diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c |
1588 |
+index 3a4613f9fb9f..6aa0698925da 100644 |
1589 |
+--- a/drivers/scsi/lpfc/lpfc_nportdisc.c |
1590 |
++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c |
1591 |
+@@ -454,8 +454,10 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
1592 |
+ * single discovery thread, this will cause a huge delay in |
1593 |
+ * discovery. Also this will cause multiple state machines |
1594 |
+ * running in parallel for this node. |
1595 |
++ * This only applies to a fabric environment. |
1596 |
+ */ |
1597 |
+- if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) { |
1598 |
++ if ((ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) && |
1599 |
++ (vport->fc_flag & FC_FABRIC)) { |
1600 |
+ /* software abort outstanding PLOGI */ |
1601 |
+ lpfc_els_abort(phba, ndlp); |
1602 |
+ } |
1603 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
1604 |
+index 523a1058078a..065fdc17bbfb 100644 |
1605 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
1606 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
1607 |
+@@ -11759,13 +11759,19 @@ send_current_mbox: |
1608 |
+ phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; |
1609 |
+ /* Setting active mailbox pointer need to be in sync to flag clear */ |
1610 |
+ phba->sli.mbox_active = NULL; |
1611 |
++ if (bf_get(lpfc_trailer_consumed, mcqe)) |
1612 |
++ lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); |
1613 |
+ spin_unlock_irqrestore(&phba->hbalock, iflags); |
1614 |
+ /* Wake up worker thread to post the next pending mailbox command */ |
1615 |
+ lpfc_worker_wake_up(phba); |
1616 |
++ return workposted; |
1617 |
++ |
1618 |
+ out_no_mqe_complete: |
1619 |
++ spin_lock_irqsave(&phba->hbalock, iflags); |
1620 |
+ if (bf_get(lpfc_trailer_consumed, mcqe)) |
1621 |
+ lpfc_sli4_mq_release(phba->sli4_hba.mbx_wq); |
1622 |
+- return workposted; |
1623 |
++ spin_unlock_irqrestore(&phba->hbalock, iflags); |
1624 |
++ return false; |
1625 |
+ } |
1626 |
+ |
1627 |
+ /** |
1628 |
+@@ -15786,6 +15792,13 @@ lpfc_sli4_alloc_rpi(struct lpfc_hba *phba) |
1629 |
+ static void |
1630 |
+ __lpfc_sli4_free_rpi(struct lpfc_hba *phba, int rpi) |
1631 |
+ { |
1632 |
++ /* |
1633 |
++ * if the rpi value indicates a prior unreg has already |
1634 |
++ * been done, skip the unreg. |
1635 |
++ */ |
1636 |
++ if (rpi == LPFC_RPI_ALLOC_ERROR) |
1637 |
++ return; |
1638 |
++ |
1639 |
+ if (test_and_clear_bit(rpi, phba->sli4_hba.rpi_bmask)) { |
1640 |
+ phba->sli4_hba.rpi_count--; |
1641 |
+ phba->sli4_hba.max_cfg_param.rpi_used--; |
1642 |
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
1643 |
+index 4ccde5a05b70..7874b989d2f4 100644 |
1644 |
+--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
1645 |
++++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c |
1646 |
+@@ -1456,7 +1456,8 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc, |
1647 |
+ " for diag buffers, requested size(%d)\n", |
1648 |
+ ioc->name, __func__, request_data_sz); |
1649 |
+ mpt3sas_base_free_smid(ioc, smid); |
1650 |
+- return -ENOMEM; |
1651 |
++ rc = -ENOMEM; |
1652 |
++ goto out; |
1653 |
+ } |
1654 |
+ ioc->diag_buffer[buffer_type] = request_data; |
1655 |
+ ioc->diag_buffer_sz[buffer_type] = request_data_sz; |
1656 |
+diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
1657 |
+index 9edd61c063a1..df5f0bc29587 100644 |
1658 |
+--- a/drivers/scsi/pm8001/pm80xx_hwi.c |
1659 |
++++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
1660 |
+@@ -2368,6 +2368,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
1661 |
+ pm8001_printk("task 0x%p done with io_status 0x%x" |
1662 |
+ " resp 0x%x stat 0x%x but aborted by upper layer!\n", |
1663 |
+ t, status, ts->resp, ts->stat)); |
1664 |
++ if (t->slow_task) |
1665 |
++ complete(&t->slow_task->completion); |
1666 |
+ pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
1667 |
+ } else { |
1668 |
+ spin_unlock_irqrestore(&t->task_state_lock, flags); |
1669 |
+diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c |
1670 |
+index 08bb47b53bc3..551fd0329bca 100644 |
1671 |
+--- a/drivers/scsi/scsi_trace.c |
1672 |
++++ b/drivers/scsi/scsi_trace.c |
1673 |
+@@ -29,15 +29,18 @@ static const char * |
1674 |
+ scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb, int len) |
1675 |
+ { |
1676 |
+ const char *ret = trace_seq_buffer_ptr(p); |
1677 |
+- sector_t lba = 0, txlen = 0; |
1678 |
++ u32 lba = 0, txlen; |
1679 |
+ |
1680 |
+ lba |= ((cdb[1] & 0x1F) << 16); |
1681 |
+ lba |= (cdb[2] << 8); |
1682 |
+ lba |= cdb[3]; |
1683 |
+- txlen = cdb[4]; |
1684 |
++ /* |
1685 |
++ * From SBC-2: a TRANSFER LENGTH field set to zero specifies that 256 |
1686 |
++ * logical blocks shall be read (READ(6)) or written (WRITE(6)). |
1687 |
++ */ |
1688 |
++ txlen = cdb[4] ? cdb[4] : 256; |
1689 |
+ |
1690 |
+- trace_seq_printf(p, "lba=%llu txlen=%llu", |
1691 |
+- (unsigned long long)lba, (unsigned long long)txlen); |
1692 |
++ trace_seq_printf(p, "lba=%u txlen=%u", lba, txlen); |
1693 |
+ trace_seq_putc(p, 0); |
1694 |
+ |
1695 |
+ return ret; |
1696 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
1697 |
+index 504d36796152..fcf5141bf950 100644 |
1698 |
+--- a/drivers/scsi/ufs/ufshcd.c |
1699 |
++++ b/drivers/scsi/ufs/ufshcd.c |
1700 |
+@@ -1809,10 +1809,10 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba, |
1701 |
+ goto out_unlock; |
1702 |
+ } |
1703 |
+ |
1704 |
+- hba->dev_cmd.query.descriptor = NULL; |
1705 |
+ *buf_len = be16_to_cpu(response->upiu_res.length); |
1706 |
+ |
1707 |
+ out_unlock: |
1708 |
++ hba->dev_cmd.query.descriptor = NULL; |
1709 |
+ mutex_unlock(&hba->dev_cmd.lock); |
1710 |
+ out: |
1711 |
+ ufshcd_release(hba); |
1712 |
+diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c |
1713 |
+index 823cbc92d1e7..c46c0738c734 100644 |
1714 |
+--- a/drivers/spi/spi-img-spfi.c |
1715 |
++++ b/drivers/spi/spi-img-spfi.c |
1716 |
+@@ -673,6 +673,8 @@ static int img_spfi_probe(struct platform_device *pdev) |
1717 |
+ dma_release_channel(spfi->tx_ch); |
1718 |
+ if (spfi->rx_ch) |
1719 |
+ dma_release_channel(spfi->rx_ch); |
1720 |
++ spfi->tx_ch = NULL; |
1721 |
++ spfi->rx_ch = NULL; |
1722 |
+ dev_warn(spfi->dev, "Failed to get DMA channels, falling back to PIO mode\n"); |
1723 |
+ } else { |
1724 |
+ master->dma_tx = spfi->tx_ch; |
1725 |
+diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
1726 |
+index 193aa3da5033..96ed01cb6489 100644 |
1727 |
+--- a/drivers/spi/spi-pxa2xx.c |
1728 |
++++ b/drivers/spi/spi-pxa2xx.c |
1729 |
+@@ -1425,7 +1425,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) |
1730 |
+ } |
1731 |
+ |
1732 |
+ ssp->clk = devm_clk_get(&pdev->dev, NULL); |
1733 |
++ if (IS_ERR(ssp->clk)) |
1734 |
++ return NULL; |
1735 |
++ |
1736 |
+ ssp->irq = platform_get_irq(pdev, 0); |
1737 |
++ if (ssp->irq < 0) |
1738 |
++ return NULL; |
1739 |
++ |
1740 |
+ ssp->type = type; |
1741 |
+ ssp->pdev = pdev; |
1742 |
+ ssp->port_id = pxa2xx_spi_get_port_id(adev); |
1743 |
+diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
1744 |
+index af2880d0c112..cf2a329fd895 100644 |
1745 |
+--- a/drivers/spi/spi-tegra20-slink.c |
1746 |
++++ b/drivers/spi/spi-tegra20-slink.c |
1747 |
+@@ -1078,7 +1078,7 @@ static int tegra_slink_probe(struct platform_device *pdev) |
1748 |
+ ret = clk_enable(tspi->clk); |
1749 |
+ if (ret < 0) { |
1750 |
+ dev_err(&pdev->dev, "Clock enable failed %d\n", ret); |
1751 |
+- goto exit_free_master; |
1752 |
++ goto exit_clk_unprepare; |
1753 |
+ } |
1754 |
+ |
1755 |
+ spi_irq = platform_get_irq(pdev, 0); |
1756 |
+@@ -1151,6 +1151,8 @@ exit_free_irq: |
1757 |
+ free_irq(spi_irq, tspi); |
1758 |
+ exit_clk_disable: |
1759 |
+ clk_disable(tspi->clk); |
1760 |
++exit_clk_unprepare: |
1761 |
++ clk_unprepare(tspi->clk); |
1762 |
+ exit_free_master: |
1763 |
+ spi_master_put(master); |
1764 |
+ return ret; |
1765 |
+@@ -1164,6 +1166,7 @@ static int tegra_slink_remove(struct platform_device *pdev) |
1766 |
+ free_irq(tspi->irq, tspi); |
1767 |
+ |
1768 |
+ clk_disable(tspi->clk); |
1769 |
++ clk_unprepare(tspi->clk); |
1770 |
+ |
1771 |
+ if (tspi->tx_dma_chan) |
1772 |
+ tegra_slink_deinit_dma_param(tspi, false); |
1773 |
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
1774 |
+index c5f1045561ac..3709088d4d24 100644 |
1775 |
+--- a/drivers/spi/spidev.c |
1776 |
++++ b/drivers/spi/spidev.c |
1777 |
+@@ -662,6 +662,9 @@ static int spidev_release(struct inode *inode, struct file *filp) |
1778 |
+ if (dofree) |
1779 |
+ kfree(spidev); |
1780 |
+ } |
1781 |
++#ifdef CONFIG_SPI_SLAVE |
1782 |
++ spi_slave_abort(spidev->spi); |
1783 |
++#endif |
1784 |
+ mutex_unlock(&device_list_lock); |
1785 |
+ |
1786 |
+ return 0; |
1787 |
+diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c |
1788 |
+index 46ca5d938d5b..cca1230f0373 100644 |
1789 |
+--- a/drivers/staging/comedi/drivers/gsc_hpdi.c |
1790 |
++++ b/drivers/staging/comedi/drivers/gsc_hpdi.c |
1791 |
+@@ -632,12 +632,22 @@ static int gsc_hpdi_auto_attach(struct comedi_device *dev, |
1792 |
+ devpriv->dio_buffer[i] = |
1793 |
+ pci_alloc_consistent(pcidev, DMA_BUFFER_SIZE, |
1794 |
+ &devpriv->dio_buffer_phys_addr[i]); |
1795 |
++ if (!devpriv->dio_buffer[i]) { |
1796 |
++ dev_warn(dev->class_dev, |
1797 |
++ "failed to allocate DMA buffer\n"); |
1798 |
++ return -ENOMEM; |
1799 |
++ } |
1800 |
+ } |
1801 |
+ /* allocate dma descriptors */ |
1802 |
+ devpriv->dma_desc = pci_alloc_consistent(pcidev, |
1803 |
+ sizeof(struct plx_dma_desc) * |
1804 |
+ NUM_DMA_DESCRIPTORS, |
1805 |
+ &devpriv->dma_desc_phys_addr); |
1806 |
++ if (!devpriv->dma_desc) { |
1807 |
++ dev_warn(dev->class_dev, |
1808 |
++ "failed to allocate DMA descriptors\n"); |
1809 |
++ return -ENOMEM; |
1810 |
++ } |
1811 |
+ if (devpriv->dma_desc_phys_addr & 0xf) { |
1812 |
+ dev_warn(dev->class_dev, |
1813 |
+ " dma descriptors not quad-word aligned (bug)\n"); |
1814 |
+diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c |
1815 |
+index 15937e0ef4d9..36bf71989637 100644 |
1816 |
+--- a/drivers/staging/fbtft/fbtft-core.c |
1817 |
++++ b/drivers/staging/fbtft/fbtft-core.c |
1818 |
+@@ -765,7 +765,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, |
1819 |
+ fbdefio->deferred_io = fbtft_deferred_io; |
1820 |
+ fb_deferred_io_init(info); |
1821 |
+ |
1822 |
+- strncpy(info->fix.id, dev->driver->name, 16); |
1823 |
++ snprintf(info->fix.id, sizeof(info->fix.id), "%s", dev->driver->name); |
1824 |
+ info->fix.type = FB_TYPE_PACKED_PIXELS; |
1825 |
+ info->fix.visual = FB_VISUAL_TRUECOLOR; |
1826 |
+ info->fix.xpanstep = 0; |
1827 |
+diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
1828 |
+index cabb810369bd..c6bf8933648d 100644 |
1829 |
+--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c |
1830 |
++++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c |
1831 |
+@@ -822,7 +822,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr |
1832 |
+ memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN); |
1833 |
+ memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN); |
1834 |
+ |
1835 |
+- if (psta->qos_option) |
1836 |
++ if (psta && psta->qos_option) |
1837 |
+ qos_option = true; |
1838 |
+ } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || |
1839 |
+ check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { |
1840 |
+@@ -830,7 +830,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr |
1841 |
+ memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); |
1842 |
+ memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); |
1843 |
+ |
1844 |
+- if (psta->qos_option) |
1845 |
++ if (psta && psta->qos_option) |
1846 |
+ qos_option = true; |
1847 |
+ } else { |
1848 |
+ RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x is not allowed to xmit frame\n", get_fwstate(pmlmepriv))); |
1849 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
1850 |
+index cbb4414edd71..564828554ca0 100644 |
1851 |
+--- a/drivers/target/iscsi/iscsi_target.c |
1852 |
++++ b/drivers/target/iscsi/iscsi_target.c |
1853 |
+@@ -993,7 +993,9 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
1854 |
+ hdr->cmdsn, be32_to_cpu(hdr->data_length), payload_length, |
1855 |
+ conn->cid); |
1856 |
+ |
1857 |
+- target_get_sess_cmd(&cmd->se_cmd, true); |
1858 |
++ if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) |
1859 |
++ return iscsit_add_reject_cmd(cmd, |
1860 |
++ ISCSI_REASON_WAITING_FOR_LOGOUT, buf); |
1861 |
+ |
1862 |
+ cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd, |
1863 |
+ scsilun_to_int(&hdr->lun)); |
1864 |
+@@ -1804,7 +1806,9 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
1865 |
+ conn->sess->se_sess, 0, DMA_NONE, |
1866 |
+ TCM_SIMPLE_TAG, cmd->sense_buffer + 2); |
1867 |
+ |
1868 |
+- target_get_sess_cmd(&cmd->se_cmd, true); |
1869 |
++ if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) |
1870 |
++ return iscsit_add_reject_cmd(cmd, |
1871 |
++ ISCSI_REASON_WAITING_FOR_LOGOUT, buf); |
1872 |
+ |
1873 |
+ /* |
1874 |
+ * TASK_REASSIGN for ERL=2 / connection stays inside of |
1875 |
+@@ -4390,6 +4394,8 @@ int iscsit_close_connection( |
1876 |
+ * must wait until they have completed. |
1877 |
+ */ |
1878 |
+ iscsit_check_conn_usage_count(conn); |
1879 |
++ target_sess_cmd_list_set_waiting(sess->se_sess); |
1880 |
++ target_wait_for_sess_cmds(sess->se_sess); |
1881 |
+ |
1882 |
+ if (conn->conn_rx_hash.tfm) |
1883 |
+ crypto_free_hash(conn->conn_rx_hash.tfm); |
1884 |
+diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c |
1885 |
+index 3184e023a052..1dd6028eccb9 100644 |
1886 |
+--- a/drivers/target/iscsi/iscsi_target_auth.c |
1887 |
++++ b/drivers/target/iscsi/iscsi_target_auth.c |
1888 |
+@@ -74,7 +74,7 @@ static int chap_check_algorithm(const char *a_str) |
1889 |
+ if (!token) |
1890 |
+ goto out; |
1891 |
+ |
1892 |
+- if (!strncmp(token, "5", 1)) { |
1893 |
++ if (!strcmp(token, "5")) { |
1894 |
+ pr_debug("Selected MD5 Algorithm\n"); |
1895 |
+ kfree(orig); |
1896 |
+ return CHAP_DIGEST_MD5; |
1897 |
+diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c |
1898 |
+index 54f5332f814d..230c56d40557 100644 |
1899 |
+--- a/drivers/usb/host/ehci-q.c |
1900 |
++++ b/drivers/usb/host/ehci-q.c |
1901 |
+@@ -40,6 +40,10 @@ |
1902 |
+ |
1903 |
+ /*-------------------------------------------------------------------------*/ |
1904 |
+ |
1905 |
++/* PID Codes that are used here, from EHCI specification, Table 3-16. */ |
1906 |
++#define PID_CODE_IN 1 |
1907 |
++#define PID_CODE_SETUP 2 |
1908 |
++ |
1909 |
+ /* fill a qtd, returning how much of the buffer we were able to queue up */ |
1910 |
+ |
1911 |
+ static int |
1912 |
+@@ -199,7 +203,7 @@ static int qtd_copy_status ( |
1913 |
+ int status = -EINPROGRESS; |
1914 |
+ |
1915 |
+ /* count IN/OUT bytes, not SETUP (even short packets) */ |
1916 |
+- if (likely (QTD_PID (token) != 2)) |
1917 |
++ if (likely(QTD_PID(token) != PID_CODE_SETUP)) |
1918 |
+ urb->actual_length += length - QTD_LENGTH (token); |
1919 |
+ |
1920 |
+ /* don't modify error codes */ |
1921 |
+@@ -215,6 +219,13 @@ static int qtd_copy_status ( |
1922 |
+ if (token & QTD_STS_BABBLE) { |
1923 |
+ /* FIXME "must" disable babbling device's port too */ |
1924 |
+ status = -EOVERFLOW; |
1925 |
++ /* |
1926 |
++ * When MMF is active and PID Code is IN, queue is halted. |
1927 |
++ * EHCI Specification, Table 4-13. |
1928 |
++ */ |
1929 |
++ } else if ((token & QTD_STS_MMF) && |
1930 |
++ (QTD_PID(token) == PID_CODE_IN)) { |
1931 |
++ status = -EPROTO; |
1932 |
+ /* CERR nonzero + halt --> stall */ |
1933 |
+ } else if (QTD_CERR(token)) { |
1934 |
+ status = -EPIPE; |
1935 |
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
1936 |
+index bda176fa6e48..df86ea308415 100644 |
1937 |
+--- a/drivers/usb/host/xhci-pci.c |
1938 |
++++ b/drivers/usb/host/xhci-pci.c |
1939 |
+@@ -444,7 +444,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
1940 |
+ retval = xhci_resume(xhci, hibernated); |
1941 |
+ return retval; |
1942 |
+ } |
1943 |
+-#endif /* CONFIG_PM */ |
1944 |
+ |
1945 |
+ static void xhci_pci_shutdown(struct usb_hcd *hcd) |
1946 |
+ { |
1947 |
+@@ -457,6 +456,7 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd) |
1948 |
+ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
1949 |
+ pci_set_power_state(pdev, PCI_D3hot); |
1950 |
+ } |
1951 |
++#endif /* CONFIG_PM */ |
1952 |
+ |
1953 |
+ /*-------------------------------------------------------------------------*/ |
1954 |
+ |
1955 |
+diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h |
1956 |
+index b8620aa6b72e..8424c165f732 100644 |
1957 |
+--- a/drivers/usb/renesas_usbhs/common.h |
1958 |
++++ b/drivers/usb/renesas_usbhs/common.h |
1959 |
+@@ -163,11 +163,12 @@ struct usbhs_priv; |
1960 |
+ #define VBSTS (1 << 7) /* VBUS_0 and VBUSIN_0 Input Status */ |
1961 |
+ #define VALID (1 << 3) /* USB Request Receive */ |
1962 |
+ |
1963 |
+-#define DVSQ_MASK (0x3 << 4) /* Device State */ |
1964 |
++#define DVSQ_MASK (0x7 << 4) /* Device State */ |
1965 |
+ #define POWER_STATE (0 << 4) |
1966 |
+ #define DEFAULT_STATE (1 << 4) |
1967 |
+ #define ADDRESS_STATE (2 << 4) |
1968 |
+ #define CONFIGURATION_STATE (3 << 4) |
1969 |
++#define SUSPENDED_STATE (4 << 4) |
1970 |
+ |
1971 |
+ #define CTSQ_MASK (0x7) /* Control Transfer Stage */ |
1972 |
+ #define IDLE_SETUP_STAGE 0 /* Idle stage or setup stage */ |
1973 |
+diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c |
1974 |
+index efe8d815cf2c..5731621984c6 100644 |
1975 |
+--- a/drivers/usb/renesas_usbhs/mod_gadget.c |
1976 |
++++ b/drivers/usb/renesas_usbhs/mod_gadget.c |
1977 |
+@@ -467,12 +467,18 @@ static int usbhsg_irq_dev_state(struct usbhs_priv *priv, |
1978 |
+ { |
1979 |
+ struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); |
1980 |
+ struct device *dev = usbhsg_gpriv_to_dev(gpriv); |
1981 |
++ int state = usbhs_status_get_device_state(irq_state); |
1982 |
+ |
1983 |
+ gpriv->gadget.speed = usbhs_bus_get_speed(priv); |
1984 |
+ |
1985 |
+- dev_dbg(dev, "state = %x : speed : %d\n", |
1986 |
+- usbhs_status_get_device_state(irq_state), |
1987 |
+- gpriv->gadget.speed); |
1988 |
++ dev_dbg(dev, "state = %x : speed : %d\n", state, gpriv->gadget.speed); |
1989 |
++ |
1990 |
++ if (gpriv->gadget.speed != USB_SPEED_UNKNOWN && |
1991 |
++ (state & SUSPENDED_STATE)) { |
1992 |
++ if (gpriv->driver && gpriv->driver->suspend) |
1993 |
++ gpriv->driver->suspend(&gpriv->gadget); |
1994 |
++ usb_gadget_set_state(&gpriv->gadget, USB_STATE_SUSPENDED); |
1995 |
++ } |
1996 |
+ |
1997 |
+ return 0; |
1998 |
+ } |
1999 |
+diff --git a/drivers/usb/usbip/vhci_rx.c b/drivers/usb/usbip/vhci_rx.c |
2000 |
+index 323aa7789989..9c8d936c9009 100644 |
2001 |
+--- a/drivers/usb/usbip/vhci_rx.c |
2002 |
++++ b/drivers/usb/usbip/vhci_rx.c |
2003 |
+@@ -89,16 +89,21 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, |
2004 |
+ usbip_pack_pdu(pdu, urb, USBIP_RET_SUBMIT, 0); |
2005 |
+ |
2006 |
+ /* recv transfer buffer */ |
2007 |
+- if (usbip_recv_xbuff(ud, urb) < 0) |
2008 |
+- return; |
2009 |
++ if (usbip_recv_xbuff(ud, urb) < 0) { |
2010 |
++ urb->status = -EPROTO; |
2011 |
++ goto error; |
2012 |
++ } |
2013 |
+ |
2014 |
+ /* recv iso_packet_descriptor */ |
2015 |
+- if (usbip_recv_iso(ud, urb) < 0) |
2016 |
+- return; |
2017 |
++ if (usbip_recv_iso(ud, urb) < 0) { |
2018 |
++ urb->status = -EPROTO; |
2019 |
++ goto error; |
2020 |
++ } |
2021 |
+ |
2022 |
+ /* restore the padding in iso packets */ |
2023 |
+ usbip_pad_iso(ud, urb); |
2024 |
+ |
2025 |
++error: |
2026 |
+ if (usbip_dbg_flag_vhci_rx) |
2027 |
+ usbip_dump_urb(urb); |
2028 |
+ |
2029 |
+diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
2030 |
+index a980b3309770..62caf3bcadf8 100644 |
2031 |
+--- a/fs/btrfs/ctree.c |
2032 |
++++ b/fs/btrfs/ctree.c |
2033 |
+@@ -425,7 +425,7 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info, |
2034 |
+ for (node = rb_first(tm_root); node; node = next) { |
2035 |
+ next = rb_next(node); |
2036 |
+ tm = container_of(node, struct tree_mod_elem, node); |
2037 |
+- if (tm->seq > min_seq) |
2038 |
++ if (tm->seq >= min_seq) |
2039 |
+ continue; |
2040 |
+ rb_erase(node, tm_root); |
2041 |
+ kfree(tm); |
2042 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
2043 |
+index 78722aaffecd..d50fc503f73b 100644 |
2044 |
+--- a/fs/btrfs/disk-io.c |
2045 |
++++ b/fs/btrfs/disk-io.c |
2046 |
+@@ -1698,8 +1698,8 @@ static void end_workqueue_fn(struct btrfs_work *work) |
2047 |
+ bio->bi_error = end_io_wq->error; |
2048 |
+ bio->bi_private = end_io_wq->private; |
2049 |
+ bio->bi_end_io = end_io_wq->end_io; |
2050 |
+- kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
2051 |
+ bio_endio(bio); |
2052 |
++ kmem_cache_free(btrfs_end_io_wq_cache, end_io_wq); |
2053 |
+ } |
2054 |
+ |
2055 |
+ static int cleaner_kthread(void *arg) |
2056 |
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c |
2057 |
+index a18f558b4477..6f5563ca70c1 100644 |
2058 |
+--- a/fs/btrfs/extent_io.c |
2059 |
++++ b/fs/btrfs/extent_io.c |
2060 |
+@@ -4948,12 +4948,14 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, |
2061 |
+ return eb; |
2062 |
+ eb = alloc_dummy_extent_buffer(fs_info, start); |
2063 |
+ if (!eb) |
2064 |
+- return NULL; |
2065 |
++ return ERR_PTR(-ENOMEM); |
2066 |
+ eb->fs_info = fs_info; |
2067 |
+ again: |
2068 |
+ ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM); |
2069 |
+- if (ret) |
2070 |
++ if (ret) { |
2071 |
++ exists = ERR_PTR(ret); |
2072 |
+ goto free_eb; |
2073 |
++ } |
2074 |
+ spin_lock(&fs_info->buffer_lock); |
2075 |
+ ret = radix_tree_insert(&fs_info->buffer_radix, |
2076 |
+ start >> PAGE_CACHE_SHIFT, eb); |
2077 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
2078 |
+index 383717ccecc7..548e9cd1a337 100644 |
2079 |
+--- a/fs/btrfs/inode.c |
2080 |
++++ b/fs/btrfs/inode.c |
2081 |
+@@ -5506,7 +5506,6 @@ static void inode_tree_del(struct inode *inode) |
2082 |
+ spin_unlock(&root->inode_lock); |
2083 |
+ |
2084 |
+ if (empty && btrfs_root_refs(&root->root_item) == 0) { |
2085 |
+- synchronize_srcu(&root->fs_info->subvol_srcu); |
2086 |
+ spin_lock(&root->inode_lock); |
2087 |
+ empty = RB_EMPTY_ROOT(&root->inode_tree); |
2088 |
+ spin_unlock(&root->inode_lock); |
2089 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
2090 |
+index 3379490ce54d..119b1c5c279b 100644 |
2091 |
+--- a/fs/btrfs/ioctl.c |
2092 |
++++ b/fs/btrfs/ioctl.c |
2093 |
+@@ -594,12 +594,18 @@ static noinline int create_subvol(struct inode *dir, |
2094 |
+ |
2095 |
+ btrfs_i_size_write(dir, dir->i_size + namelen * 2); |
2096 |
+ ret = btrfs_update_inode(trans, root, dir); |
2097 |
+- BUG_ON(ret); |
2098 |
++ if (ret) { |
2099 |
++ btrfs_abort_transaction(trans, root, ret); |
2100 |
++ goto fail; |
2101 |
++ } |
2102 |
+ |
2103 |
+ ret = btrfs_add_root_ref(trans, root->fs_info->tree_root, |
2104 |
+ objectid, root->root_key.objectid, |
2105 |
+ btrfs_ino(dir), index, name, namelen); |
2106 |
+- BUG_ON(ret); |
2107 |
++ if (ret) { |
2108 |
++ btrfs_abort_transaction(trans, root, ret); |
2109 |
++ goto fail; |
2110 |
++ } |
2111 |
+ |
2112 |
+ ret = btrfs_uuid_tree_add(trans, root->fs_info->uuid_root, |
2113 |
+ root_item.uuid, BTRFS_UUID_KEY_SUBVOL, |
2114 |
+diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c |
2115 |
+index d6ccfb31aef0..f38bac9456fd 100644 |
2116 |
+--- a/fs/btrfs/relocation.c |
2117 |
++++ b/fs/btrfs/relocation.c |
2118 |
+@@ -4454,6 +4454,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) |
2119 |
+ reloc_root->root_key.offset); |
2120 |
+ if (IS_ERR(fs_root)) { |
2121 |
+ err = PTR_ERR(fs_root); |
2122 |
++ list_add_tail(&reloc_root->root_list, &reloc_roots); |
2123 |
+ goto out_free; |
2124 |
+ } |
2125 |
+ |
2126 |
+diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c |
2127 |
+index 2b2978c04e80..1efec40455f8 100644 |
2128 |
+--- a/fs/btrfs/tests/qgroup-tests.c |
2129 |
++++ b/fs/btrfs/tests/qgroup-tests.c |
2130 |
+@@ -477,9 +477,9 @@ int btrfs_test_qgroups(void) |
2131 |
+ * *cough*backref walking code*cough* |
2132 |
+ */ |
2133 |
+ root->node = alloc_test_extent_buffer(root->fs_info, 4096); |
2134 |
+- if (!root->node) { |
2135 |
++ if (IS_ERR(root->node)) { |
2136 |
+ test_msg("Couldn't allocate dummy buffer\n"); |
2137 |
+- ret = -ENOMEM; |
2138 |
++ ret = PTR_ERR(root->node); |
2139 |
+ goto out; |
2140 |
+ } |
2141 |
+ btrfs_set_header_level(root->node, 0); |
2142 |
+diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c |
2143 |
+index 837a9a8d579e..24eb6283dc62 100644 |
2144 |
+--- a/fs/btrfs/uuid-tree.c |
2145 |
++++ b/fs/btrfs/uuid-tree.c |
2146 |
+@@ -332,6 +332,8 @@ again_search_slot: |
2147 |
+ } |
2148 |
+ if (ret < 0 && ret != -ENOENT) |
2149 |
+ goto out; |
2150 |
++ key.offset++; |
2151 |
++ goto again_search_slot; |
2152 |
+ } |
2153 |
+ item_size -= sizeof(subid_le); |
2154 |
+ offset += sizeof(subid_le); |
2155 |
+diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c |
2156 |
+index 8eb768bbf5b5..209018f08dfd 100644 |
2157 |
+--- a/fs/ext4/dir.c |
2158 |
++++ b/fs/ext4/dir.c |
2159 |
+@@ -75,6 +75,11 @@ int __ext4_check_dir_entry(const char *function, unsigned int line, |
2160 |
+ error_msg = "rec_len is too small for name_len"; |
2161 |
+ else if (unlikely(((char *) de - buf) + rlen > size)) |
2162 |
+ error_msg = "directory entry overrun"; |
2163 |
++ else if (unlikely(((char *) de - buf) + rlen > |
2164 |
++ size - EXT4_DIR_REC_LEN(1) && |
2165 |
++ ((char *) de - buf) + rlen != size)) { |
2166 |
++ error_msg = "directory entry too close to block end"; |
2167 |
++ } |
2168 |
+ else if (unlikely(le32_to_cpu(de->inode) > |
2169 |
+ le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count))) |
2170 |
+ error_msg = "inode out of bounds"; |
2171 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
2172 |
+index aa08e129149d..712bf332e394 100644 |
2173 |
+--- a/fs/ext4/namei.c |
2174 |
++++ b/fs/ext4/namei.c |
2175 |
+@@ -3040,18 +3040,17 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) |
2176 |
+ if (IS_DIRSYNC(dir)) |
2177 |
+ ext4_handle_sync(handle); |
2178 |
+ |
2179 |
+- if (inode->i_nlink == 0) { |
2180 |
+- ext4_warning_inode(inode, "Deleting file '%.*s' with no links", |
2181 |
+- dentry->d_name.len, dentry->d_name.name); |
2182 |
+- set_nlink(inode, 1); |
2183 |
+- } |
2184 |
+ retval = ext4_delete_entry(handle, dir, de, bh); |
2185 |
+ if (retval) |
2186 |
+ goto end_unlink; |
2187 |
+ dir->i_ctime = dir->i_mtime = ext4_current_time(dir); |
2188 |
+ ext4_update_dx_flag(dir); |
2189 |
+ ext4_mark_inode_dirty(handle, dir); |
2190 |
+- drop_nlink(inode); |
2191 |
++ if (inode->i_nlink == 0) |
2192 |
++ ext4_warning_inode(inode, "Deleting file '%.*s' with no links", |
2193 |
++ dentry->d_name.len, dentry->d_name.name); |
2194 |
++ else |
2195 |
++ drop_nlink(inode); |
2196 |
+ if (!inode->i_nlink) |
2197 |
+ ext4_orphan_add(handle, inode); |
2198 |
+ inode->i_ctime = ext4_current_time(inode); |
2199 |
+diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c |
2200 |
+index 2d964ce45606..ebbd7d054cab 100644 |
2201 |
+--- a/fs/jbd2/commit.c |
2202 |
++++ b/fs/jbd2/commit.c |
2203 |
+@@ -740,7 +740,6 @@ start_journal_io: |
2204 |
+ submit_bh(WRITE_SYNC, bh); |
2205 |
+ } |
2206 |
+ cond_resched(); |
2207 |
+- stats.run.rs_blocks_logged += bufs; |
2208 |
+ |
2209 |
+ /* Force a new descriptor to be generated next |
2210 |
+ time round the loop. */ |
2211 |
+@@ -827,6 +826,7 @@ start_journal_io: |
2212 |
+ if (unlikely(!buffer_uptodate(bh))) |
2213 |
+ err = -EIO; |
2214 |
+ jbd2_unfile_log_bh(bh); |
2215 |
++ stats.run.rs_blocks_logged++; |
2216 |
+ |
2217 |
+ /* |
2218 |
+ * The list contains temporary buffer heads created by |
2219 |
+@@ -872,6 +872,7 @@ start_journal_io: |
2220 |
+ BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); |
2221 |
+ clear_buffer_jwrite(bh); |
2222 |
+ jbd2_unfile_log_bh(bh); |
2223 |
++ stats.run.rs_blocks_logged++; |
2224 |
+ __brelse(bh); /* One for getblk */ |
2225 |
+ /* AKPM: bforget here */ |
2226 |
+ } |
2227 |
+@@ -893,6 +894,7 @@ start_journal_io: |
2228 |
+ } |
2229 |
+ if (cbh) |
2230 |
+ err = journal_wait_on_commit_record(journal, cbh); |
2231 |
++ stats.run.rs_blocks_logged++; |
2232 |
+ if (jbd2_has_feature_async_commit(journal) && |
2233 |
+ journal->j_flags & JBD2_BARRIER) { |
2234 |
+ blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL); |
2235 |
+diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c |
2236 |
+index 1e0d8da0d3cd..80b92120c812 100644 |
2237 |
+--- a/fs/ocfs2/acl.c |
2238 |
++++ b/fs/ocfs2/acl.c |
2239 |
+@@ -338,8 +338,8 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh) |
2240 |
+ down_read(&OCFS2_I(inode)->ip_xattr_sem); |
2241 |
+ acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh); |
2242 |
+ up_read(&OCFS2_I(inode)->ip_xattr_sem); |
2243 |
+- if (IS_ERR(acl) || !acl) |
2244 |
+- return PTR_ERR(acl); |
2245 |
++ if (IS_ERR_OR_NULL(acl)) |
2246 |
++ return PTR_ERR_OR_ZERO(acl); |
2247 |
+ ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); |
2248 |
+ if (ret) |
2249 |
+ return ret; |
2250 |
+diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c |
2251 |
+index 7430cb0e21a7..b7d5e254792c 100644 |
2252 |
+--- a/fs/quota/dquot.c |
2253 |
++++ b/fs/quota/dquot.c |
2254 |
+@@ -2783,68 +2783,73 @@ EXPORT_SYMBOL(dquot_quotactl_sysfile_ops); |
2255 |
+ static int do_proc_dqstats(struct ctl_table *table, int write, |
2256 |
+ void __user *buffer, size_t *lenp, loff_t *ppos) |
2257 |
+ { |
2258 |
+- unsigned int type = (int *)table->data - dqstats.stat; |
2259 |
++ unsigned int type = (unsigned long *)table->data - dqstats.stat; |
2260 |
++ s64 value = percpu_counter_sum(&dqstats.counter[type]); |
2261 |
++ |
2262 |
++ /* Filter negative values for non-monotonic counters */ |
2263 |
++ if (value < 0 && (type == DQST_ALLOC_DQUOTS || |
2264 |
++ type == DQST_FREE_DQUOTS)) |
2265 |
++ value = 0; |
2266 |
+ |
2267 |
+ /* Update global table */ |
2268 |
+- dqstats.stat[type] = |
2269 |
+- percpu_counter_sum_positive(&dqstats.counter[type]); |
2270 |
+- return proc_dointvec(table, write, buffer, lenp, ppos); |
2271 |
++ dqstats.stat[type] = value; |
2272 |
++ return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); |
2273 |
+ } |
2274 |
+ |
2275 |
+ static struct ctl_table fs_dqstats_table[] = { |
2276 |
+ { |
2277 |
+ .procname = "lookups", |
2278 |
+ .data = &dqstats.stat[DQST_LOOKUPS], |
2279 |
+- .maxlen = sizeof(int), |
2280 |
++ .maxlen = sizeof(unsigned long), |
2281 |
+ .mode = 0444, |
2282 |
+ .proc_handler = do_proc_dqstats, |
2283 |
+ }, |
2284 |
+ { |
2285 |
+ .procname = "drops", |
2286 |
+ .data = &dqstats.stat[DQST_DROPS], |
2287 |
+- .maxlen = sizeof(int), |
2288 |
++ .maxlen = sizeof(unsigned long), |
2289 |
+ .mode = 0444, |
2290 |
+ .proc_handler = do_proc_dqstats, |
2291 |
+ }, |
2292 |
+ { |
2293 |
+ .procname = "reads", |
2294 |
+ .data = &dqstats.stat[DQST_READS], |
2295 |
+- .maxlen = sizeof(int), |
2296 |
++ .maxlen = sizeof(unsigned long), |
2297 |
+ .mode = 0444, |
2298 |
+ .proc_handler = do_proc_dqstats, |
2299 |
+ }, |
2300 |
+ { |
2301 |
+ .procname = "writes", |
2302 |
+ .data = &dqstats.stat[DQST_WRITES], |
2303 |
+- .maxlen = sizeof(int), |
2304 |
++ .maxlen = sizeof(unsigned long), |
2305 |
+ .mode = 0444, |
2306 |
+ .proc_handler = do_proc_dqstats, |
2307 |
+ }, |
2308 |
+ { |
2309 |
+ .procname = "cache_hits", |
2310 |
+ .data = &dqstats.stat[DQST_CACHE_HITS], |
2311 |
+- .maxlen = sizeof(int), |
2312 |
++ .maxlen = sizeof(unsigned long), |
2313 |
+ .mode = 0444, |
2314 |
+ .proc_handler = do_proc_dqstats, |
2315 |
+ }, |
2316 |
+ { |
2317 |
+ .procname = "allocated_dquots", |
2318 |
+ .data = &dqstats.stat[DQST_ALLOC_DQUOTS], |
2319 |
+- .maxlen = sizeof(int), |
2320 |
++ .maxlen = sizeof(unsigned long), |
2321 |
+ .mode = 0444, |
2322 |
+ .proc_handler = do_proc_dqstats, |
2323 |
+ }, |
2324 |
+ { |
2325 |
+ .procname = "free_dquots", |
2326 |
+ .data = &dqstats.stat[DQST_FREE_DQUOTS], |
2327 |
+- .maxlen = sizeof(int), |
2328 |
++ .maxlen = sizeof(unsigned long), |
2329 |
+ .mode = 0444, |
2330 |
+ .proc_handler = do_proc_dqstats, |
2331 |
+ }, |
2332 |
+ { |
2333 |
+ .procname = "syncs", |
2334 |
+ .data = &dqstats.stat[DQST_SYNCS], |
2335 |
+- .maxlen = sizeof(int), |
2336 |
++ .maxlen = sizeof(unsigned long), |
2337 |
+ .mode = 0444, |
2338 |
+ .proc_handler = do_proc_dqstats, |
2339 |
+ }, |
2340 |
+diff --git a/fs/readdir.c b/fs/readdir.c |
2341 |
+index ced679179cac..3494d7a8ff65 100644 |
2342 |
+--- a/fs/readdir.c |
2343 |
++++ b/fs/readdir.c |
2344 |
+@@ -50,6 +50,40 @@ out: |
2345 |
+ } |
2346 |
+ EXPORT_SYMBOL(iterate_dir); |
2347 |
+ |
2348 |
++/* |
2349 |
++ * POSIX says that a dirent name cannot contain NULL or a '/'. |
2350 |
++ * |
2351 |
++ * It's not 100% clear what we should really do in this case. |
2352 |
++ * The filesystem is clearly corrupted, but returning a hard |
2353 |
++ * error means that you now don't see any of the other names |
2354 |
++ * either, so that isn't a perfect alternative. |
2355 |
++ * |
2356 |
++ * And if you return an error, what error do you use? Several |
2357 |
++ * filesystems seem to have decided on EUCLEAN being the error |
2358 |
++ * code for EFSCORRUPTED, and that may be the error to use. Or |
2359 |
++ * just EIO, which is perhaps more obvious to users. |
2360 |
++ * |
2361 |
++ * In order to see the other file names in the directory, the |
2362 |
++ * caller might want to make this a "soft" error: skip the |
2363 |
++ * entry, and return the error at the end instead. |
2364 |
++ * |
2365 |
++ * Note that this should likely do a "memchr(name, 0, len)" |
2366 |
++ * check too, since that would be filesystem corruption as |
2367 |
++ * well. However, that case can't actually confuse user space, |
2368 |
++ * which has to do a strlen() on the name anyway to find the |
2369 |
++ * filename length, and the above "soft error" worry means |
2370 |
++ * that it's probably better left alone until we have that |
2371 |
++ * issue clarified. |
2372 |
++ */ |
2373 |
++static int verify_dirent_name(const char *name, int len) |
2374 |
++{ |
2375 |
++ if (!len) |
2376 |
++ return -EIO; |
2377 |
++ if (memchr(name, '/', len)) |
2378 |
++ return -EIO; |
2379 |
++ return 0; |
2380 |
++} |
2381 |
++ |
2382 |
+ /* |
2383 |
+ * Traditional linux readdir() handling.. |
2384 |
+ * |
2385 |
+@@ -159,6 +193,9 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, |
2386 |
+ int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, |
2387 |
+ sizeof(long)); |
2388 |
+ |
2389 |
++ buf->error = verify_dirent_name(name, namlen); |
2390 |
++ if (unlikely(buf->error)) |
2391 |
++ return buf->error; |
2392 |
+ buf->error = -EINVAL; /* only used if we fail.. */ |
2393 |
+ if (reclen > buf->count) |
2394 |
+ return -EINVAL; |
2395 |
+@@ -243,6 +280,9 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen, |
2396 |
+ int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, |
2397 |
+ sizeof(u64)); |
2398 |
+ |
2399 |
++ buf->error = verify_dirent_name(name, namlen); |
2400 |
++ if (unlikely(buf->error)) |
2401 |
++ return buf->error; |
2402 |
+ buf->error = -EINVAL; /* only used if we fail.. */ |
2403 |
+ if (reclen > buf->count) |
2404 |
+ return -EINVAL; |
2405 |
+diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h |
2406 |
+index f356f9716474..674472ac067a 100644 |
2407 |
+--- a/include/drm/drm_dp_mst_helper.h |
2408 |
++++ b/include/drm/drm_dp_mst_helper.h |
2409 |
+@@ -303,7 +303,7 @@ struct drm_dp_resource_status_notify { |
2410 |
+ |
2411 |
+ struct drm_dp_query_payload_ack_reply { |
2412 |
+ u8 port_number; |
2413 |
+- u8 allocated_pbn; |
2414 |
++ u16 allocated_pbn; |
2415 |
+ }; |
2416 |
+ |
2417 |
+ struct drm_dp_sideband_msg_req_body { |
2418 |
+diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h |
2419 |
+index 2ead22dd74a0..07fd2f4f9a06 100644 |
2420 |
+--- a/include/linux/hrtimer.h |
2421 |
++++ b/include/linux/hrtimer.h |
2422 |
+@@ -424,12 +424,18 @@ extern u64 hrtimer_get_next_event(void); |
2423 |
+ |
2424 |
+ extern bool hrtimer_active(const struct hrtimer *timer); |
2425 |
+ |
2426 |
+-/* |
2427 |
+- * Helper function to check, whether the timer is on one of the queues |
2428 |
++/** |
2429 |
++ * hrtimer_is_queued = check, whether the timer is on one of the queues |
2430 |
++ * @timer: Timer to check |
2431 |
++ * |
2432 |
++ * Returns: True if the timer is queued, false otherwise |
2433 |
++ * |
2434 |
++ * The function can be used lockless, but it gives only a current snapshot. |
2435 |
+ */ |
2436 |
+-static inline int hrtimer_is_queued(struct hrtimer *timer) |
2437 |
++static inline bool hrtimer_is_queued(struct hrtimer *timer) |
2438 |
+ { |
2439 |
+- return timer->state & HRTIMER_STATE_ENQUEUED; |
2440 |
++ /* The READ_ONCE pairs with the update functions of timer->state */ |
2441 |
++ return !!(READ_ONCE(timer->state) & HRTIMER_STATE_ENQUEUED); |
2442 |
+ } |
2443 |
+ |
2444 |
+ /* |
2445 |
+diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h |
2446 |
+index 8850e243c940..bd0a55821177 100644 |
2447 |
+--- a/include/linux/libfdt_env.h |
2448 |
++++ b/include/linux/libfdt_env.h |
2449 |
+@@ -6,6 +6,9 @@ |
2450 |
+ |
2451 |
+ #include <asm/byteorder.h> |
2452 |
+ |
2453 |
++#define INT32_MAX S32_MAX |
2454 |
++#define UINT32_MAX U32_MAX |
2455 |
++ |
2456 |
+ typedef __be16 fdt16_t; |
2457 |
+ typedef __be32 fdt32_t; |
2458 |
+ typedef __be64 fdt64_t; |
2459 |
+diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h |
2460 |
+index 64f36e09a790..3f3f801ca488 100644 |
2461 |
+--- a/include/linux/mod_devicetable.h |
2462 |
++++ b/include/linux/mod_devicetable.h |
2463 |
+@@ -502,9 +502,9 @@ struct platform_device_id { |
2464 |
+ |
2465 |
+ #define MDIO_MODULE_PREFIX "mdio:" |
2466 |
+ |
2467 |
+-#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" |
2468 |
++#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" |
2469 |
+ #define MDIO_ID_ARGS(_id) \ |
2470 |
+- (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ |
2471 |
++ ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ |
2472 |
+ ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ |
2473 |
+ ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ |
2474 |
+ ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \ |
2475 |
+diff --git a/include/linux/quota.h b/include/linux/quota.h |
2476 |
+index b2505acfd3c0..b34412df1542 100644 |
2477 |
+--- a/include/linux/quota.h |
2478 |
++++ b/include/linux/quota.h |
2479 |
+@@ -253,7 +253,7 @@ enum { |
2480 |
+ }; |
2481 |
+ |
2482 |
+ struct dqstats { |
2483 |
+- int stat[_DQST_DQSTAT_LAST]; |
2484 |
++ unsigned long stat[_DQST_DQSTAT_LAST]; |
2485 |
+ struct percpu_counter counter[_DQST_DQSTAT_LAST]; |
2486 |
+ }; |
2487 |
+ |
2488 |
+diff --git a/include/net/dst.h b/include/net/dst.h |
2489 |
+index e4f450617919..2e6e3a14a21a 100644 |
2490 |
+--- a/include/net/dst.h |
2491 |
++++ b/include/net/dst.h |
2492 |
+@@ -113,7 +113,7 @@ struct dst_entry { |
2493 |
+ struct dst_metrics { |
2494 |
+ u32 metrics[RTAX_MAX]; |
2495 |
+ atomic_t refcnt; |
2496 |
+-}; |
2497 |
++} __aligned(4); /* Low pointer bits contain DST_METRICS_FLAGS */ |
2498 |
+ extern const struct dst_metrics dst_default_metrics; |
2499 |
+ |
2500 |
+ u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); |
2501 |
+diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h |
2502 |
+index c1260d80ef30..1a2ae0862e23 100644 |
2503 |
+--- a/include/scsi/iscsi_proto.h |
2504 |
++++ b/include/scsi/iscsi_proto.h |
2505 |
+@@ -638,6 +638,7 @@ struct iscsi_reject { |
2506 |
+ #define ISCSI_REASON_BOOKMARK_INVALID 9 |
2507 |
+ #define ISCSI_REASON_BOOKMARK_NO_RESOURCES 10 |
2508 |
+ #define ISCSI_REASON_NEGOTIATION_RESET 11 |
2509 |
++#define ISCSI_REASON_WAITING_FOR_LOGOUT 12 |
2510 |
+ |
2511 |
+ /* Max. number of Key=Value pairs in a text message */ |
2512 |
+ #define MAX_KEY_VALUE_PAIRS 8192 |
2513 |
+diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
2514 |
+index 24c7fe8608d0..c2dddd335d06 100644 |
2515 |
+--- a/kernel/sysctl.c |
2516 |
++++ b/kernel/sysctl.c |
2517 |
+@@ -1357,7 +1357,7 @@ static struct ctl_table vm_table[] = { |
2518 |
+ .procname = "drop_caches", |
2519 |
+ .data = &sysctl_drop_caches, |
2520 |
+ .maxlen = sizeof(int), |
2521 |
+- .mode = 0644, |
2522 |
++ .mode = 0200, |
2523 |
+ .proc_handler = drop_caches_sysctl_handler, |
2524 |
+ .extra1 = &one, |
2525 |
+ .extra2 = &four, |
2526 |
+diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c |
2527 |
+index 8c4e27cbfe7f..1f7ad2666108 100644 |
2528 |
+--- a/kernel/time/hrtimer.c |
2529 |
++++ b/kernel/time/hrtimer.c |
2530 |
+@@ -887,7 +887,8 @@ static int enqueue_hrtimer(struct hrtimer *timer, |
2531 |
+ |
2532 |
+ base->cpu_base->active_bases |= 1 << base->index; |
2533 |
+ |
2534 |
+- timer->state = HRTIMER_STATE_ENQUEUED; |
2535 |
++ /* Pairs with the lockless read in hrtimer_is_queued() */ |
2536 |
++ WRITE_ONCE(timer->state, HRTIMER_STATE_ENQUEUED); |
2537 |
+ |
2538 |
+ return timerqueue_add(&base->active, &timer->node); |
2539 |
+ } |
2540 |
+@@ -909,7 +910,8 @@ static void __remove_hrtimer(struct hrtimer *timer, |
2541 |
+ struct hrtimer_cpu_base *cpu_base = base->cpu_base; |
2542 |
+ u8 state = timer->state; |
2543 |
+ |
2544 |
+- timer->state = newstate; |
2545 |
++ /* Pairs with the lockless read in hrtimer_is_queued() */ |
2546 |
++ WRITE_ONCE(timer->state, newstate); |
2547 |
+ if (!(state & HRTIMER_STATE_ENQUEUED)) |
2548 |
+ return; |
2549 |
+ |
2550 |
+@@ -936,8 +938,9 @@ static void __remove_hrtimer(struct hrtimer *timer, |
2551 |
+ static inline int |
2552 |
+ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart) |
2553 |
+ { |
2554 |
+- if (hrtimer_is_queued(timer)) { |
2555 |
+- u8 state = timer->state; |
2556 |
++ u8 state = timer->state; |
2557 |
++ |
2558 |
++ if (state & HRTIMER_STATE_ENQUEUED) { |
2559 |
+ int reprogram; |
2560 |
+ |
2561 |
+ /* |
2562 |
+diff --git a/lib/dma-debug.c b/lib/dma-debug.c |
2563 |
+index 51a76af25c66..173013f5e41b 100644 |
2564 |
+--- a/lib/dma-debug.c |
2565 |
++++ b/lib/dma-debug.c |
2566 |
+@@ -427,6 +427,7 @@ void debug_dma_dump_mappings(struct device *dev) |
2567 |
+ } |
2568 |
+ |
2569 |
+ spin_unlock_irqrestore(&bucket->lock, flags); |
2570 |
++ cond_resched(); |
2571 |
+ } |
2572 |
+ } |
2573 |
+ EXPORT_SYMBOL(debug_dma_dump_mappings); |
2574 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
2575 |
+index 5d0b1358c754..4bce3ef2c392 100644 |
2576 |
+--- a/net/bluetooth/hci_core.c |
2577 |
++++ b/net/bluetooth/hci_core.c |
2578 |
+@@ -4459,7 +4459,14 @@ static void hci_rx_work(struct work_struct *work) |
2579 |
+ hci_send_to_sock(hdev, skb); |
2580 |
+ } |
2581 |
+ |
2582 |
+- if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { |
2583 |
++ /* If the device has been opened in HCI_USER_CHANNEL, |
2584 |
++ * the userspace has exclusive access to device. |
2585 |
++ * When device is HCI_INIT, we still need to process |
2586 |
++ * the data packets to the driver in order |
2587 |
++ * to complete its setup(). |
2588 |
++ */ |
2589 |
++ if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && |
2590 |
++ !test_bit(HCI_INIT, &hdev->flags)) { |
2591 |
+ kfree_skb(skb); |
2592 |
+ continue; |
2593 |
+ } |
2594 |
+diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
2595 |
+index 2ae0451fd634..6c84c9b8d60b 100644 |
2596 |
+--- a/net/bridge/br_netfilter_hooks.c |
2597 |
++++ b/net/bridge/br_netfilter_hooks.c |
2598 |
+@@ -638,6 +638,9 @@ static unsigned int br_nf_forward_arp(void *priv, |
2599 |
+ nf_bridge_pull_encap_header(skb); |
2600 |
+ } |
2601 |
+ |
2602 |
++ if (unlikely(!pskb_may_pull(skb, sizeof(struct arphdr)))) |
2603 |
++ return NF_DROP; |
2604 |
++ |
2605 |
+ if (arp_hdr(skb)->ar_pln != 4) { |
2606 |
+ if (IS_VLAN_ARP(skb)) |
2607 |
+ nf_bridge_push_encap_header(skb); |
2608 |
+diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c |
2609 |
+index d9471e3ef216..fd1af7cb960d 100644 |
2610 |
+--- a/net/bridge/netfilter/ebtables.c |
2611 |
++++ b/net/bridge/netfilter/ebtables.c |
2612 |
+@@ -1883,7 +1883,7 @@ static int ebt_buf_count(struct ebt_entries_buf_state *state, unsigned int sz) |
2613 |
+ } |
2614 |
+ |
2615 |
+ static int ebt_buf_add(struct ebt_entries_buf_state *state, |
2616 |
+- void *data, unsigned int sz) |
2617 |
++ const void *data, unsigned int sz) |
2618 |
+ { |
2619 |
+ if (state->buf_kern_start == NULL) |
2620 |
+ goto count_only; |
2621 |
+@@ -1917,7 +1917,7 @@ enum compat_mwt { |
2622 |
+ EBT_COMPAT_TARGET, |
2623 |
+ }; |
2624 |
+ |
2625 |
+-static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, |
2626 |
++static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt, |
2627 |
+ enum compat_mwt compat_mwt, |
2628 |
+ struct ebt_entries_buf_state *state, |
2629 |
+ const unsigned char *base) |
2630 |
+@@ -1994,22 +1994,23 @@ static int compat_mtw_from_user(struct compat_ebt_entry_mwt *mwt, |
2631 |
+ * return size of all matches, watchers or target, including necessary |
2632 |
+ * alignment and padding. |
2633 |
+ */ |
2634 |
+-static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, |
2635 |
++static int ebt_size_mwt(const struct compat_ebt_entry_mwt *match32, |
2636 |
+ unsigned int size_left, enum compat_mwt type, |
2637 |
+ struct ebt_entries_buf_state *state, const void *base) |
2638 |
+ { |
2639 |
++ const char *buf = (const char *)match32; |
2640 |
+ int growth = 0; |
2641 |
+- char *buf; |
2642 |
+ |
2643 |
+ if (size_left == 0) |
2644 |
+ return 0; |
2645 |
+ |
2646 |
+- buf = (char *) match32; |
2647 |
+- |
2648 |
+- while (size_left >= sizeof(*match32)) { |
2649 |
++ do { |
2650 |
+ struct ebt_entry_match *match_kern; |
2651 |
+ int ret; |
2652 |
+ |
2653 |
++ if (size_left < sizeof(*match32)) |
2654 |
++ return -EINVAL; |
2655 |
++ |
2656 |
+ match_kern = (struct ebt_entry_match *) state->buf_kern_start; |
2657 |
+ if (match_kern) { |
2658 |
+ char *tmp; |
2659 |
+@@ -2046,22 +2047,18 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, |
2660 |
+ if (match_kern) |
2661 |
+ match_kern->match_size = ret; |
2662 |
+ |
2663 |
+- /* rule should have no remaining data after target */ |
2664 |
+- if (type == EBT_COMPAT_TARGET && size_left) |
2665 |
+- return -EINVAL; |
2666 |
+- |
2667 |
+ match32 = (struct compat_ebt_entry_mwt *) buf; |
2668 |
+- } |
2669 |
++ } while (size_left); |
2670 |
+ |
2671 |
+ return growth; |
2672 |
+ } |
2673 |
+ |
2674 |
+ /* called for all ebt_entry structures. */ |
2675 |
+-static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, |
2676 |
++static int size_entry_mwt(const struct ebt_entry *entry, const unsigned char *base, |
2677 |
+ unsigned int *total, |
2678 |
+ struct ebt_entries_buf_state *state) |
2679 |
+ { |
2680 |
+- unsigned int i, j, startoff, new_offset = 0; |
2681 |
++ unsigned int i, j, startoff, next_expected_off, new_offset = 0; |
2682 |
+ /* stores match/watchers/targets & offset of next struct ebt_entry: */ |
2683 |
+ unsigned int offsets[4]; |
2684 |
+ unsigned int *offsets_update = NULL; |
2685 |
+@@ -2149,11 +2146,13 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, |
2686 |
+ return ret; |
2687 |
+ } |
2688 |
+ |
2689 |
+- startoff = state->buf_user_offset - startoff; |
2690 |
++ next_expected_off = state->buf_user_offset - startoff; |
2691 |
++ if (next_expected_off != entry->next_offset) |
2692 |
++ return -EINVAL; |
2693 |
+ |
2694 |
+- if (WARN_ON(*total < startoff)) |
2695 |
++ if (*total < entry->next_offset) |
2696 |
+ return -EINVAL; |
2697 |
+- *total -= startoff; |
2698 |
++ *total -= entry->next_offset; |
2699 |
+ return 0; |
2700 |
+ } |
2701 |
+ |
2702 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
2703 |
+index d0ec8a997210..031945bead36 100644 |
2704 |
+--- a/net/ipv4/icmp.c |
2705 |
++++ b/net/ipv4/icmp.c |
2706 |
+@@ -256,10 +256,11 @@ bool icmp_global_allow(void) |
2707 |
+ bool rc = false; |
2708 |
+ |
2709 |
+ /* Check if token bucket is empty and cannot be refilled |
2710 |
+- * without taking the spinlock. |
2711 |
++ * without taking the spinlock. The READ_ONCE() are paired |
2712 |
++ * with the following WRITE_ONCE() in this same function. |
2713 |
+ */ |
2714 |
+- if (!icmp_global.credit) { |
2715 |
+- delta = min_t(u32, now - icmp_global.stamp, HZ); |
2716 |
++ if (!READ_ONCE(icmp_global.credit)) { |
2717 |
++ delta = min_t(u32, now - READ_ONCE(icmp_global.stamp), HZ); |
2718 |
+ if (delta < HZ / 50) |
2719 |
+ return false; |
2720 |
+ } |
2721 |
+@@ -269,14 +270,14 @@ bool icmp_global_allow(void) |
2722 |
+ if (delta >= HZ / 50) { |
2723 |
+ incr = sysctl_icmp_msgs_per_sec * delta / HZ ; |
2724 |
+ if (incr) |
2725 |
+- icmp_global.stamp = now; |
2726 |
++ WRITE_ONCE(icmp_global.stamp, now); |
2727 |
+ } |
2728 |
+ credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); |
2729 |
+ if (credit) { |
2730 |
+ credit--; |
2731 |
+ rc = true; |
2732 |
+ } |
2733 |
+- icmp_global.credit = credit; |
2734 |
++ WRITE_ONCE(icmp_global.credit, credit); |
2735 |
+ spin_unlock(&icmp_global.lock); |
2736 |
+ return rc; |
2737 |
+ } |
2738 |
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
2739 |
+index 913c7fb51b18..6c8966dcf612 100644 |
2740 |
+--- a/net/ipv4/tcp_output.c |
2741 |
++++ b/net/ipv4/tcp_output.c |
2742 |
+@@ -2148,6 +2148,14 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, |
2743 |
+ break; |
2744 |
+ } |
2745 |
+ |
2746 |
++ /* Argh, we hit an empty skb(), presumably a thread |
2747 |
++ * is sleeping in sendmsg()/sk_stream_wait_memory(). |
2748 |
++ * We do not want to send a pure-ack packet and have |
2749 |
++ * a strange looking rtx queue with empty packet(s). |
2750 |
++ */ |
2751 |
++ if (TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq) |
2752 |
++ break; |
2753 |
++ |
2754 |
+ if (unlikely(tcp_transmit_skb(sk, skb, 1, gfp))) |
2755 |
+ break; |
2756 |
+ |
2757 |
+diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c |
2758 |
+index 21d8875673a4..c3f2faa0210e 100644 |
2759 |
+--- a/net/nfc/nci/uart.c |
2760 |
++++ b/net/nfc/nci/uart.c |
2761 |
+@@ -355,7 +355,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data, |
2762 |
+ nu->rx_packet_len = -1; |
2763 |
+ nu->rx_skb = nci_skb_alloc(nu->ndev, |
2764 |
+ NCI_MAX_PACKET_SIZE, |
2765 |
+- GFP_KERNEL); |
2766 |
++ GFP_ATOMIC); |
2767 |
+ if (!nu->rx_skb) |
2768 |
+ return -ENOMEM; |
2769 |
+ } |
2770 |
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c |
2771 |
+index 0dd9fc3f57e8..8b277658905f 100644 |
2772 |
+--- a/net/packet/af_packet.c |
2773 |
++++ b/net/packet/af_packet.c |
2774 |
+@@ -587,7 +587,8 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po, |
2775 |
+ msec = 1; |
2776 |
+ div = speed / 1000; |
2777 |
+ } |
2778 |
+- } |
2779 |
++ } else |
2780 |
++ return DEFAULT_PRB_RETIRE_TOV; |
2781 |
+ |
2782 |
+ mbits = (blk_size_in_bytes * 8) / (1024 * 1024); |
2783 |
+ |
2784 |
+diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c |
2785 |
+index 8816e49fd88b..7e550265df87 100644 |
2786 |
+--- a/net/sctp/protocol.c |
2787 |
++++ b/net/sctp/protocol.c |
2788 |
+@@ -255,6 +255,7 @@ static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk) |
2789 |
+ addr->v4.sin_family = AF_INET; |
2790 |
+ addr->v4.sin_port = 0; |
2791 |
+ addr->v4.sin_addr.s_addr = inet_sk(sk)->inet_rcv_saddr; |
2792 |
++ memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
2793 |
+ } |
2794 |
+ |
2795 |
+ /* Initialize sk->sk_rcv_saddr from sctp_addr. */ |
2796 |
+@@ -277,6 +278,7 @@ static void sctp_v4_from_addr_param(union sctp_addr *addr, |
2797 |
+ addr->v4.sin_family = AF_INET; |
2798 |
+ addr->v4.sin_port = port; |
2799 |
+ addr->v4.sin_addr.s_addr = param->v4.addr.s_addr; |
2800 |
++ memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
2801 |
+ } |
2802 |
+ |
2803 |
+ /* Initialize an address parameter from a sctp_addr and return the length |
2804 |
+@@ -301,6 +303,7 @@ static void sctp_v4_dst_saddr(union sctp_addr *saddr, struct flowi4 *fl4, |
2805 |
+ saddr->v4.sin_family = AF_INET; |
2806 |
+ saddr->v4.sin_port = port; |
2807 |
+ saddr->v4.sin_addr.s_addr = fl4->saddr; |
2808 |
++ memset(saddr->v4.sin_zero, 0, sizeof(saddr->v4.sin_zero)); |
2809 |
+ } |
2810 |
+ |
2811 |
+ /* Compare two addresses exactly. */ |
2812 |
+@@ -323,6 +326,7 @@ static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port) |
2813 |
+ addr->v4.sin_family = AF_INET; |
2814 |
+ addr->v4.sin_addr.s_addr = htonl(INADDR_ANY); |
2815 |
+ addr->v4.sin_port = port; |
2816 |
++ memset(addr->v4.sin_zero, 0, sizeof(addr->v4.sin_zero)); |
2817 |
+ } |
2818 |
+ |
2819 |
+ /* Is this a wildcard address? */ |
2820 |
+diff --git a/samples/pktgen/functions.sh b/samples/pktgen/functions.sh |
2821 |
+index 205e4cde4601..065a7e296ee3 100644 |
2822 |
+--- a/samples/pktgen/functions.sh |
2823 |
++++ b/samples/pktgen/functions.sh |
2824 |
+@@ -5,6 +5,8 @@ |
2825 |
+ # Author: Jesper Dangaaard Brouer |
2826 |
+ # License: GPL |
2827 |
+ |
2828 |
++set -o errexit |
2829 |
++ |
2830 |
+ ## -- General shell logging cmds -- |
2831 |
+ function err() { |
2832 |
+ local exitcode=$1 |
2833 |
+@@ -58,6 +60,7 @@ function pg_set() { |
2834 |
+ function proc_cmd() { |
2835 |
+ local result |
2836 |
+ local proc_file=$1 |
2837 |
++ local status=0 |
2838 |
+ # after shift, the remaining args are contained in $@ |
2839 |
+ shift |
2840 |
+ local proc_ctrl=${PROC_DIR}/$proc_file |
2841 |
+@@ -73,13 +76,13 @@ function proc_cmd() { |
2842 |
+ echo "cmd: $@ > $proc_ctrl" |
2843 |
+ fi |
2844 |
+ # Quoting of "$@" is important for space expansion |
2845 |
+- echo "$@" > "$proc_ctrl" |
2846 |
+- local status=$? |
2847 |
++ echo "$@" > "$proc_ctrl" || status=$? |
2848 |
+ |
2849 |
+- result=$(grep "Result: OK:" $proc_ctrl) |
2850 |
+- # Due to pgctrl, cannot use exit code $? from grep |
2851 |
+- if [[ "$result" == "" ]]; then |
2852 |
+- grep "Result:" $proc_ctrl >&2 |
2853 |
++ if [[ "$proc_file" != "pgctrl" ]]; then |
2854 |
++ result=$(grep "Result: OK:" $proc_ctrl) || true |
2855 |
++ if [[ "$result" == "" ]]; then |
2856 |
++ grep "Result:" $proc_ctrl >&2 |
2857 |
++ fi |
2858 |
+ fi |
2859 |
+ if (( $status != 0 )); then |
2860 |
+ err 5 "Write error($status) occurred cmd: \"$@ > $proc_ctrl\"" |
2861 |
+@@ -105,6 +108,8 @@ function pgset() { |
2862 |
+ fi |
2863 |
+ } |
2864 |
+ |
2865 |
++[[ $EUID -eq 0 ]] && trap 'pg_ctrl "reset"' EXIT |
2866 |
++ |
2867 |
+ ## -- General shell tricks -- |
2868 |
+ |
2869 |
+ function root_check_run_with_sudo() { |
2870 |
+diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c |
2871 |
+index d117c68d1607..b92b704e7ace 100644 |
2872 |
+--- a/scripts/kallsyms.c |
2873 |
++++ b/scripts/kallsyms.c |
2874 |
+@@ -455,6 +455,8 @@ static void build_initial_tok_table(void) |
2875 |
+ table[pos] = table[i]; |
2876 |
+ learn_symbol(table[pos].sym, table[pos].len); |
2877 |
+ pos++; |
2878 |
++ } else { |
2879 |
++ free(table[i].sym); |
2880 |
+ } |
2881 |
+ } |
2882 |
+ table_cnt = pos; |
2883 |
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c |
2884 |
+index 252392abd1b9..b9bfbf394959 100644 |
2885 |
+--- a/sound/core/pcm_native.c |
2886 |
++++ b/sound/core/pcm_native.c |
2887 |
+@@ -587,6 +587,10 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
2888 |
+ while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) |
2889 |
+ runtime->boundary *= 2; |
2890 |
+ |
2891 |
++ /* clear the buffer for avoiding possible kernel info leaks */ |
2892 |
++ if (runtime->dma_area) |
2893 |
++ memset(runtime->dma_area, 0, runtime->dma_bytes); |
2894 |
++ |
2895 |
+ snd_pcm_timer_resolution_change(substream); |
2896 |
+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP); |
2897 |
+ |
2898 |
+diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c |
2899 |
+index 9cdf86f04e03..a25e34b2f82a 100644 |
2900 |
+--- a/sound/pci/hda/hda_controller.c |
2901 |
++++ b/sound/pci/hda/hda_controller.c |
2902 |
+@@ -673,7 +673,7 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, |
2903 |
+ return -EAGAIN; /* give a chance to retry */ |
2904 |
+ } |
2905 |
+ |
2906 |
+- dev_WARN(chip->card->dev, |
2907 |
++ dev_err(chip->card->dev, |
2908 |
+ "azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n", |
2909 |
+ bus->last_cmd[addr]); |
2910 |
+ chip->single_cmd = 1; |
2911 |
+diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c |
2912 |
+index c0742ee11519..c05119a3e13b 100644 |
2913 |
+--- a/sound/pci/hda/patch_ca0132.c |
2914 |
++++ b/sound/pci/hda/patch_ca0132.c |
2915 |
+@@ -1300,13 +1300,14 @@ struct scp_msg { |
2916 |
+ |
2917 |
+ static void dspio_clear_response_queue(struct hda_codec *codec) |
2918 |
+ { |
2919 |
++ unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
2920 |
+ unsigned int dummy = 0; |
2921 |
+- int status = -1; |
2922 |
++ int status; |
2923 |
+ |
2924 |
+ /* clear all from the response queue */ |
2925 |
+ do { |
2926 |
+ status = dspio_read(codec, &dummy); |
2927 |
+- } while (status == 0); |
2928 |
++ } while (status == 0 && time_before(jiffies, timeout)); |
2929 |
+ } |
2930 |
+ |
2931 |
+ static int dspio_get_response_data(struct hda_codec *codec) |
2932 |
+@@ -4424,12 +4425,14 @@ static void ca0132_process_dsp_response(struct hda_codec *codec, |
2933 |
+ struct ca0132_spec *spec = codec->spec; |
2934 |
+ |
2935 |
+ codec_dbg(codec, "ca0132_process_dsp_response\n"); |
2936 |
++ snd_hda_power_up_pm(codec); |
2937 |
+ if (spec->wait_scp) { |
2938 |
+ if (dspio_get_response_data(codec) >= 0) |
2939 |
+ spec->wait_scp = 0; |
2940 |
+ } |
2941 |
+ |
2942 |
+ dspio_clear_response_queue(codec); |
2943 |
++ snd_hda_power_down_pm(codec); |
2944 |
+ } |
2945 |
+ |
2946 |
+ static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
2947 |
+diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c |
2948 |
+index 69d987a9935c..90f8173123f6 100644 |
2949 |
+--- a/sound/soc/codecs/rt5677.c |
2950 |
++++ b/sound/soc/codecs/rt5677.c |
2951 |
+@@ -295,6 +295,7 @@ static bool rt5677_volatile_register(struct device *dev, unsigned int reg) |
2952 |
+ case RT5677_I2C_MASTER_CTRL7: |
2953 |
+ case RT5677_I2C_MASTER_CTRL8: |
2954 |
+ case RT5677_HAP_GENE_CTRL2: |
2955 |
++ case RT5677_PWR_ANLG2: /* Modified by DSP firmware */ |
2956 |
+ case RT5677_PWR_DSP_ST: |
2957 |
+ case RT5677_PRIV_DATA: |
2958 |
+ case RT5677_PLL1_CTRL2: |
2959 |
+diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c |
2960 |
+index 64309d73921b..c2b72e6d002d 100644 |
2961 |
+--- a/tools/lib/traceevent/parse-filter.c |
2962 |
++++ b/tools/lib/traceevent/parse-filter.c |
2963 |
+@@ -1484,8 +1484,10 @@ static int copy_filter_type(struct event_filter *filter, |
2964 |
+ if (strcmp(str, "TRUE") == 0 || strcmp(str, "FALSE") == 0) { |
2965 |
+ /* Add trivial event */ |
2966 |
+ arg = allocate_arg(); |
2967 |
+- if (arg == NULL) |
2968 |
++ if (arg == NULL) { |
2969 |
++ free(str); |
2970 |
+ return -1; |
2971 |
++ } |
2972 |
+ |
2973 |
+ arg->type = FILTER_ARG_BOOLEAN; |
2974 |
+ if (strcmp(str, "TRUE") == 0) |
2975 |
+@@ -1494,8 +1496,11 @@ static int copy_filter_type(struct event_filter *filter, |
2976 |
+ arg->boolean.value = 0; |
2977 |
+ |
2978 |
+ filter_type = add_filter_type(filter, event->id); |
2979 |
+- if (filter_type == NULL) |
2980 |
++ if (filter_type == NULL) { |
2981 |
++ free(str); |
2982 |
++ free_arg(arg); |
2983 |
+ return -1; |
2984 |
++ } |
2985 |
+ |
2986 |
+ filter_type->filter = arg; |
2987 |
+ |
2988 |
+diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c |
2989 |
+index f256fac1e722..0f7ebac1846b 100644 |
2990 |
+--- a/tools/perf/builtin-report.c |
2991 |
++++ b/tools/perf/builtin-report.c |
2992 |
+@@ -285,6 +285,13 @@ static int report__setup_sample_type(struct report *rep) |
2993 |
+ PERF_SAMPLE_BRANCH_ANY)) |
2994 |
+ rep->nonany_branch_mode = true; |
2995 |
+ |
2996 |
++#ifndef HAVE_LIBUNWIND_SUPPORT |
2997 |
++ if (dwarf_callchain_users) { |
2998 |
++ ui__warning("Please install libunwind development packages " |
2999 |
++ "during the perf build.\n"); |
3000 |
++ } |
3001 |
++#endif |
3002 |
++ |
3003 |
+ return 0; |
3004 |
+ } |
3005 |
+ |
3006 |
+diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c |
3007 |
+index a509aa8433a1..fd460aca36e5 100644 |
3008 |
+--- a/tools/perf/util/dwarf-aux.c |
3009 |
++++ b/tools/perf/util/dwarf-aux.c |
3010 |
+@@ -293,21 +293,51 @@ bool die_is_func_def(Dwarf_Die *dw_die) |
3011 |
+ dwarf_attr(dw_die, DW_AT_declaration, &attr) == NULL); |
3012 |
+ } |
3013 |
+ |
3014 |
++/** |
3015 |
++ * die_entrypc - Returns entry PC (the lowest address) of a DIE |
3016 |
++ * @dw_die: a DIE |
3017 |
++ * @addr: where to store entry PC |
3018 |
++ * |
3019 |
++ * Since dwarf_entrypc() does not return entry PC if the DIE has only address |
3020 |
++ * range, we have to use this to retrieve the lowest address from the address |
3021 |
++ * range attribute. |
3022 |
++ */ |
3023 |
++int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) |
3024 |
++{ |
3025 |
++ Dwarf_Addr base, end; |
3026 |
++ |
3027 |
++ if (!addr) |
3028 |
++ return -EINVAL; |
3029 |
++ |
3030 |
++ if (dwarf_entrypc(dw_die, addr) == 0) |
3031 |
++ return 0; |
3032 |
++ |
3033 |
++ return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; |
3034 |
++} |
3035 |
++ |
3036 |
+ /** |
3037 |
+ * die_is_func_instance - Ensure that this DIE is an instance of a subprogram |
3038 |
+ * @dw_die: a DIE |
3039 |
+ * |
3040 |
+ * Ensure that this DIE is an instance (which has an entry address). |
3041 |
+- * This returns true if @dw_die is a function instance. If not, you need to |
3042 |
+- * call die_walk_instances() to find actual instances. |
3043 |
++ * This returns true if @dw_die is a function instance. If not, the @dw_die |
3044 |
++ * must be a prototype. You can use die_walk_instances() to find actual |
3045 |
++ * instances. |
3046 |
+ **/ |
3047 |
+ bool die_is_func_instance(Dwarf_Die *dw_die) |
3048 |
+ { |
3049 |
+ Dwarf_Addr tmp; |
3050 |
++ Dwarf_Attribute attr_mem; |
3051 |
++ int tag = dwarf_tag(dw_die); |
3052 |
+ |
3053 |
+- /* Actually gcc optimizes non-inline as like as inlined */ |
3054 |
+- return !dwarf_func_inline(dw_die) && dwarf_entrypc(dw_die, &tmp) == 0; |
3055 |
++ if (tag != DW_TAG_subprogram && |
3056 |
++ tag != DW_TAG_inlined_subroutine) |
3057 |
++ return false; |
3058 |
++ |
3059 |
++ return dwarf_entrypc(dw_die, &tmp) == 0 || |
3060 |
++ dwarf_attr(dw_die, DW_AT_ranges, &attr_mem) != NULL; |
3061 |
+ } |
3062 |
++ |
3063 |
+ /** |
3064 |
+ * die_get_data_member_location - Get the data-member offset |
3065 |
+ * @mb_die: a DIE of a member of a data structure |
3066 |
+@@ -584,6 +614,9 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data) |
3067 |
+ Dwarf_Die *origin; |
3068 |
+ int tmp; |
3069 |
+ |
3070 |
++ if (!die_is_func_instance(inst)) |
3071 |
++ return DIE_FIND_CB_CONTINUE; |
3072 |
++ |
3073 |
+ attr = dwarf_attr(inst, DW_AT_abstract_origin, &attr_mem); |
3074 |
+ if (attr == NULL) |
3075 |
+ return DIE_FIND_CB_CONTINUE; |
3076 |
+@@ -655,15 +688,14 @@ static int __die_walk_funclines_cb(Dwarf_Die *in_die, void *data) |
3077 |
+ if (dwarf_tag(in_die) == DW_TAG_inlined_subroutine) { |
3078 |
+ fname = die_get_call_file(in_die); |
3079 |
+ lineno = die_get_call_lineno(in_die); |
3080 |
+- if (fname && lineno > 0 && dwarf_entrypc(in_die, &addr) == 0) { |
3081 |
++ if (fname && lineno > 0 && die_entrypc(in_die, &addr) == 0) { |
3082 |
+ lw->retval = lw->callback(fname, lineno, addr, lw->data); |
3083 |
+ if (lw->retval != 0) |
3084 |
+ return DIE_FIND_CB_END; |
3085 |
+ } |
3086 |
++ if (!lw->recursive) |
3087 |
++ return DIE_FIND_CB_SIBLING; |
3088 |
+ } |
3089 |
+- if (!lw->recursive) |
3090 |
+- /* Don't need to search recursively */ |
3091 |
+- return DIE_FIND_CB_SIBLING; |
3092 |
+ |
3093 |
+ if (addr) { |
3094 |
+ fname = dwarf_decl_file(in_die); |
3095 |
+@@ -696,7 +728,7 @@ static int __die_walk_funclines(Dwarf_Die *sp_die, bool recursive, |
3096 |
+ /* Handle function declaration line */ |
3097 |
+ fname = dwarf_decl_file(sp_die); |
3098 |
+ if (fname && dwarf_decl_line(sp_die, &lineno) == 0 && |
3099 |
+- dwarf_entrypc(sp_die, &addr) == 0) { |
3100 |
++ die_entrypc(sp_die, &addr) == 0) { |
3101 |
+ lw.retval = callback(fname, lineno, addr, data); |
3102 |
+ if (lw.retval != 0) |
3103 |
+ goto done; |
3104 |
+@@ -710,6 +742,10 @@ static int __die_walk_culines_cb(Dwarf_Die *sp_die, void *data) |
3105 |
+ { |
3106 |
+ struct __line_walk_param *lw = data; |
3107 |
+ |
3108 |
++ /* |
3109 |
++ * Since inlined function can include another inlined function in |
3110 |
++ * the same file, we need to walk in it recursively. |
3111 |
++ */ |
3112 |
+ lw->retval = __die_walk_funclines(sp_die, true, lw->callback, lw->data); |
3113 |
+ if (lw->retval != 0) |
3114 |
+ return DWARF_CB_ABORT; |
3115 |
+@@ -734,11 +770,12 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
3116 |
+ Dwarf_Lines *lines; |
3117 |
+ Dwarf_Line *line; |
3118 |
+ Dwarf_Addr addr; |
3119 |
+- const char *fname, *decf = NULL; |
3120 |
++ const char *fname, *decf = NULL, *inf = NULL; |
3121 |
+ int lineno, ret = 0; |
3122 |
+ int decl = 0, inl; |
3123 |
+ Dwarf_Die die_mem, *cu_die; |
3124 |
+ size_t nlines, i; |
3125 |
++ bool flag; |
3126 |
+ |
3127 |
+ /* Get the CU die */ |
3128 |
+ if (dwarf_tag(rt_die) != DW_TAG_compile_unit) { |
3129 |
+@@ -769,6 +806,12 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
3130 |
+ "Possible error in debuginfo.\n"); |
3131 |
+ continue; |
3132 |
+ } |
3133 |
++ /* Skip end-of-sequence */ |
3134 |
++ if (dwarf_lineendsequence(line, &flag) != 0 || flag) |
3135 |
++ continue; |
3136 |
++ /* Skip Non statement line-info */ |
3137 |
++ if (dwarf_linebeginstatement(line, &flag) != 0 || !flag) |
3138 |
++ continue; |
3139 |
+ /* Filter lines based on address */ |
3140 |
+ if (rt_die != cu_die) { |
3141 |
+ /* |
3142 |
+@@ -778,13 +821,21 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
3143 |
+ */ |
3144 |
+ if (!dwarf_haspc(rt_die, addr)) |
3145 |
+ continue; |
3146 |
++ |
3147 |
+ if (die_find_inlinefunc(rt_die, addr, &die_mem)) { |
3148 |
++ /* Call-site check */ |
3149 |
++ inf = die_get_call_file(&die_mem); |
3150 |
++ if ((inf && !strcmp(inf, decf)) && |
3151 |
++ die_get_call_lineno(&die_mem) == lineno) |
3152 |
++ goto found; |
3153 |
++ |
3154 |
+ dwarf_decl_line(&die_mem, &inl); |
3155 |
+ if (inl != decl || |
3156 |
+ decf != dwarf_decl_file(&die_mem)) |
3157 |
+ continue; |
3158 |
+ } |
3159 |
+ } |
3160 |
++found: |
3161 |
+ /* Get source line */ |
3162 |
+ fname = dwarf_linesrc(line, NULL, NULL); |
3163 |
+ |
3164 |
+@@ -799,8 +850,9 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
3165 |
+ */ |
3166 |
+ if (rt_die != cu_die) |
3167 |
+ /* |
3168 |
+- * Don't need walk functions recursively, because nested |
3169 |
+- * inlined functions don't have lines of the specified DIE. |
3170 |
++ * Don't need walk inlined functions recursively, because |
3171 |
++ * inner inlined functions don't have the lines of the |
3172 |
++ * specified function. |
3173 |
+ */ |
3174 |
+ ret = __die_walk_funclines(rt_die, false, callback, data); |
3175 |
+ else { |
3176 |
+@@ -981,7 +1033,7 @@ static int die_get_var_innermost_scope(Dwarf_Die *sp_die, Dwarf_Die *vr_die, |
3177 |
+ bool first = true; |
3178 |
+ const char *name; |
3179 |
+ |
3180 |
+- ret = dwarf_entrypc(sp_die, &entry); |
3181 |
++ ret = die_entrypc(sp_die, &entry); |
3182 |
+ if (ret) |
3183 |
+ return ret; |
3184 |
+ |
3185 |
+@@ -1042,7 +1094,7 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf) |
3186 |
+ bool first = true; |
3187 |
+ const char *name; |
3188 |
+ |
3189 |
+- ret = dwarf_entrypc(sp_die, &entry); |
3190 |
++ ret = die_entrypc(sp_die, &entry); |
3191 |
+ if (ret) |
3192 |
+ return ret; |
3193 |
+ |
3194 |
+diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h |
3195 |
+index c42ec366f2a7..598629333eec 100644 |
3196 |
+--- a/tools/perf/util/dwarf-aux.h |
3197 |
++++ b/tools/perf/util/dwarf-aux.h |
3198 |
+@@ -38,6 +38,9 @@ extern int cu_find_lineinfo(Dwarf_Die *cudie, unsigned long addr, |
3199 |
+ extern int cu_walk_functions_at(Dwarf_Die *cu_die, Dwarf_Addr addr, |
3200 |
+ int (*callback)(Dwarf_Die *, void *), void *data); |
3201 |
+ |
3202 |
++/* Get the lowest PC in DIE (including range list) */ |
3203 |
++int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr); |
3204 |
++ |
3205 |
+ /* Ensure that this DIE is a subprogram and definition (not declaration) */ |
3206 |
+ extern bool die_is_func_def(Dwarf_Die *dw_die); |
3207 |
+ |
3208 |
+diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h |
3209 |
+index 679d6e493962..e6324397b295 100644 |
3210 |
+--- a/tools/perf/util/perf_regs.h |
3211 |
++++ b/tools/perf/util/perf_regs.h |
3212 |
+@@ -26,7 +26,7 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); |
3213 |
+ |
3214 |
+ static inline const char *perf_reg_name(int id __maybe_unused) |
3215 |
+ { |
3216 |
+- return NULL; |
3217 |
++ return "unknown"; |
3218 |
+ } |
3219 |
+ |
3220 |
+ static inline int perf_reg_value(u64 *valp __maybe_unused, |
3221 |
+diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c |
3222 |
+index fdd87c7e3e91..5ca8836b16e7 100644 |
3223 |
+--- a/tools/perf/util/probe-finder.c |
3224 |
++++ b/tools/perf/util/probe-finder.c |
3225 |
+@@ -746,6 +746,16 @@ static int find_best_scope_cb(Dwarf_Die *fn_die, void *data) |
3226 |
+ return 0; |
3227 |
+ } |
3228 |
+ |
3229 |
++/* Return innermost DIE */ |
3230 |
++static int find_inner_scope_cb(Dwarf_Die *fn_die, void *data) |
3231 |
++{ |
3232 |
++ struct find_scope_param *fsp = data; |
3233 |
++ |
3234 |
++ memcpy(fsp->die_mem, fn_die, sizeof(Dwarf_Die)); |
3235 |
++ fsp->found = true; |
3236 |
++ return 1; |
3237 |
++} |
3238 |
++ |
3239 |
+ /* Find an appropriate scope fits to given conditions */ |
3240 |
+ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) |
3241 |
+ { |
3242 |
+@@ -757,8 +767,13 @@ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) |
3243 |
+ .die_mem = die_mem, |
3244 |
+ .found = false, |
3245 |
+ }; |
3246 |
++ int ret; |
3247 |
+ |
3248 |
+- cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, &fsp); |
3249 |
++ ret = cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, |
3250 |
++ &fsp); |
3251 |
++ if (!ret && !fsp.found) |
3252 |
++ cu_walk_functions_at(&pf->cu_die, pf->addr, |
3253 |
++ find_inner_scope_cb, &fsp); |
3254 |
+ |
3255 |
+ return fsp.found ? die_mem : NULL; |
3256 |
+ } |
3257 |
+@@ -900,7 +915,7 @@ static int probe_point_inline_cb(Dwarf_Die *in_die, void *data) |
3258 |
+ ret = find_probe_point_lazy(in_die, pf); |
3259 |
+ else { |
3260 |
+ /* Get probe address */ |
3261 |
+- if (dwarf_entrypc(in_die, &addr) != 0) { |
3262 |
++ if (die_entrypc(in_die, &addr) != 0) { |
3263 |
+ pr_warning("Failed to get entry address of %s.\n", |
3264 |
+ dwarf_diename(in_die)); |
3265 |
+ return -ENOENT; |
3266 |
+@@ -1331,6 +1346,18 @@ static int collect_variables_cb(Dwarf_Die *die_mem, void *data) |
3267 |
+ return DIE_FIND_CB_SIBLING; |
3268 |
+ } |
3269 |
+ |
3270 |
++static bool available_var_finder_overlap(struct available_var_finder *af) |
3271 |
++{ |
3272 |
++ int i; |
3273 |
++ |
3274 |
++ for (i = 0; i < af->nvls; i++) { |
3275 |
++ if (af->pf.addr == af->vls[i].point.address) |
3276 |
++ return true; |
3277 |
++ } |
3278 |
++ return false; |
3279 |
++ |
3280 |
++} |
3281 |
++ |
3282 |
+ /* Add a found vars into available variables list */ |
3283 |
+ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) |
3284 |
+ { |
3285 |
+@@ -1341,6 +1368,14 @@ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) |
3286 |
+ Dwarf_Die die_mem; |
3287 |
+ int ret; |
3288 |
+ |
3289 |
++ /* |
3290 |
++ * For some reason (e.g. different column assigned to same address), |
3291 |
++ * this callback can be called with the address which already passed. |
3292 |
++ * Ignore it first. |
3293 |
++ */ |
3294 |
++ if (available_var_finder_overlap(af)) |
3295 |
++ return 0; |
3296 |
++ |
3297 |
+ /* Check number of tevs */ |
3298 |
+ if (af->nvls == af->max_vls) { |
3299 |
+ pr_warning("Too many( > %d) probe point found.\n", af->max_vls); |
3300 |
+@@ -1481,7 +1516,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, |
3301 |
+ /* Get function entry information */ |
3302 |
+ func = basefunc = dwarf_diename(&spdie); |
3303 |
+ if (!func || |
3304 |
+- dwarf_entrypc(&spdie, &baseaddr) != 0 || |
3305 |
++ die_entrypc(&spdie, &baseaddr) != 0 || |
3306 |
+ dwarf_decl_line(&spdie, &baseline) != 0) { |
3307 |
+ lineno = 0; |
3308 |
+ goto post; |
3309 |
+@@ -1498,7 +1533,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, |
3310 |
+ while (die_find_top_inlinefunc(&spdie, (Dwarf_Addr)addr, |
3311 |
+ &indie)) { |
3312 |
+ /* There is an inline function */ |
3313 |
+- if (dwarf_entrypc(&indie, &_addr) == 0 && |
3314 |
++ if (die_entrypc(&indie, &_addr) == 0 && |
3315 |
+ _addr == addr) { |
3316 |
+ /* |
3317 |
+ * addr is at an inline function entry. |
3318 |
+diff --git a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
3319 |
+index ebeaba6571a3..475e18e04318 100644 |
3320 |
+--- a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
3321 |
++++ b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c |
3322 |
+@@ -40,7 +40,6 @@ static cstate_t hsw_ext_cstates[HSW_EXT_CSTATE_COUNT] = { |
3323 |
+ { |
3324 |
+ .name = "PC9", |
3325 |
+ .desc = N_("Processor Package C9"), |
3326 |
+- .desc = N_("Processor Package C2"), |
3327 |
+ .id = PC9, |
3328 |
+ .range = RANGE_PACKAGE, |
3329 |
+ .get_count_percent = hsw_ext_get_count_percent, |