Annotation of /trunk/kernel-alx-legacy/patches-4.9/0308-4.9.209-all-fixes.patch
Parent Directory | Revision Log
Revision 3608 -
(hide annotations)
(download)
Fri Aug 14 07:34:29 2020 UTC (4 years, 1 month ago) by niro
File size: 89926 byte(s)
Fri Aug 14 07:34:29 2020 UTC (4 years, 1 month ago) by niro
File size: 89926 byte(s)
-added kerenl-alx-legacy pkg
1 | niro | 3608 | diff --git a/Makefile b/Makefile |
2 | index 1d1d9f68e962..ed9a08ab3772 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 9 | ||
8 | -SUBLEVEL = 208 | ||
9 | +SUBLEVEL = 209 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Roaring Lionus | ||
12 | |||
13 | diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts | ||
14 | index 957840cc7b78..b55c094893c6 100644 | ||
15 | --- a/arch/arm/boot/dts/am437x-gp-evm.dts | ||
16 | +++ b/arch/arm/boot/dts/am437x-gp-evm.dts | ||
17 | @@ -79,7 +79,7 @@ | ||
18 | }; | ||
19 | |||
20 | lcd0: display { | ||
21 | - compatible = "osddisplays,osd057T0559-34ts", "panel-dpi"; | ||
22 | + compatible = "osddisplays,osd070t1718-19ts", "panel-dpi"; | ||
23 | label = "lcd"; | ||
24 | |||
25 | panel-timing { | ||
26 | diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts | ||
27 | index 9d35c3f07cad..21918807c9f6 100644 | ||
28 | --- a/arch/arm/boot/dts/am43x-epos-evm.dts | ||
29 | +++ b/arch/arm/boot/dts/am43x-epos-evm.dts | ||
30 | @@ -41,7 +41,7 @@ | ||
31 | }; | ||
32 | |||
33 | lcd0: display { | ||
34 | - compatible = "osddisplays,osd057T0559-34ts", "panel-dpi"; | ||
35 | + compatible = "osddisplays,osd070t1718-19ts", "panel-dpi"; | ||
36 | label = "lcd"; | ||
37 | |||
38 | panel-timing { | ||
39 | diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c | ||
40 | index fe488523694c..635b0d549487 100644 | ||
41 | --- a/arch/arm/mach-vexpress/spc.c | ||
42 | +++ b/arch/arm/mach-vexpress/spc.c | ||
43 | @@ -555,8 +555,9 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev) | ||
44 | |||
45 | static int __init ve_spc_clk_init(void) | ||
46 | { | ||
47 | - int cpu; | ||
48 | + int cpu, cluster; | ||
49 | struct clk *clk; | ||
50 | + bool init_opp_table[MAX_CLUSTERS] = { false }; | ||
51 | |||
52 | if (!info) | ||
53 | return 0; /* Continue only if SPC is initialised */ | ||
54 | @@ -582,8 +583,17 @@ static int __init ve_spc_clk_init(void) | ||
55 | continue; | ||
56 | } | ||
57 | |||
58 | + cluster = topology_physical_package_id(cpu_dev->id); | ||
59 | + if (init_opp_table[cluster]) | ||
60 | + continue; | ||
61 | + | ||
62 | if (ve_init_opp_table(cpu_dev)) | ||
63 | pr_warn("failed to initialise cpu%d opp table\n", cpu); | ||
64 | + else if (dev_pm_opp_set_sharing_cpus(cpu_dev, | ||
65 | + topology_core_cpumask(cpu_dev->id))) | ||
66 | + pr_warn("failed to mark OPPs shared for cpu%d\n", cpu); | ||
67 | + else | ||
68 | + init_opp_table[cluster] = true; | ||
69 | } | ||
70 | |||
71 | platform_device_register_simple("vexpress-spc-cpufreq", -1, NULL, 0); | ||
72 | diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h | ||
73 | index f705d96a76f2..5bc3de78306a 100644 | ||
74 | --- a/arch/arm64/include/asm/pgtable-prot.h | ||
75 | +++ b/arch/arm64/include/asm/pgtable-prot.h | ||
76 | @@ -77,13 +77,12 @@ | ||
77 | #define PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN) | ||
78 | #define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) | ||
79 | #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN) | ||
80 | -#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_PXN) | ||
81 | |||
82 | #define __P000 PAGE_NONE | ||
83 | #define __P001 PAGE_READONLY | ||
84 | #define __P010 PAGE_COPY | ||
85 | #define __P011 PAGE_COPY | ||
86 | -#define __P100 PAGE_EXECONLY | ||
87 | +#define __P100 PAGE_READONLY_EXEC | ||
88 | #define __P101 PAGE_READONLY_EXEC | ||
89 | #define __P110 PAGE_COPY_EXEC | ||
90 | #define __P111 PAGE_COPY_EXEC | ||
91 | @@ -92,7 +91,7 @@ | ||
92 | #define __S001 PAGE_READONLY | ||
93 | #define __S010 PAGE_SHARED | ||
94 | #define __S011 PAGE_SHARED | ||
95 | -#define __S100 PAGE_EXECONLY | ||
96 | +#define __S100 PAGE_READONLY_EXEC | ||
97 | #define __S101 PAGE_READONLY_EXEC | ||
98 | #define __S110 PAGE_SHARED_EXEC | ||
99 | #define __S111 PAGE_SHARED_EXEC | ||
100 | diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h | ||
101 | index edb2c359480d..56ba1389a95a 100644 | ||
102 | --- a/arch/arm64/include/asm/pgtable.h | ||
103 | +++ b/arch/arm64/include/asm/pgtable.h | ||
104 | @@ -83,12 +83,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | ||
105 | #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte)) | ||
106 | |||
107 | #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) | ||
108 | -/* | ||
109 | - * Execute-only user mappings do not have the PTE_USER bit set. All valid | ||
110 | - * kernel mappings have the PTE_UXN bit set. | ||
111 | - */ | ||
112 | #define pte_valid_not_user(pte) \ | ||
113 | - ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN)) | ||
114 | + ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) | ||
115 | #define pte_valid_young(pte) \ | ||
116 | ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) | ||
117 | #define pte_valid_user(pte) \ | ||
118 | @@ -104,8 +100,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | ||
119 | |||
120 | /* | ||
121 | * p??_access_permitted() is true for valid user mappings (subject to the | ||
122 | - * write permission check) other than user execute-only which do not have the | ||
123 | - * PTE_USER bit set. PROT_NONE mappings do not have the PTE_VALID bit set. | ||
124 | + * write permission check). PROT_NONE mappings do not have the PTE_VALID bit | ||
125 | + * set. | ||
126 | */ | ||
127 | #define pte_access_permitted(pte, write) \ | ||
128 | (pte_valid_user(pte) && (!(write) || pte_write(pte))) | ||
129 | diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c | ||
130 | index 575c11a6f9b6..f3d3f2e97add 100644 | ||
131 | --- a/arch/arm64/mm/fault.c | ||
132 | +++ b/arch/arm64/mm/fault.c | ||
133 | @@ -319,7 +319,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, | ||
134 | struct task_struct *tsk; | ||
135 | struct mm_struct *mm; | ||
136 | int fault, sig, code; | ||
137 | - unsigned long vm_flags = VM_READ | VM_WRITE; | ||
138 | + unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC; | ||
139 | unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; | ||
140 | |||
141 | if (notify_page_fault(regs, esr)) | ||
142 | diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h | ||
143 | index e309d8fcb516..da1cb0499d6c 100644 | ||
144 | --- a/arch/mips/include/asm/thread_info.h | ||
145 | +++ b/arch/mips/include/asm/thread_info.h | ||
146 | @@ -52,8 +52,26 @@ struct thread_info { | ||
147 | #define init_thread_info (init_thread_union.thread_info) | ||
148 | #define init_stack (init_thread_union.stack) | ||
149 | |||
150 | -/* How to get the thread information struct from C. */ | ||
151 | +/* | ||
152 | + * A pointer to the struct thread_info for the currently executing thread is | ||
153 | + * held in register $28/$gp. | ||
154 | + * | ||
155 | + * We declare __current_thread_info as a global register variable rather than a | ||
156 | + * local register variable within current_thread_info() because clang doesn't | ||
157 | + * support explicit local register variables. | ||
158 | + * | ||
159 | + * When building the VDSO we take care not to declare the global register | ||
160 | + * variable because this causes GCC to not preserve the value of $28/$gp in | ||
161 | + * functions that change its value (which is common in the PIC VDSO when | ||
162 | + * accessing the GOT). Since the VDSO shouldn't be accessing | ||
163 | + * __current_thread_info anyway we declare it extern in order to cause a link | ||
164 | + * failure if it's referenced. | ||
165 | + */ | ||
166 | +#ifdef __VDSO__ | ||
167 | +extern struct thread_info *__current_thread_info; | ||
168 | +#else | ||
169 | register struct thread_info *__current_thread_info __asm__("$28"); | ||
170 | +#endif | ||
171 | |||
172 | static inline struct thread_info *current_thread_info(void) | ||
173 | { | ||
174 | diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h | ||
175 | index 7ada30900807..90253bdc2ee5 100644 | ||
176 | --- a/arch/parisc/include/asm/cmpxchg.h | ||
177 | +++ b/arch/parisc/include/asm/cmpxchg.h | ||
178 | @@ -43,8 +43,14 @@ __xchg(unsigned long x, __volatile__ void *ptr, int size) | ||
179 | ** if (((unsigned long)p & 0xf) == 0) | ||
180 | ** return __ldcw(p); | ||
181 | */ | ||
182 | -#define xchg(ptr, x) \ | ||
183 | - ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
184 | +#define xchg(ptr, x) \ | ||
185 | +({ \ | ||
186 | + __typeof__(*(ptr)) __ret; \ | ||
187 | + __typeof__(*(ptr)) _x_ = (x); \ | ||
188 | + __ret = (__typeof__(*(ptr))) \ | ||
189 | + __xchg((unsigned long)_x_, (ptr), sizeof(*(ptr))); \ | ||
190 | + __ret; \ | ||
191 | +}) | ||
192 | |||
193 | /* bug catcher for when unsupported size is used - won't link */ | ||
194 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
195 | diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c | ||
196 | index 1e93dbc88e80..34f70d36b16d 100644 | ||
197 | --- a/arch/powerpc/mm/mem.c | ||
198 | +++ b/arch/powerpc/mm/mem.c | ||
199 | @@ -345,6 +345,14 @@ void __init mem_init(void) | ||
200 | BUILD_BUG_ON(MMU_PAGE_COUNT > 16); | ||
201 | |||
202 | #ifdef CONFIG_SWIOTLB | ||
203 | + /* | ||
204 | + * Some platforms (e.g. 85xx) limit DMA-able memory way below | ||
205 | + * 4G. We force memblock to bottom-up mode to ensure that the | ||
206 | + * memory allocated in swiotlb_init() is DMA-able. | ||
207 | + * As it's the last memblock allocation, no need to reset it | ||
208 | + * back to to-down. | ||
209 | + */ | ||
210 | + memblock_set_bottom_up(true); | ||
211 | swiotlb_init(0); | ||
212 | #endif | ||
213 | |||
214 | diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c | ||
215 | index 74da18de853a..73ec15cd2708 100644 | ||
216 | --- a/arch/powerpc/platforms/pseries/hvconsole.c | ||
217 | +++ b/arch/powerpc/platforms/pseries/hvconsole.c | ||
218 | @@ -62,7 +62,7 @@ EXPORT_SYMBOL(hvc_get_chars); | ||
219 | * @vtermno: The vtermno or unit_address of the adapter from which the data | ||
220 | * originated. | ||
221 | * @buf: The character buffer that contains the character data to send to | ||
222 | - * firmware. | ||
223 | + * firmware. Must be at least 16 bytes, even if count is less than 16. | ||
224 | * @count: Send this number of characters. | ||
225 | */ | ||
226 | int hvc_put_chars(uint32_t vtermno, const char *buf, int count) | ||
227 | diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c | ||
228 | index 02476d2333df..c62eb09b2ba7 100644 | ||
229 | --- a/arch/s390/kernel/perf_cpum_sf.c | ||
230 | +++ b/arch/s390/kernel/perf_cpum_sf.c | ||
231 | @@ -1295,18 +1295,28 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) | ||
232 | */ | ||
233 | if (flush_all && done) | ||
234 | break; | ||
235 | - | ||
236 | - /* If an event overflow happened, discard samples by | ||
237 | - * processing any remaining sample-data-blocks. | ||
238 | - */ | ||
239 | - if (event_overflow) | ||
240 | - flush_all = 1; | ||
241 | } | ||
242 | |||
243 | /* Account sample overflows in the event hardware structure */ | ||
244 | if (sampl_overflow) | ||
245 | OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) + | ||
246 | sampl_overflow, 1 + num_sdb); | ||
247 | + | ||
248 | + /* Perf_event_overflow() and perf_event_account_interrupt() limit | ||
249 | + * the interrupt rate to an upper limit. Roughly 1000 samples per | ||
250 | + * task tick. | ||
251 | + * Hitting this limit results in a large number | ||
252 | + * of throttled REF_REPORT_THROTTLE entries and the samples | ||
253 | + * are dropped. | ||
254 | + * Slightly increase the interval to avoid hitting this limit. | ||
255 | + */ | ||
256 | + if (event_overflow) { | ||
257 | + SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10); | ||
258 | + debug_sprintf_event(sfdbg, 1, "%s: rate adjustment %ld\n", | ||
259 | + __func__, | ||
260 | + DIV_ROUND_UP(SAMPL_RATE(hwc), 10)); | ||
261 | + } | ||
262 | + | ||
263 | if (sampl_overflow || event_overflow) | ||
264 | debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " | ||
265 | "overflow stats: sample=%llu event=%llu\n", | ||
266 | diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c | ||
267 | index d52a94e9f57f..cba8e56cd63d 100644 | ||
268 | --- a/arch/s390/kernel/smp.c | ||
269 | +++ b/arch/s390/kernel/smp.c | ||
270 | @@ -691,39 +691,67 @@ static struct sclp_core_info *smp_get_core_info(void) | ||
271 | |||
272 | static int smp_add_present_cpu(int cpu); | ||
273 | |||
274 | -static int __smp_rescan_cpus(struct sclp_core_info *info, int sysfs_add) | ||
275 | +static int smp_add_core(struct sclp_core_entry *core, cpumask_t *avail, | ||
276 | + bool configured, bool early) | ||
277 | { | ||
278 | struct pcpu *pcpu; | ||
279 | - cpumask_t avail; | ||
280 | - int cpu, nr, i, j; | ||
281 | + int cpu, nr, i; | ||
282 | u16 address; | ||
283 | |||
284 | nr = 0; | ||
285 | - cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); | ||
286 | - cpu = cpumask_first(&avail); | ||
287 | - for (i = 0; (i < info->combined) && (cpu < nr_cpu_ids); i++) { | ||
288 | - if (sclp.has_core_type && info->core[i].type != boot_core_type) | ||
289 | + if (sclp.has_core_type && core->type != boot_core_type) | ||
290 | + return nr; | ||
291 | + cpu = cpumask_first(avail); | ||
292 | + address = core->core_id << smp_cpu_mt_shift; | ||
293 | + for (i = 0; (i <= smp_cpu_mtid) && (cpu < nr_cpu_ids); i++) { | ||
294 | + if (pcpu_find_address(cpu_present_mask, address + i)) | ||
295 | continue; | ||
296 | - address = info->core[i].core_id << smp_cpu_mt_shift; | ||
297 | - for (j = 0; j <= smp_cpu_mtid; j++) { | ||
298 | - if (pcpu_find_address(cpu_present_mask, address + j)) | ||
299 | - continue; | ||
300 | - pcpu = pcpu_devices + cpu; | ||
301 | - pcpu->address = address + j; | ||
302 | - pcpu->state = | ||
303 | - (cpu >= info->configured*(smp_cpu_mtid + 1)) ? | ||
304 | - CPU_STATE_STANDBY : CPU_STATE_CONFIGURED; | ||
305 | - smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); | ||
306 | - set_cpu_present(cpu, true); | ||
307 | - if (sysfs_add && smp_add_present_cpu(cpu) != 0) | ||
308 | - set_cpu_present(cpu, false); | ||
309 | - else | ||
310 | - nr++; | ||
311 | - cpu = cpumask_next(cpu, &avail); | ||
312 | - if (cpu >= nr_cpu_ids) | ||
313 | + pcpu = pcpu_devices + cpu; | ||
314 | + pcpu->address = address + i; | ||
315 | + if (configured) | ||
316 | + pcpu->state = CPU_STATE_CONFIGURED; | ||
317 | + else | ||
318 | + pcpu->state = CPU_STATE_STANDBY; | ||
319 | + smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); | ||
320 | + set_cpu_present(cpu, true); | ||
321 | + if (!early && smp_add_present_cpu(cpu) != 0) | ||
322 | + set_cpu_present(cpu, false); | ||
323 | + else | ||
324 | + nr++; | ||
325 | + cpumask_clear_cpu(cpu, avail); | ||
326 | + cpu = cpumask_next(cpu, avail); | ||
327 | + } | ||
328 | + return nr; | ||
329 | +} | ||
330 | + | ||
331 | +static int __smp_rescan_cpus(struct sclp_core_info *info, bool early) | ||
332 | +{ | ||
333 | + struct sclp_core_entry *core; | ||
334 | + cpumask_t avail; | ||
335 | + bool configured; | ||
336 | + u16 core_id; | ||
337 | + int nr, i; | ||
338 | + | ||
339 | + nr = 0; | ||
340 | + cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); | ||
341 | + /* | ||
342 | + * Add IPL core first (which got logical CPU number 0) to make sure | ||
343 | + * that all SMT threads get subsequent logical CPU numbers. | ||
344 | + */ | ||
345 | + if (early) { | ||
346 | + core_id = pcpu_devices[0].address >> smp_cpu_mt_shift; | ||
347 | + for (i = 0; i < info->configured; i++) { | ||
348 | + core = &info->core[i]; | ||
349 | + if (core->core_id == core_id) { | ||
350 | + nr += smp_add_core(core, &avail, true, early); | ||
351 | break; | ||
352 | + } | ||
353 | } | ||
354 | } | ||
355 | + for (i = 0; i < info->combined; i++) { | ||
356 | + configured = i < info->configured; | ||
357 | + nr += smp_add_core(&info->core[i], &avail, configured, early); | ||
358 | + } | ||
359 | return nr; | ||
360 | } | ||
361 | |||
362 | @@ -771,7 +799,7 @@ static void __init smp_detect_cpus(void) | ||
363 | |||
364 | /* Add CPUs present at boot */ | ||
365 | get_online_cpus(); | ||
366 | - __smp_rescan_cpus(info, 0); | ||
367 | + __smp_rescan_cpus(info, true); | ||
368 | put_online_cpus(); | ||
369 | kfree(info); | ||
370 | } | ||
371 | @@ -1127,7 +1155,7 @@ int __ref smp_rescan_cpus(void) | ||
372 | return -ENOMEM; | ||
373 | get_online_cpus(); | ||
374 | mutex_lock(&smp_cpu_state_mutex); | ||
375 | - nr = __smp_rescan_cpus(info, 1); | ||
376 | + nr = __smp_rescan_cpus(info, false); | ||
377 | mutex_unlock(&smp_cpu_state_mutex); | ||
378 | put_online_cpus(); | ||
379 | kfree(info); | ||
380 | diff --git a/arch/tile/lib/atomic_asm_32.S b/arch/tile/lib/atomic_asm_32.S | ||
381 | index 1a70e6c0f259..94709ab41ed8 100644 | ||
382 | --- a/arch/tile/lib/atomic_asm_32.S | ||
383 | +++ b/arch/tile/lib/atomic_asm_32.S | ||
384 | @@ -24,8 +24,7 @@ | ||
385 | * has an opportunity to return -EFAULT to the user if needed. | ||
386 | * The 64-bit routines just return a "long long" with the value, | ||
387 | * since they are only used from kernel space and don't expect to fault. | ||
388 | - * Support for 16-bit ops is included in the framework but we don't provide | ||
389 | - * any (x86_64 has an atomic_inc_short(), so we might want to some day). | ||
390 | + * Support for 16-bit ops is included in the framework but we don't provide any. | ||
391 | * | ||
392 | * Note that the caller is advised to issue a suitable L1 or L2 | ||
393 | * prefetch on the address being manipulated to avoid extra stalls. | ||
394 | diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c | ||
395 | index 1e9f610d36a4..c26cca506f64 100644 | ||
396 | --- a/arch/x86/events/core.c | ||
397 | +++ b/arch/x86/events/core.c | ||
398 | @@ -374,7 +374,7 @@ int x86_add_exclusive(unsigned int what) | ||
399 | * LBR and BTS are still mutually exclusive. | ||
400 | */ | ||
401 | if (x86_pmu.lbr_pt_coexist && what == x86_lbr_exclusive_pt) | ||
402 | - return 0; | ||
403 | + goto out; | ||
404 | |||
405 | if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) { | ||
406 | mutex_lock(&pmc_reserve_mutex); | ||
407 | @@ -386,6 +386,7 @@ int x86_add_exclusive(unsigned int what) | ||
408 | mutex_unlock(&pmc_reserve_mutex); | ||
409 | } | ||
410 | |||
411 | +out: | ||
412 | atomic_inc(&active_events); | ||
413 | return 0; | ||
414 | |||
415 | @@ -396,11 +397,15 @@ fail_unlock: | ||
416 | |||
417 | void x86_del_exclusive(unsigned int what) | ||
418 | { | ||
419 | + atomic_dec(&active_events); | ||
420 | + | ||
421 | + /* | ||
422 | + * See the comment in x86_add_exclusive(). | ||
423 | + */ | ||
424 | if (x86_pmu.lbr_pt_coexist && what == x86_lbr_exclusive_pt) | ||
425 | return; | ||
426 | |||
427 | atomic_dec(&x86_pmu.lbr_exclusive[what]); | ||
428 | - atomic_dec(&active_events); | ||
429 | } | ||
430 | |||
431 | int x86_setup_perfctr(struct perf_event *event) | ||
432 | diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h | ||
433 | index 76a35c1213d2..305c6eed9141 100644 | ||
434 | --- a/arch/x86/include/asm/atomic.h | ||
435 | +++ b/arch/x86/include/asm/atomic.h | ||
436 | @@ -249,19 +249,6 @@ static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u) | ||
437 | return c; | ||
438 | } | ||
439 | |||
440 | -/** | ||
441 | - * atomic_inc_short - increment of a short integer | ||
442 | - * @v: pointer to type int | ||
443 | - * | ||
444 | - * Atomically adds 1 to @v | ||
445 | - * Returns the new value of @u | ||
446 | - */ | ||
447 | -static __always_inline short int atomic_inc_short(short int *v) | ||
448 | -{ | ||
449 | - asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v)); | ||
450 | - return *v; | ||
451 | -} | ||
452 | - | ||
453 | #ifdef CONFIG_X86_32 | ||
454 | # include <asm/atomic64_32.h> | ||
455 | #else | ||
456 | diff --git a/block/blk-map.c b/block/blk-map.c | ||
457 | index a8b4f526d8bb..52edbe6b9380 100644 | ||
458 | --- a/block/blk-map.c | ||
459 | +++ b/block/blk-map.c | ||
460 | @@ -142,7 +142,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, | ||
461 | return 0; | ||
462 | |||
463 | unmap_rq: | ||
464 | - __blk_rq_unmap_user(bio); | ||
465 | + blk_rq_unmap_user(bio); | ||
466 | fail: | ||
467 | rq->bio = NULL; | ||
468 | return ret; | ||
469 | diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c | ||
470 | index 3c9fdd6983aa..b6e5447d563e 100644 | ||
471 | --- a/block/compat_ioctl.c | ||
472 | +++ b/block/compat_ioctl.c | ||
473 | @@ -5,6 +5,7 @@ | ||
474 | #include <linux/compat.h> | ||
475 | #include <linux/elevator.h> | ||
476 | #include <linux/hdreg.h> | ||
477 | +#include <linux/pr.h> | ||
478 | #include <linux/slab.h> | ||
479 | #include <linux/syscalls.h> | ||
480 | #include <linux/types.h> | ||
481 | @@ -406,6 +407,14 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) | ||
482 | case BLKTRACETEARDOWN: /* compatible */ | ||
483 | ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg)); | ||
484 | return ret; | ||
485 | + case IOC_PR_REGISTER: | ||
486 | + case IOC_PR_RESERVE: | ||
487 | + case IOC_PR_RELEASE: | ||
488 | + case IOC_PR_PREEMPT: | ||
489 | + case IOC_PR_PREEMPT_ABORT: | ||
490 | + case IOC_PR_CLEAR: | ||
491 | + return blkdev_ioctl(bdev, mode, cmd, | ||
492 | + (unsigned long)compat_ptr(arg)); | ||
493 | default: | ||
494 | if (disk->fops->compat_ioctl) | ||
495 | ret = disk->fops->compat_ioctl(bdev, mode, cmd, arg); | ||
496 | diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c | ||
497 | index 6f8a7341fa08..f50a76ad63e4 100644 | ||
498 | --- a/drivers/ata/ahci_brcm.c | ||
499 | +++ b/drivers/ata/ahci_brcm.c | ||
500 | @@ -25,6 +25,7 @@ | ||
501 | #include <linux/module.h> | ||
502 | #include <linux/of.h> | ||
503 | #include <linux/platform_device.h> | ||
504 | +#include <linux/reset.h> | ||
505 | #include <linux/string.h> | ||
506 | |||
507 | #include "ahci.h" | ||
508 | @@ -88,6 +89,7 @@ struct brcm_ahci_priv { | ||
509 | u32 port_mask; | ||
510 | u32 quirks; | ||
511 | enum brcm_ahci_version version; | ||
512 | + struct reset_control *rcdev; | ||
513 | }; | ||
514 | |||
515 | static const struct ata_port_info ahci_brcm_port_info = { | ||
516 | @@ -226,19 +228,12 @@ static void brcm_sata_phys_disable(struct brcm_ahci_priv *priv) | ||
517 | brcm_sata_phy_disable(priv, i); | ||
518 | } | ||
519 | |||
520 | -static u32 brcm_ahci_get_portmask(struct platform_device *pdev, | ||
521 | +static u32 brcm_ahci_get_portmask(struct ahci_host_priv *hpriv, | ||
522 | struct brcm_ahci_priv *priv) | ||
523 | { | ||
524 | - void __iomem *ahci; | ||
525 | - struct resource *res; | ||
526 | u32 impl; | ||
527 | |||
528 | - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ahci"); | ||
529 | - ahci = devm_ioremap_resource(&pdev->dev, res); | ||
530 | - if (IS_ERR(ahci)) | ||
531 | - return 0; | ||
532 | - | ||
533 | - impl = readl(ahci + HOST_PORTS_IMPL); | ||
534 | + impl = readl(hpriv->mmio + HOST_PORTS_IMPL); | ||
535 | |||
536 | if (fls(impl) > SATA_TOP_MAX_PHYS) | ||
537 | dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n", | ||
538 | @@ -246,9 +241,6 @@ static u32 brcm_ahci_get_portmask(struct platform_device *pdev, | ||
539 | else if (!impl) | ||
540 | dev_info(priv->dev, "no ports found\n"); | ||
541 | |||
542 | - devm_iounmap(&pdev->dev, ahci); | ||
543 | - devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); | ||
544 | - | ||
545 | return impl; | ||
546 | } | ||
547 | |||
548 | @@ -275,11 +267,10 @@ static int brcm_ahci_suspend(struct device *dev) | ||
549 | struct ata_host *host = dev_get_drvdata(dev); | ||
550 | struct ahci_host_priv *hpriv = host->private_data; | ||
551 | struct brcm_ahci_priv *priv = hpriv->plat_data; | ||
552 | - int ret; | ||
553 | |||
554 | - ret = ahci_platform_suspend(dev); | ||
555 | brcm_sata_phys_disable(priv); | ||
556 | - return ret; | ||
557 | + | ||
558 | + return ahci_platform_suspend(dev); | ||
559 | } | ||
560 | |||
561 | static int brcm_ahci_resume(struct device *dev) | ||
562 | @@ -287,11 +278,44 @@ static int brcm_ahci_resume(struct device *dev) | ||
563 | struct ata_host *host = dev_get_drvdata(dev); | ||
564 | struct ahci_host_priv *hpriv = host->private_data; | ||
565 | struct brcm_ahci_priv *priv = hpriv->plat_data; | ||
566 | + int ret; | ||
567 | + | ||
568 | + /* Make sure clocks are turned on before re-configuration */ | ||
569 | + ret = ahci_platform_enable_clks(hpriv); | ||
570 | + if (ret) | ||
571 | + return ret; | ||
572 | |||
573 | brcm_sata_init(priv); | ||
574 | brcm_sata_phys_enable(priv); | ||
575 | brcm_sata_alpm_init(hpriv); | ||
576 | - return ahci_platform_resume(dev); | ||
577 | + | ||
578 | + /* Since we had to enable clocks earlier on, we cannot use | ||
579 | + * ahci_platform_resume() as-is since a second call to | ||
580 | + * ahci_platform_enable_resources() would bump up the resources | ||
581 | + * (regulators, clocks, PHYs) count artificially so we copy the part | ||
582 | + * after ahci_platform_enable_resources(). | ||
583 | + */ | ||
584 | + ret = ahci_platform_enable_phys(hpriv); | ||
585 | + if (ret) | ||
586 | + goto out_disable_phys; | ||
587 | + | ||
588 | + ret = ahci_platform_resume_host(dev); | ||
589 | + if (ret) | ||
590 | + goto out_disable_platform_phys; | ||
591 | + | ||
592 | + /* We resumed so update PM runtime state */ | ||
593 | + pm_runtime_disable(dev); | ||
594 | + pm_runtime_set_active(dev); | ||
595 | + pm_runtime_enable(dev); | ||
596 | + | ||
597 | + return 0; | ||
598 | + | ||
599 | +out_disable_platform_phys: | ||
600 | + ahci_platform_disable_phys(hpriv); | ||
601 | +out_disable_phys: | ||
602 | + brcm_sata_phys_disable(priv); | ||
603 | + ahci_platform_disable_clks(hpriv); | ||
604 | + return ret; | ||
605 | } | ||
606 | #endif | ||
607 | |||
608 | @@ -332,43 +356,73 @@ static int brcm_ahci_probe(struct platform_device *pdev) | ||
609 | if (IS_ERR(priv->top_ctrl)) | ||
610 | return PTR_ERR(priv->top_ctrl); | ||
611 | |||
612 | + /* Reset is optional depending on platform */ | ||
613 | + priv->rcdev = devm_reset_control_get(&pdev->dev, "ahci"); | ||
614 | + if (!IS_ERR_OR_NULL(priv->rcdev)) | ||
615 | + reset_control_deassert(priv->rcdev); | ||
616 | + | ||
617 | if ((priv->version == BRCM_SATA_BCM7425) || | ||
618 | (priv->version == BRCM_SATA_NSP)) { | ||
619 | priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ; | ||
620 | priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE; | ||
621 | } | ||
622 | |||
623 | + hpriv = ahci_platform_get_resources(pdev); | ||
624 | + if (IS_ERR(hpriv)) { | ||
625 | + ret = PTR_ERR(hpriv); | ||
626 | + goto out_reset; | ||
627 | + } | ||
628 | + | ||
629 | + ret = ahci_platform_enable_clks(hpriv); | ||
630 | + if (ret) | ||
631 | + goto out_reset; | ||
632 | + | ||
633 | + /* Must be first so as to configure endianness including that | ||
634 | + * of the standard AHCI register space. | ||
635 | + */ | ||
636 | brcm_sata_init(priv); | ||
637 | |||
638 | - priv->port_mask = brcm_ahci_get_portmask(pdev, priv); | ||
639 | - if (!priv->port_mask) | ||
640 | - return -ENODEV; | ||
641 | + /* Initializes priv->port_mask which is used below */ | ||
642 | + priv->port_mask = brcm_ahci_get_portmask(hpriv, priv); | ||
643 | + if (!priv->port_mask) { | ||
644 | + ret = -ENODEV; | ||
645 | + goto out_disable_clks; | ||
646 | + } | ||
647 | |||
648 | + /* Must be done before ahci_platform_enable_phys() */ | ||
649 | brcm_sata_phys_enable(priv); | ||
650 | |||
651 | - hpriv = ahci_platform_get_resources(pdev); | ||
652 | - if (IS_ERR(hpriv)) | ||
653 | - return PTR_ERR(hpriv); | ||
654 | hpriv->plat_data = priv; | ||
655 | hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP; | ||
656 | |||
657 | brcm_sata_alpm_init(hpriv); | ||
658 | |||
659 | - ret = ahci_platform_enable_resources(hpriv); | ||
660 | - if (ret) | ||
661 | - return ret; | ||
662 | - | ||
663 | if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ) | ||
664 | hpriv->flags |= AHCI_HFLAG_NO_NCQ; | ||
665 | |||
666 | + ret = ahci_platform_enable_phys(hpriv); | ||
667 | + if (ret) | ||
668 | + goto out_disable_phys; | ||
669 | + | ||
670 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_brcm_port_info, | ||
671 | &ahci_platform_sht); | ||
672 | if (ret) | ||
673 | - return ret; | ||
674 | + goto out_disable_platform_phys; | ||
675 | |||
676 | dev_info(dev, "Broadcom AHCI SATA3 registered\n"); | ||
677 | |||
678 | return 0; | ||
679 | + | ||
680 | +out_disable_platform_phys: | ||
681 | + ahci_platform_disable_phys(hpriv); | ||
682 | +out_disable_phys: | ||
683 | + brcm_sata_phys_disable(priv); | ||
684 | +out_disable_clks: | ||
685 | + ahci_platform_disable_clks(hpriv); | ||
686 | +out_reset: | ||
687 | + if (!IS_ERR_OR_NULL(priv->rcdev)) | ||
688 | + reset_control_assert(priv->rcdev); | ||
689 | + return ret; | ||
690 | } | ||
691 | |||
692 | static int brcm_ahci_remove(struct platform_device *pdev) | ||
693 | @@ -378,12 +432,12 @@ static int brcm_ahci_remove(struct platform_device *pdev) | ||
694 | struct brcm_ahci_priv *priv = hpriv->plat_data; | ||
695 | int ret; | ||
696 | |||
697 | + brcm_sata_phys_disable(priv); | ||
698 | + | ||
699 | ret = ata_platform_remove_one(pdev); | ||
700 | if (ret) | ||
701 | return ret; | ||
702 | |||
703 | - brcm_sata_phys_disable(priv); | ||
704 | - | ||
705 | return 0; | ||
706 | } | ||
707 | |||
708 | diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c | ||
709 | index 65371e1befe8..0b80502bc1c5 100644 | ||
710 | --- a/drivers/ata/libahci_platform.c | ||
711 | +++ b/drivers/ata/libahci_platform.c | ||
712 | @@ -46,7 +46,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops); | ||
713 | * RETURNS: | ||
714 | * 0 on success otherwise a negative error code | ||
715 | */ | ||
716 | -static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) | ||
717 | +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) | ||
718 | { | ||
719 | int rc, i; | ||
720 | |||
721 | @@ -71,6 +71,7 @@ disable_phys: | ||
722 | } | ||
723 | return rc; | ||
724 | } | ||
725 | +EXPORT_SYMBOL_GPL(ahci_platform_enable_phys); | ||
726 | |||
727 | /** | ||
728 | * ahci_platform_disable_phys - Disable PHYs | ||
729 | @@ -78,7 +79,7 @@ disable_phys: | ||
730 | * | ||
731 | * This function disables all PHYs found in hpriv->phys. | ||
732 | */ | ||
733 | -static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) | ||
734 | +void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) | ||
735 | { | ||
736 | int i; | ||
737 | |||
738 | @@ -87,6 +88,7 @@ static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) | ||
739 | phy_exit(hpriv->phys[i]); | ||
740 | } | ||
741 | } | ||
742 | +EXPORT_SYMBOL_GPL(ahci_platform_disable_phys); | ||
743 | |||
744 | /** | ||
745 | * ahci_platform_enable_clks - Enable platform clocks | ||
746 | diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c | ||
747 | index d6eaaa25d1cc..a700e525535c 100644 | ||
748 | --- a/drivers/block/xen-blkback/blkback.c | ||
749 | +++ b/drivers/block/xen-blkback/blkback.c | ||
750 | @@ -929,6 +929,8 @@ next: | ||
751 | out_of_memory: | ||
752 | pr_alert("%s: out of memory\n", __func__); | ||
753 | put_free_pages(ring, pages_to_gnt, segs_to_map); | ||
754 | + for (i = last_map; i < num; i++) | ||
755 | + pages[i]->handle = BLKBACK_INVALID_HANDLE; | ||
756 | return -ENOMEM; | ||
757 | } | ||
758 | |||
759 | diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c | ||
760 | index ad736d7de838..1d1f86657967 100644 | ||
761 | --- a/drivers/block/xen-blkback/xenbus.c | ||
762 | +++ b/drivers/block/xen-blkback/xenbus.c | ||
763 | @@ -178,6 +178,15 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) | ||
764 | blkif->domid = domid; | ||
765 | atomic_set(&blkif->refcnt, 1); | ||
766 | init_completion(&blkif->drain_complete); | ||
767 | + | ||
768 | + /* | ||
769 | + * Because freeing back to the cache may be deferred, it is not | ||
770 | + * safe to unload the module (and hence destroy the cache) until | ||
771 | + * this has completed. To prevent premature unloading, take an | ||
772 | + * extra module reference here and release only when the object | ||
773 | + * has been freed back to the cache. | ||
774 | + */ | ||
775 | + __module_get(THIS_MODULE); | ||
776 | INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); | ||
777 | |||
778 | return blkif; | ||
779 | @@ -322,6 +331,7 @@ static void xen_blkif_free(struct xen_blkif *blkif) | ||
780 | |||
781 | /* Make sure everything is drained before shutting down */ | ||
782 | kmem_cache_free(xen_blkif_cachep, blkif); | ||
783 | + module_put(THIS_MODULE); | ||
784 | } | ||
785 | |||
786 | int __init xen_blkif_interface_init(void) | ||
787 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c | ||
788 | index 1d1c0d7aec88..4e3b24a0511f 100644 | ||
789 | --- a/drivers/bluetooth/btusb.c | ||
790 | +++ b/drivers/bluetooth/btusb.c | ||
791 | @@ -1069,7 +1069,7 @@ static int btusb_open(struct hci_dev *hdev) | ||
792 | if (data->setup_on_usb) { | ||
793 | err = data->setup_on_usb(hdev); | ||
794 | if (err < 0) | ||
795 | - return err; | ||
796 | + goto setup_fail; | ||
797 | } | ||
798 | |||
799 | data->intf->needs_remote_wakeup = 1; | ||
800 | @@ -1101,6 +1101,7 @@ done: | ||
801 | |||
802 | failed: | ||
803 | clear_bit(BTUSB_INTR_RUNNING, &data->flags); | ||
804 | +setup_fail: | ||
805 | usb_autopm_put_interface(data->intf); | ||
806 | return err; | ||
807 | } | ||
808 | diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c | ||
809 | index df62e38de5f5..1ba9d02381e8 100644 | ||
810 | --- a/drivers/devfreq/devfreq.c | ||
811 | +++ b/drivers/devfreq/devfreq.c | ||
812 | @@ -482,11 +482,6 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type, | ||
813 | static void _remove_devfreq(struct devfreq *devfreq) | ||
814 | { | ||
815 | mutex_lock(&devfreq_list_lock); | ||
816 | - if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) { | ||
817 | - mutex_unlock(&devfreq_list_lock); | ||
818 | - dev_warn(&devfreq->dev, "releasing devfreq which doesn't exist\n"); | ||
819 | - return; | ||
820 | - } | ||
821 | list_del(&devfreq->node); | ||
822 | mutex_unlock(&devfreq_list_lock); | ||
823 | |||
824 | @@ -558,6 +553,7 @@ struct devfreq *devfreq_add_device(struct device *dev, | ||
825 | devfreq->dev.parent = dev; | ||
826 | devfreq->dev.class = devfreq_class; | ||
827 | devfreq->dev.release = devfreq_dev_release; | ||
828 | + INIT_LIST_HEAD(&devfreq->node); | ||
829 | devfreq->profile = profile; | ||
830 | strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); | ||
831 | devfreq->previous_freq = profile->initial_freq; | ||
832 | @@ -986,7 +982,7 @@ static ssize_t available_governors_show(struct device *d, | ||
833 | * The devfreq with immutable governor (e.g., passive) shows | ||
834 | * only own governor. | ||
835 | */ | ||
836 | - if (df->governor->immutable) { | ||
837 | + if (df->governor && df->governor->immutable) { | ||
838 | count = scnprintf(&buf[count], DEVFREQ_NAME_LEN, | ||
839 | "%s ", df->governor_name); | ||
840 | /* | ||
841 | diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c | ||
842 | index 15475892af0c..bc19ac0e662e 100644 | ||
843 | --- a/drivers/firewire/net.c | ||
844 | +++ b/drivers/firewire/net.c | ||
845 | @@ -249,7 +249,11 @@ static int fwnet_header_cache(const struct neighbour *neigh, | ||
846 | h = (struct fwnet_header *)((u8 *)hh->hh_data + HH_DATA_OFF(sizeof(*h))); | ||
847 | h->h_proto = type; | ||
848 | memcpy(h->h_dest, neigh->ha, net->addr_len); | ||
849 | - hh->hh_len = FWNET_HLEN; | ||
850 | + | ||
851 | + /* Pairs with the READ_ONCE() in neigh_resolve_output(), | ||
852 | + * neigh_hh_output() and neigh_update_hhs(). | ||
853 | + */ | ||
854 | + smp_store_release(&hh->hh_len, FWNET_HLEN); | ||
855 | |||
856 | return 0; | ||
857 | } | ||
858 | diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c | ||
859 | index 24c461dea7af..fd8053f9556e 100644 | ||
860 | --- a/drivers/firmware/efi/libstub/gop.c | ||
861 | +++ b/drivers/firmware/efi/libstub/gop.c | ||
862 | @@ -85,30 +85,6 @@ setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line, | ||
863 | } | ||
864 | } | ||
865 | |||
866 | -static efi_status_t | ||
867 | -__gop_query32(efi_system_table_t *sys_table_arg, | ||
868 | - struct efi_graphics_output_protocol_32 *gop32, | ||
869 | - struct efi_graphics_output_mode_info **info, | ||
870 | - unsigned long *size, u64 *fb_base) | ||
871 | -{ | ||
872 | - struct efi_graphics_output_protocol_mode_32 *mode; | ||
873 | - efi_graphics_output_protocol_query_mode query_mode; | ||
874 | - efi_status_t status; | ||
875 | - unsigned long m; | ||
876 | - | ||
877 | - m = gop32->mode; | ||
878 | - mode = (struct efi_graphics_output_protocol_mode_32 *)m; | ||
879 | - query_mode = (void *)(unsigned long)gop32->query_mode; | ||
880 | - | ||
881 | - status = __efi_call_early(query_mode, (void *)gop32, mode->mode, size, | ||
882 | - info); | ||
883 | - if (status != EFI_SUCCESS) | ||
884 | - return status; | ||
885 | - | ||
886 | - *fb_base = mode->frame_buffer_base; | ||
887 | - return status; | ||
888 | -} | ||
889 | - | ||
890 | static efi_status_t | ||
891 | setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
892 | efi_guid_t *proto, unsigned long size, void **gop_handle) | ||
893 | @@ -121,7 +97,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
894 | u64 fb_base; | ||
895 | struct efi_pixel_bitmask pixel_info; | ||
896 | int pixel_format; | ||
897 | - efi_status_t status = EFI_NOT_FOUND; | ||
898 | + efi_status_t status; | ||
899 | u32 *handles = (u32 *)(unsigned long)gop_handle; | ||
900 | int i; | ||
901 | |||
902 | @@ -130,6 +106,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
903 | |||
904 | nr_gops = size / sizeof(u32); | ||
905 | for (i = 0; i < nr_gops; i++) { | ||
906 | + struct efi_graphics_output_protocol_mode_32 *mode; | ||
907 | struct efi_graphics_output_mode_info *info = NULL; | ||
908 | efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID; | ||
909 | bool conout_found = false; | ||
910 | @@ -147,9 +124,11 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
911 | if (status == EFI_SUCCESS) | ||
912 | conout_found = true; | ||
913 | |||
914 | - status = __gop_query32(sys_table_arg, gop32, &info, &size, | ||
915 | - ¤t_fb_base); | ||
916 | - if (status == EFI_SUCCESS && (!first_gop || conout_found) && | ||
917 | + mode = (void *)(unsigned long)gop32->mode; | ||
918 | + info = (void *)(unsigned long)mode->info; | ||
919 | + current_fb_base = mode->frame_buffer_base; | ||
920 | + | ||
921 | + if ((!first_gop || conout_found) && | ||
922 | info->pixel_format != PIXEL_BLT_ONLY) { | ||
923 | /* | ||
924 | * Systems that use the UEFI Console Splitter may | ||
925 | @@ -177,7 +156,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
926 | |||
927 | /* Did we find any GOPs? */ | ||
928 | if (!first_gop) | ||
929 | - goto out; | ||
930 | + return EFI_NOT_FOUND; | ||
931 | |||
932 | /* EFI framebuffer */ | ||
933 | si->orig_video_isVGA = VIDEO_TYPE_EFI; | ||
934 | @@ -199,32 +178,8 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
935 | si->lfb_size = si->lfb_linelength * si->lfb_height; | ||
936 | |||
937 | si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS; | ||
938 | -out: | ||
939 | - return status; | ||
940 | -} | ||
941 | - | ||
942 | -static efi_status_t | ||
943 | -__gop_query64(efi_system_table_t *sys_table_arg, | ||
944 | - struct efi_graphics_output_protocol_64 *gop64, | ||
945 | - struct efi_graphics_output_mode_info **info, | ||
946 | - unsigned long *size, u64 *fb_base) | ||
947 | -{ | ||
948 | - struct efi_graphics_output_protocol_mode_64 *mode; | ||
949 | - efi_graphics_output_protocol_query_mode query_mode; | ||
950 | - efi_status_t status; | ||
951 | - unsigned long m; | ||
952 | - | ||
953 | - m = gop64->mode; | ||
954 | - mode = (struct efi_graphics_output_protocol_mode_64 *)m; | ||
955 | - query_mode = (void *)(unsigned long)gop64->query_mode; | ||
956 | - | ||
957 | - status = __efi_call_early(query_mode, (void *)gop64, mode->mode, size, | ||
958 | - info); | ||
959 | - if (status != EFI_SUCCESS) | ||
960 | - return status; | ||
961 | |||
962 | - *fb_base = mode->frame_buffer_base; | ||
963 | - return status; | ||
964 | + return EFI_SUCCESS; | ||
965 | } | ||
966 | |||
967 | static efi_status_t | ||
968 | @@ -239,7 +194,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
969 | u64 fb_base; | ||
970 | struct efi_pixel_bitmask pixel_info; | ||
971 | int pixel_format; | ||
972 | - efi_status_t status = EFI_NOT_FOUND; | ||
973 | + efi_status_t status; | ||
974 | u64 *handles = (u64 *)(unsigned long)gop_handle; | ||
975 | int i; | ||
976 | |||
977 | @@ -248,6 +203,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
978 | |||
979 | nr_gops = size / sizeof(u64); | ||
980 | for (i = 0; i < nr_gops; i++) { | ||
981 | + struct efi_graphics_output_protocol_mode_64 *mode; | ||
982 | struct efi_graphics_output_mode_info *info = NULL; | ||
983 | efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID; | ||
984 | bool conout_found = false; | ||
985 | @@ -265,9 +221,11 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
986 | if (status == EFI_SUCCESS) | ||
987 | conout_found = true; | ||
988 | |||
989 | - status = __gop_query64(sys_table_arg, gop64, &info, &size, | ||
990 | - ¤t_fb_base); | ||
991 | - if (status == EFI_SUCCESS && (!first_gop || conout_found) && | ||
992 | + mode = (void *)(unsigned long)gop64->mode; | ||
993 | + info = (void *)(unsigned long)mode->info; | ||
994 | + current_fb_base = mode->frame_buffer_base; | ||
995 | + | ||
996 | + if ((!first_gop || conout_found) && | ||
997 | info->pixel_format != PIXEL_BLT_ONLY) { | ||
998 | /* | ||
999 | * Systems that use the UEFI Console Splitter may | ||
1000 | @@ -295,7 +253,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
1001 | |||
1002 | /* Did we find any GOPs? */ | ||
1003 | if (!first_gop) | ||
1004 | - goto out; | ||
1005 | + return EFI_NOT_FOUND; | ||
1006 | |||
1007 | /* EFI framebuffer */ | ||
1008 | si->orig_video_isVGA = VIDEO_TYPE_EFI; | ||
1009 | @@ -317,8 +275,8 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, | ||
1010 | si->lfb_size = si->lfb_linelength * si->lfb_height; | ||
1011 | |||
1012 | si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS; | ||
1013 | -out: | ||
1014 | - return status; | ||
1015 | + | ||
1016 | + return EFI_SUCCESS; | ||
1017 | } | ||
1018 | |||
1019 | /* | ||
1020 | diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c | ||
1021 | index 6008a30a17d0..58193c939691 100644 | ||
1022 | --- a/drivers/gpio/gpiolib.c | ||
1023 | +++ b/drivers/gpio/gpiolib.c | ||
1024 | @@ -188,6 +188,14 @@ int gpiod_get_direction(struct gpio_desc *desc) | ||
1025 | chip = gpiod_to_chip(desc); | ||
1026 | offset = gpio_chip_hwgpio(desc); | ||
1027 | |||
1028 | + /* | ||
1029 | + * Open drain emulation using input mode may incorrectly report | ||
1030 | + * input here, fix that up. | ||
1031 | + */ | ||
1032 | + if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) && | ||
1033 | + test_bit(FLAG_IS_OUT, &desc->flags)) | ||
1034 | + return 0; | ||
1035 | + | ||
1036 | if (!chip->get_direction) | ||
1037 | return status; | ||
1038 | |||
1039 | diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c | ||
1040 | index 4a959740058e..f68dcf5790ad 100644 | ||
1041 | --- a/drivers/gpu/drm/drm_dp_mst_topology.c | ||
1042 | +++ b/drivers/gpu/drm/drm_dp_mst_topology.c | ||
1043 | @@ -1536,7 +1536,11 @@ static void process_single_up_tx_qlock(struct drm_dp_mst_topology_mgr *mgr, | ||
1044 | if (ret != 1) | ||
1045 | DRM_DEBUG_KMS("failed to send msg in q %d\n", ret); | ||
1046 | |||
1047 | - txmsg->dst->tx_slots[txmsg->seqno] = NULL; | ||
1048 | + if (txmsg->seqno != -1) { | ||
1049 | + WARN_ON((unsigned int)txmsg->seqno > | ||
1050 | + ARRAY_SIZE(txmsg->dst->tx_slots)); | ||
1051 | + txmsg->dst->tx_slots[txmsg->seqno] = NULL; | ||
1052 | + } | ||
1053 | } | ||
1054 | |||
1055 | static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr, | ||
1056 | diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c | ||
1057 | index a4d81cf4ffa0..16c72d2ddc2e 100644 | ||
1058 | --- a/drivers/gpu/drm/drm_property.c | ||
1059 | +++ b/drivers/gpu/drm/drm_property.c | ||
1060 | @@ -554,7 +554,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, | ||
1061 | struct drm_property_blob *blob; | ||
1062 | int ret; | ||
1063 | |||
1064 | - if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob)) | ||
1065 | + if (!length || length > INT_MAX - sizeof(struct drm_property_blob)) | ||
1066 | return ERR_PTR(-EINVAL); | ||
1067 | |||
1068 | blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); | ||
1069 | diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c | ||
1070 | index dcfbf326f45c..27653aad8f21 100644 | ||
1071 | --- a/drivers/infiniband/core/cma.c | ||
1072 | +++ b/drivers/infiniband/core/cma.c | ||
1073 | @@ -4440,6 +4440,7 @@ err: | ||
1074 | unregister_netdevice_notifier(&cma_nb); | ||
1075 | rdma_addr_unregister_client(&addr_client); | ||
1076 | ib_sa_unregister_client(&sa_client); | ||
1077 | + unregister_pernet_subsys(&cma_pernet_operations); | ||
1078 | err_wq: | ||
1079 | destroy_workqueue(cma_wq); | ||
1080 | return ret; | ||
1081 | diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c | ||
1082 | index 7ccf7225f75a..adc46b809ef2 100644 | ||
1083 | --- a/drivers/infiniband/hw/mlx4/main.c | ||
1084 | +++ b/drivers/infiniband/hw/mlx4/main.c | ||
1085 | @@ -3031,16 +3031,17 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) | ||
1086 | ibdev->ib_active = false; | ||
1087 | flush_workqueue(wq); | ||
1088 | |||
1089 | - mlx4_ib_close_sriov(ibdev); | ||
1090 | - mlx4_ib_mad_cleanup(ibdev); | ||
1091 | - ib_unregister_device(&ibdev->ib_dev); | ||
1092 | - mlx4_ib_diag_cleanup(ibdev); | ||
1093 | if (ibdev->iboe.nb.notifier_call) { | ||
1094 | if (unregister_netdevice_notifier(&ibdev->iboe.nb)) | ||
1095 | pr_warn("failure unregistering notifier\n"); | ||
1096 | ibdev->iboe.nb.notifier_call = NULL; | ||
1097 | } | ||
1098 | |||
1099 | + mlx4_ib_close_sriov(ibdev); | ||
1100 | + mlx4_ib_mad_cleanup(ibdev); | ||
1101 | + ib_unregister_device(&ibdev->ib_dev); | ||
1102 | + mlx4_ib_diag_cleanup(ibdev); | ||
1103 | + | ||
1104 | mlx4_qp_release_range(dev, ibdev->steer_qpn_base, | ||
1105 | ibdev->steer_qpn_count); | ||
1106 | kfree(ibdev->ib_uc_qpns_bitmap); | ||
1107 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c | ||
1108 | index 9892c41de441..8a50da4f148f 100644 | ||
1109 | --- a/drivers/md/raid1.c | ||
1110 | +++ b/drivers/md/raid1.c | ||
1111 | @@ -2633,7 +2633,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, | ||
1112 | write_targets++; | ||
1113 | } | ||
1114 | } | ||
1115 | - if (bio->bi_end_io) { | ||
1116 | + if (rdev && bio->bi_end_io) { | ||
1117 | atomic_inc(&rdev->nr_pending); | ||
1118 | bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; | ||
1119 | bio->bi_bdev = rdev->bdev; | ||
1120 | diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c | ||
1121 | index 2594d6a7393f..78809bb5e69e 100644 | ||
1122 | --- a/drivers/media/usb/b2c2/flexcop-usb.c | ||
1123 | +++ b/drivers/media/usb/b2c2/flexcop-usb.c | ||
1124 | @@ -295,7 +295,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, | ||
1125 | |||
1126 | mutex_unlock(&fc_usb->data_mutex); | ||
1127 | |||
1128 | - return 0; | ||
1129 | + return ret; | ||
1130 | } | ||
1131 | |||
1132 | /* actual bus specific access functions, | ||
1133 | diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c | ||
1134 | index 7853261906b1..e5d411007ae4 100644 | ||
1135 | --- a/drivers/media/usb/dvb-usb/af9005.c | ||
1136 | +++ b/drivers/media/usb/dvb-usb/af9005.c | ||
1137 | @@ -990,8 +990,9 @@ static int af9005_identify_state(struct usb_device *udev, | ||
1138 | else if (reply == 0x02) | ||
1139 | *cold = 0; | ||
1140 | else | ||
1141 | - return -EIO; | ||
1142 | - deb_info("Identify state cold = %d\n", *cold); | ||
1143 | + ret = -EIO; | ||
1144 | + if (!ret) | ||
1145 | + deb_info("Identify state cold = %d\n", *cold); | ||
1146 | |||
1147 | err: | ||
1148 | kfree(buf); | ||
1149 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | ||
1150 | index 2ec1c43270b7..bb36312c9696 100644 | ||
1151 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | ||
1152 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | ||
1153 | @@ -1112,7 +1112,7 @@ static inline u8 bnx2x_get_path_func_num(struct bnx2x *bp) | ||
1154 | for (i = 0; i < E1H_FUNC_MAX / 2; i++) { | ||
1155 | u32 func_config = | ||
1156 | MF_CFG_RD(bp, | ||
1157 | - func_mf_config[BP_PORT(bp) + 2 * i]. | ||
1158 | + func_mf_config[BP_PATH(bp) + 2 * i]. | ||
1159 | config); | ||
1160 | func_num += | ||
1161 | ((func_config & FUNC_MF_CFG_FUNC_HIDE) ? 0 : 1); | ||
1162 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | ||
1163 | index ce8a777b1e97..8d17d464c067 100644 | ||
1164 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | ||
1165 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | ||
1166 | @@ -9995,10 +9995,18 @@ static void bnx2x_recovery_failed(struct bnx2x *bp) | ||
1167 | */ | ||
1168 | static void bnx2x_parity_recover(struct bnx2x *bp) | ||
1169 | { | ||
1170 | - bool global = false; | ||
1171 | u32 error_recovered, error_unrecovered; | ||
1172 | - bool is_parity; | ||
1173 | + bool is_parity, global = false; | ||
1174 | +#ifdef CONFIG_BNX2X_SRIOV | ||
1175 | + int vf_idx; | ||
1176 | + | ||
1177 | + for (vf_idx = 0; vf_idx < bp->requested_nr_virtfn; vf_idx++) { | ||
1178 | + struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); | ||
1179 | |||
1180 | + if (vf) | ||
1181 | + vf->state = VF_LOST; | ||
1182 | + } | ||
1183 | +#endif | ||
1184 | DP(NETIF_MSG_HW, "Handling parity\n"); | ||
1185 | while (1) { | ||
1186 | switch (bp->recovery_state) { | ||
1187 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | ||
1188 | index 888d0b6632e8..7152a03e3607 100644 | ||
1189 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | ||
1190 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | ||
1191 | @@ -139,6 +139,7 @@ struct bnx2x_virtf { | ||
1192 | #define VF_ACQUIRED 1 /* VF acquired, but not initialized */ | ||
1193 | #define VF_ENABLED 2 /* VF Enabled */ | ||
1194 | #define VF_RESET 3 /* VF FLR'd, pending cleanup */ | ||
1195 | +#define VF_LOST 4 /* Recovery while VFs are loaded */ | ||
1196 | |||
1197 | bool flr_clnup_stage; /* true during flr cleanup */ | ||
1198 | |||
1199 | diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | ||
1200 | index c2d327d9dff0..27142fb195b6 100644 | ||
1201 | --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | ||
1202 | +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | ||
1203 | @@ -2095,6 +2095,18 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf, | ||
1204 | { | ||
1205 | int i; | ||
1206 | |||
1207 | + if (vf->state == VF_LOST) { | ||
1208 | + /* Just ack the FW and return if VFs are lost | ||
1209 | + * in case of parity error. VFs are supposed to be timedout | ||
1210 | + * on waiting for PF response. | ||
1211 | + */ | ||
1212 | + DP(BNX2X_MSG_IOV, | ||
1213 | + "VF 0x%x lost, not handling the request\n", vf->abs_vfid); | ||
1214 | + | ||
1215 | + storm_memset_vf_mbx_ack(bp, vf->abs_vfid); | ||
1216 | + return; | ||
1217 | + } | ||
1218 | + | ||
1219 | /* check if tlv type is known */ | ||
1220 | if (bnx2x_tlv_supported(mbx->first_tlv.tl.type)) { | ||
1221 | /* Lock the per vf op mutex and note the locker's identity. | ||
1222 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | ||
1223 | index 62ccbd47c1db..fc1fa0f9f338 100644 | ||
1224 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | ||
1225 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | ||
1226 | @@ -53,7 +53,7 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv) | ||
1227 | * rate, which then uses the auto-reparenting feature of the | ||
1228 | * clock driver, and enabling/disabling the clock. | ||
1229 | */ | ||
1230 | - if (gmac->interface == PHY_INTERFACE_MODE_RGMII) { | ||
1231 | + if (phy_interface_mode_is_rgmii(gmac->interface)) { | ||
1232 | clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE); | ||
1233 | clk_prepare_enable(gmac->tx_clk); | ||
1234 | gmac->clk_enabled = 1; | ||
1235 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
1236 | index 5ac48a594951..a2b7c685cbf1 100644 | ||
1237 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
1238 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | ||
1239 | @@ -55,7 +55,7 @@ | ||
1240 | #include <linux/of_mdio.h> | ||
1241 | #include "dwmac1000.h" | ||
1242 | |||
1243 | -#define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES) | ||
1244 | +#define STMMAC_ALIGN(x) ALIGN(ALIGN(x, SMP_CACHE_BYTES), 16) | ||
1245 | #define TSO_MAX_BUFF_SIZE (SZ_16K - 1) | ||
1246 | |||
1247 | /* Module parameters */ | ||
1248 | diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c | ||
1249 | index b1dcc7448b4f..854947b9db4e 100644 | ||
1250 | --- a/drivers/net/macvlan.c | ||
1251 | +++ b/drivers/net/macvlan.c | ||
1252 | @@ -234,7 +234,7 @@ static void macvlan_broadcast(struct sk_buff *skb, | ||
1253 | struct net_device *src, | ||
1254 | enum macvlan_mode mode) | ||
1255 | { | ||
1256 | - const struct ethhdr *eth = eth_hdr(skb); | ||
1257 | + const struct ethhdr *eth = skb_eth_hdr(skb); | ||
1258 | const struct macvlan_dev *vlan; | ||
1259 | struct sk_buff *nskb; | ||
1260 | unsigned int i; | ||
1261 | diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c | ||
1262 | index 96258e6a1920..8045cc401009 100644 | ||
1263 | --- a/drivers/net/usb/lan78xx.c | ||
1264 | +++ b/drivers/net/usb/lan78xx.c | ||
1265 | @@ -442,7 +442,7 @@ static int lan78xx_read_stats(struct lan78xx_net *dev, | ||
1266 | } | ||
1267 | } else { | ||
1268 | netdev_warn(dev->net, | ||
1269 | - "Failed to read stat ret = 0x%x", ret); | ||
1270 | + "Failed to read stat ret = %d", ret); | ||
1271 | } | ||
1272 | |||
1273 | kfree(stats); | ||
1274 | @@ -2407,11 +2407,6 @@ static int lan78xx_stop(struct net_device *net) | ||
1275 | return 0; | ||
1276 | } | ||
1277 | |||
1278 | -static int lan78xx_linearize(struct sk_buff *skb) | ||
1279 | -{ | ||
1280 | - return skb_linearize(skb); | ||
1281 | -} | ||
1282 | - | ||
1283 | static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, | ||
1284 | struct sk_buff *skb, gfp_t flags) | ||
1285 | { | ||
1286 | @@ -2422,8 +2417,10 @@ static struct sk_buff *lan78xx_tx_prep(struct lan78xx_net *dev, | ||
1287 | return NULL; | ||
1288 | } | ||
1289 | |||
1290 | - if (lan78xx_linearize(skb) < 0) | ||
1291 | + if (skb_linearize(skb)) { | ||
1292 | + dev_kfree_skb_any(skb); | ||
1293 | return NULL; | ||
1294 | + } | ||
1295 | |||
1296 | tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN_MASK_) | TX_CMD_A_FCS_; | ||
1297 | |||
1298 | diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c | ||
1299 | index 340bd98b8dbd..987bb1db8265 100644 | ||
1300 | --- a/drivers/net/vxlan.c | ||
1301 | +++ b/drivers/net/vxlan.c | ||
1302 | @@ -2104,7 +2104,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | ||
1303 | else if (info->key.tun_flags & TUNNEL_DONT_FRAGMENT) | ||
1304 | df = htons(IP_DF); | ||
1305 | |||
1306 | - tos = ip_tunnel_ecn_encap(tos, old_iph, skb); | ||
1307 | + tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); | ||
1308 | ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); | ||
1309 | err = vxlan_build_skb(skb, &rt->dst, sizeof(struct iphdr), | ||
1310 | vni, md, flags, udp_sum); | ||
1311 | @@ -2163,7 +2163,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | ||
1312 | if (!info) | ||
1313 | udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); | ||
1314 | |||
1315 | - tos = ip_tunnel_ecn_encap(tos, old_iph, skb); | ||
1316 | + tos = ip_tunnel_ecn_encap(RT_TOS(tos), old_iph, skb); | ||
1317 | ttl = ttl ? : ip6_dst_hoplimit(ndst); | ||
1318 | skb_scrub_packet(skb, xnet); | ||
1319 | err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr), | ||
1320 | diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
1321 | index f333ef1e3e7b..52b42ecee621 100644 | ||
1322 | --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
1323 | +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | ||
1324 | @@ -972,6 +972,8 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | ||
1325 | struct ath_htc_rx_status *rxstatus; | ||
1326 | struct ath_rx_status rx_stats; | ||
1327 | bool decrypt_error = false; | ||
1328 | + __be16 rs_datalen; | ||
1329 | + bool is_phyerr; | ||
1330 | |||
1331 | if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { | ||
1332 | ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", | ||
1333 | @@ -981,11 +983,24 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | ||
1334 | |||
1335 | rxstatus = (struct ath_htc_rx_status *)skb->data; | ||
1336 | |||
1337 | - if (be16_to_cpu(rxstatus->rs_datalen) - | ||
1338 | - (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) { | ||
1339 | + rs_datalen = be16_to_cpu(rxstatus->rs_datalen); | ||
1340 | + if (unlikely(rs_datalen - | ||
1341 | + (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0)) { | ||
1342 | ath_err(common, | ||
1343 | "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n", | ||
1344 | - rxstatus->rs_datalen, skb->len); | ||
1345 | + rs_datalen, skb->len); | ||
1346 | + goto rx_next; | ||
1347 | + } | ||
1348 | + | ||
1349 | + is_phyerr = rxstatus->rs_status & ATH9K_RXERR_PHY; | ||
1350 | + /* | ||
1351 | + * Discard zero-length packets and packets smaller than an ACK | ||
1352 | + * which are not PHY_ERROR (short radar pulses have a length of 3) | ||
1353 | + */ | ||
1354 | + if (unlikely(!rs_datalen || (rs_datalen < 10 && !is_phyerr))) { | ||
1355 | + ath_warn(common, | ||
1356 | + "Short RX data len, dropping (dlen: %d)\n", | ||
1357 | + rs_datalen); | ||
1358 | goto rx_next; | ||
1359 | } | ||
1360 | |||
1361 | @@ -1010,7 +1025,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | ||
1362 | * Process PHY errors and return so that the packet | ||
1363 | * can be dropped. | ||
1364 | */ | ||
1365 | - if (rx_stats.rs_status & ATH9K_RXERR_PHY) { | ||
1366 | + if (unlikely(is_phyerr)) { | ||
1367 | /* TODO: Not using DFS processing now. */ | ||
1368 | if (ath_cmn_process_fft(&priv->spec_priv, hdr, | ||
1369 | &rx_stats, rx_status->mactime)) { | ||
1370 | diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c | ||
1371 | index 0f97514e3474..c9f20e1394e3 100644 | ||
1372 | --- a/drivers/regulator/ab8500.c | ||
1373 | +++ b/drivers/regulator/ab8500.c | ||
1374 | @@ -1099,23 +1099,6 @@ static struct ab8500_regulator_info | ||
1375 | .update_val_idle = 0x82, | ||
1376 | .update_val_normal = 0x02, | ||
1377 | }, | ||
1378 | - [AB8505_LDO_USB] = { | ||
1379 | - .desc = { | ||
1380 | - .name = "LDO-USB", | ||
1381 | - .ops = &ab8500_regulator_mode_ops, | ||
1382 | - .type = REGULATOR_VOLTAGE, | ||
1383 | - .id = AB8505_LDO_USB, | ||
1384 | - .owner = THIS_MODULE, | ||
1385 | - .n_voltages = 1, | ||
1386 | - .volt_table = fixed_3300000_voltage, | ||
1387 | - }, | ||
1388 | - .update_bank = 0x03, | ||
1389 | - .update_reg = 0x82, | ||
1390 | - .update_mask = 0x03, | ||
1391 | - .update_val = 0x01, | ||
1392 | - .update_val_idle = 0x03, | ||
1393 | - .update_val_normal = 0x01, | ||
1394 | - }, | ||
1395 | [AB8505_LDO_AUDIO] = { | ||
1396 | .desc = { | ||
1397 | .name = "LDO-AUDIO", | ||
1398 | diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c | ||
1399 | index 9c930eb68cda..ffc34e1ee35d 100644 | ||
1400 | --- a/drivers/regulator/rn5t618-regulator.c | ||
1401 | +++ b/drivers/regulator/rn5t618-regulator.c | ||
1402 | @@ -127,6 +127,7 @@ static struct platform_driver rn5t618_regulator_driver = { | ||
1403 | |||
1404 | module_platform_driver(rn5t618_regulator_driver); | ||
1405 | |||
1406 | +MODULE_ALIAS("platform:rn5t618-regulator"); | ||
1407 | MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>"); | ||
1408 | MODULE_DESCRIPTION("RN5T618 regulator driver"); | ||
1409 | MODULE_LICENSE("GPL v2"); | ||
1410 | diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c | ||
1411 | index 60de66252fa2..b200edc665a5 100644 | ||
1412 | --- a/drivers/scsi/libsas/sas_discover.c | ||
1413 | +++ b/drivers/scsi/libsas/sas_discover.c | ||
1414 | @@ -97,12 +97,21 @@ static int sas_get_port_device(struct asd_sas_port *port) | ||
1415 | else | ||
1416 | dev->dev_type = SAS_SATA_DEV; | ||
1417 | dev->tproto = SAS_PROTOCOL_SATA; | ||
1418 | - } else { | ||
1419 | + } else if (port->oob_mode == SAS_OOB_MODE) { | ||
1420 | struct sas_identify_frame *id = | ||
1421 | (struct sas_identify_frame *) dev->frame_rcvd; | ||
1422 | dev->dev_type = id->dev_type; | ||
1423 | dev->iproto = id->initiator_bits; | ||
1424 | dev->tproto = id->target_bits; | ||
1425 | + } else { | ||
1426 | + /* If the oob mode is OOB_NOT_CONNECTED, the port is | ||
1427 | + * disconnected due to race with PHY down. We cannot | ||
1428 | + * continue to discover this port | ||
1429 | + */ | ||
1430 | + sas_put_device(dev); | ||
1431 | + pr_warn("Port %016llx is disconnected when discovering\n", | ||
1432 | + SAS_ADDR(port->attached_sas_addr)); | ||
1433 | + return -ENODEV; | ||
1434 | } | ||
1435 | |||
1436 | sas_init_dev(dev); | ||
1437 | diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c | ||
1438 | index 05dcc2abd541..99f06ac7bf4c 100644 | ||
1439 | --- a/drivers/scsi/lpfc/lpfc_bsg.c | ||
1440 | +++ b/drivers/scsi/lpfc/lpfc_bsg.c | ||
1441 | @@ -4352,12 +4352,6 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job, | ||
1442 | phba->mbox_ext_buf_ctx.seqNum++; | ||
1443 | nemb_tp = phba->mbox_ext_buf_ctx.nembType; | ||
1444 | |||
1445 | - dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL); | ||
1446 | - if (!dd_data) { | ||
1447 | - rc = -ENOMEM; | ||
1448 | - goto job_error; | ||
1449 | - } | ||
1450 | - | ||
1451 | pbuf = (uint8_t *)dmabuf->virt; | ||
1452 | size = job->request_payload.payload_len; | ||
1453 | sg_copy_to_buffer(job->request_payload.sg_list, | ||
1454 | @@ -4394,6 +4388,13 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job, | ||
1455 | "2968 SLI_CONFIG ext-buffer wr all %d " | ||
1456 | "ebuffers received\n", | ||
1457 | phba->mbox_ext_buf_ctx.numBuf); | ||
1458 | + | ||
1459 | + dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL); | ||
1460 | + if (!dd_data) { | ||
1461 | + rc = -ENOMEM; | ||
1462 | + goto job_error; | ||
1463 | + } | ||
1464 | + | ||
1465 | /* mailbox command structure for base driver */ | ||
1466 | pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
1467 | if (!pmboxq) { | ||
1468 | @@ -4441,6 +4442,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job, | ||
1469 | return SLI_CONFIG_HANDLED; | ||
1470 | |||
1471 | job_error: | ||
1472 | + if (pmboxq) | ||
1473 | + mempool_free(pmboxq, phba->mbox_mem_pool); | ||
1474 | lpfc_bsg_dma_page_free(phba, dmabuf); | ||
1475 | kfree(dd_data); | ||
1476 | |||
1477 | diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c | ||
1478 | index f0fcff032f8a..17b1525d492b 100644 | ||
1479 | --- a/drivers/scsi/qla2xxx/qla_isr.c | ||
1480 | +++ b/drivers/scsi/qla2xxx/qla_isr.c | ||
1481 | @@ -973,8 +973,6 @@ global_port_update: | ||
1482 | ql_dbg(ql_dbg_async, vha, 0x5011, | ||
1483 | "Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n", | ||
1484 | mb[1], mb[2], mb[3]); | ||
1485 | - | ||
1486 | - qlt_async_event(mb[0], vha, mb); | ||
1487 | break; | ||
1488 | } | ||
1489 | |||
1490 | @@ -995,8 +993,6 @@ global_port_update: | ||
1491 | set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); | ||
1492 | set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); | ||
1493 | set_bit(VP_CONFIG_OK, &vha->vp_flags); | ||
1494 | - | ||
1495 | - qlt_async_event(mb[0], vha, mb); | ||
1496 | break; | ||
1497 | |||
1498 | case MBA_RSCN_UPDATE: /* State Change Registration */ | ||
1499 | diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c | ||
1500 | index d220b4f691c7..f714d5f917d1 100644 | ||
1501 | --- a/drivers/scsi/qla4xxx/ql4_os.c | ||
1502 | +++ b/drivers/scsi/qla4xxx/ql4_os.c | ||
1503 | @@ -4285,7 +4285,6 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha) | ||
1504 | return QLA_SUCCESS; | ||
1505 | |||
1506 | mem_alloc_error_exit: | ||
1507 | - qla4xxx_mem_free(ha); | ||
1508 | return QLA_ERROR; | ||
1509 | } | ||
1510 | |||
1511 | diff --git a/drivers/spi/spi-cavium-thunderx.c b/drivers/spi/spi-cavium-thunderx.c | ||
1512 | index 877937706240..828fbbebc3c4 100644 | ||
1513 | --- a/drivers/spi/spi-cavium-thunderx.c | ||
1514 | +++ b/drivers/spi/spi-cavium-thunderx.c | ||
1515 | @@ -81,6 +81,7 @@ static int thunderx_spi_probe(struct pci_dev *pdev, | ||
1516 | |||
1517 | error: | ||
1518 | clk_disable_unprepare(p->clk); | ||
1519 | + pci_release_regions(pdev); | ||
1520 | spi_master_put(master); | ||
1521 | return ret; | ||
1522 | } | ||
1523 | @@ -95,6 +96,7 @@ static void thunderx_spi_remove(struct pci_dev *pdev) | ||
1524 | return; | ||
1525 | |||
1526 | clk_disable_unprepare(p->clk); | ||
1527 | + pci_release_regions(pdev); | ||
1528 | /* Put everything in a known state. */ | ||
1529 | writeq(0, p->register_base + OCTEON_SPI_CFG(p)); | ||
1530 | } | ||
1531 | diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c | ||
1532 | index b05dc5086627..8bab8b00d47d 100644 | ||
1533 | --- a/drivers/tty/hvc/hvc_vio.c | ||
1534 | +++ b/drivers/tty/hvc/hvc_vio.c | ||
1535 | @@ -120,6 +120,14 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count) | ||
1536 | return got; | ||
1537 | } | ||
1538 | |||
1539 | +/** | ||
1540 | + * hvterm_raw_put_chars: send characters to firmware for given vterm adapter | ||
1541 | + * @vtermno: The virtual terminal number. | ||
1542 | + * @buf: The characters to send. Because of the underlying hypercall in | ||
1543 | + * hvc_put_chars(), this buffer must be at least 16 bytes long, even if | ||
1544 | + * you are sending fewer chars. | ||
1545 | + * @count: number of chars to send. | ||
1546 | + */ | ||
1547 | static int hvterm_raw_put_chars(uint32_t vtermno, const char *buf, int count) | ||
1548 | { | ||
1549 | struct hvterm_priv *pv = hvterm_privs[vtermno]; | ||
1550 | @@ -232,6 +240,7 @@ static const struct hv_ops hvterm_hvsi_ops = { | ||
1551 | static void udbg_hvc_putc(char c) | ||
1552 | { | ||
1553 | int count = -1; | ||
1554 | + unsigned char bounce_buffer[16]; | ||
1555 | |||
1556 | if (!hvterm_privs[0]) | ||
1557 | return; | ||
1558 | @@ -242,7 +251,12 @@ static void udbg_hvc_putc(char c) | ||
1559 | do { | ||
1560 | switch(hvterm_privs[0]->proto) { | ||
1561 | case HV_PROTOCOL_RAW: | ||
1562 | - count = hvterm_raw_put_chars(0, &c, 1); | ||
1563 | + /* | ||
1564 | + * hvterm_raw_put_chars requires at least a 16-byte | ||
1565 | + * buffer, so go via the bounce buffer | ||
1566 | + */ | ||
1567 | + bounce_buffer[0] = c; | ||
1568 | + count = hvterm_raw_put_chars(0, bounce_buffer, 1); | ||
1569 | break; | ||
1570 | case HV_PROTOCOL_HVSI: | ||
1571 | count = hvterm_hvsi_put_chars(0, &c, 1); | ||
1572 | diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c | ||
1573 | index 2ed219c837c9..9e6d44df3fab 100644 | ||
1574 | --- a/drivers/tty/serial/msm_serial.c | ||
1575 | +++ b/drivers/tty/serial/msm_serial.c | ||
1576 | @@ -1579,6 +1579,7 @@ static void __msm_console_write(struct uart_port *port, const char *s, | ||
1577 | int num_newlines = 0; | ||
1578 | bool replaced = false; | ||
1579 | void __iomem *tf; | ||
1580 | + int locked = 1; | ||
1581 | |||
1582 | if (is_uartdm) | ||
1583 | tf = port->membase + UARTDM_TF; | ||
1584 | @@ -1591,7 +1592,13 @@ static void __msm_console_write(struct uart_port *port, const char *s, | ||
1585 | num_newlines++; | ||
1586 | count += num_newlines; | ||
1587 | |||
1588 | - spin_lock(&port->lock); | ||
1589 | + if (port->sysrq) | ||
1590 | + locked = 0; | ||
1591 | + else if (oops_in_progress) | ||
1592 | + locked = spin_trylock(&port->lock); | ||
1593 | + else | ||
1594 | + spin_lock(&port->lock); | ||
1595 | + | ||
1596 | if (is_uartdm) | ||
1597 | msm_reset_dm_count(port, count); | ||
1598 | |||
1599 | @@ -1627,7 +1634,9 @@ static void __msm_console_write(struct uart_port *port, const char *s, | ||
1600 | iowrite32_rep(tf, buf, 1); | ||
1601 | i += num_chars; | ||
1602 | } | ||
1603 | - spin_unlock(&port->lock); | ||
1604 | + | ||
1605 | + if (locked) | ||
1606 | + spin_unlock(&port->lock); | ||
1607 | } | ||
1608 | |||
1609 | static void msm_console_write(struct console *co, const char *s, | ||
1610 | diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c | ||
1611 | index e8061b02b7e3..32f5ccd5f2c7 100644 | ||
1612 | --- a/drivers/usb/core/config.c | ||
1613 | +++ b/drivers/usb/core/config.c | ||
1614 | @@ -198,9 +198,58 @@ static const unsigned short super_speed_maxpacket_maxes[4] = { | ||
1615 | [USB_ENDPOINT_XFER_INT] = 1024, | ||
1616 | }; | ||
1617 | |||
1618 | -static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | ||
1619 | - int asnum, struct usb_host_interface *ifp, int num_ep, | ||
1620 | - unsigned char *buffer, int size) | ||
1621 | +static bool endpoint_is_duplicate(struct usb_endpoint_descriptor *e1, | ||
1622 | + struct usb_endpoint_descriptor *e2) | ||
1623 | +{ | ||
1624 | + if (e1->bEndpointAddress == e2->bEndpointAddress) | ||
1625 | + return true; | ||
1626 | + | ||
1627 | + if (usb_endpoint_xfer_control(e1) || usb_endpoint_xfer_control(e2)) { | ||
1628 | + if (usb_endpoint_num(e1) == usb_endpoint_num(e2)) | ||
1629 | + return true; | ||
1630 | + } | ||
1631 | + | ||
1632 | + return false; | ||
1633 | +} | ||
1634 | + | ||
1635 | +/* | ||
1636 | + * Check for duplicate endpoint addresses in other interfaces and in the | ||
1637 | + * altsetting currently being parsed. | ||
1638 | + */ | ||
1639 | +static bool config_endpoint_is_duplicate(struct usb_host_config *config, | ||
1640 | + int inum, int asnum, struct usb_endpoint_descriptor *d) | ||
1641 | +{ | ||
1642 | + struct usb_endpoint_descriptor *epd; | ||
1643 | + struct usb_interface_cache *intfc; | ||
1644 | + struct usb_host_interface *alt; | ||
1645 | + int i, j, k; | ||
1646 | + | ||
1647 | + for (i = 0; i < config->desc.bNumInterfaces; ++i) { | ||
1648 | + intfc = config->intf_cache[i]; | ||
1649 | + | ||
1650 | + for (j = 0; j < intfc->num_altsetting; ++j) { | ||
1651 | + alt = &intfc->altsetting[j]; | ||
1652 | + | ||
1653 | + if (alt->desc.bInterfaceNumber == inum && | ||
1654 | + alt->desc.bAlternateSetting != asnum) | ||
1655 | + continue; | ||
1656 | + | ||
1657 | + for (k = 0; k < alt->desc.bNumEndpoints; ++k) { | ||
1658 | + epd = &alt->endpoint[k].desc; | ||
1659 | + | ||
1660 | + if (endpoint_is_duplicate(epd, d)) | ||
1661 | + return true; | ||
1662 | + } | ||
1663 | + } | ||
1664 | + } | ||
1665 | + | ||
1666 | + return false; | ||
1667 | +} | ||
1668 | + | ||
1669 | +static int usb_parse_endpoint(struct device *ddev, int cfgno, | ||
1670 | + struct usb_host_config *config, int inum, int asnum, | ||
1671 | + struct usb_host_interface *ifp, int num_ep, | ||
1672 | + unsigned char *buffer, int size) | ||
1673 | { | ||
1674 | unsigned char *buffer0 = buffer; | ||
1675 | struct usb_endpoint_descriptor *d; | ||
1676 | @@ -237,13 +286,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | ||
1677 | goto skip_to_next_endpoint_or_interface_descriptor; | ||
1678 | |||
1679 | /* Check for duplicate endpoint addresses */ | ||
1680 | - for (i = 0; i < ifp->desc.bNumEndpoints; ++i) { | ||
1681 | - if (ifp->endpoint[i].desc.bEndpointAddress == | ||
1682 | - d->bEndpointAddress) { | ||
1683 | - dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", | ||
1684 | - cfgno, inum, asnum, d->bEndpointAddress); | ||
1685 | - goto skip_to_next_endpoint_or_interface_descriptor; | ||
1686 | - } | ||
1687 | + if (config_endpoint_is_duplicate(config, inum, asnum, d)) { | ||
1688 | + dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", | ||
1689 | + cfgno, inum, asnum, d->bEndpointAddress); | ||
1690 | + goto skip_to_next_endpoint_or_interface_descriptor; | ||
1691 | } | ||
1692 | |||
1693 | endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; | ||
1694 | @@ -517,8 +563,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, | ||
1695 | if (((struct usb_descriptor_header *) buffer)->bDescriptorType | ||
1696 | == USB_DT_INTERFACE) | ||
1697 | break; | ||
1698 | - retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt, | ||
1699 | - num_ep, buffer, size); | ||
1700 | + retval = usb_parse_endpoint(ddev, cfgno, config, inum, asnum, | ||
1701 | + alt, num_ep, buffer, size); | ||
1702 | if (retval < 0) | ||
1703 | return retval; | ||
1704 | ++n; | ||
1705 | diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c | ||
1706 | index 4c488d15b6f6..dc99ed94f03d 100644 | ||
1707 | --- a/drivers/usb/gadget/function/f_ecm.c | ||
1708 | +++ b/drivers/usb/gadget/function/f_ecm.c | ||
1709 | @@ -625,8 +625,12 @@ static void ecm_disable(struct usb_function *f) | ||
1710 | |||
1711 | DBG(cdev, "ecm deactivated\n"); | ||
1712 | |||
1713 | - if (ecm->port.in_ep->enabled) | ||
1714 | + if (ecm->port.in_ep->enabled) { | ||
1715 | gether_disconnect(&ecm->port); | ||
1716 | + } else { | ||
1717 | + ecm->port.in_ep->desc = NULL; | ||
1718 | + ecm->port.out_ep->desc = NULL; | ||
1719 | + } | ||
1720 | |||
1721 | usb_ep_disable(ecm->notify); | ||
1722 | ecm->notify->desc = NULL; | ||
1723 | diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c | ||
1724 | index ba00cdb809d6..865cb070bf8b 100644 | ||
1725 | --- a/drivers/usb/gadget/function/f_rndis.c | ||
1726 | +++ b/drivers/usb/gadget/function/f_rndis.c | ||
1727 | @@ -622,6 +622,7 @@ static void rndis_disable(struct usb_function *f) | ||
1728 | gether_disconnect(&rndis->port); | ||
1729 | |||
1730 | usb_ep_disable(rndis->notify); | ||
1731 | + rndis->notify->desc = NULL; | ||
1732 | } | ||
1733 | |||
1734 | /*-------------------------------------------------------------------------*/ | ||
1735 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
1736 | index 084332a5855e..2d302ff62cc1 100644 | ||
1737 | --- a/drivers/usb/serial/option.c | ||
1738 | +++ b/drivers/usb/serial/option.c | ||
1739 | @@ -1167,6 +1167,8 @@ static const struct usb_device_id option_ids[] = { | ||
1740 | .driver_info = NCTRL(0) | RSVD(3) }, | ||
1741 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */ | ||
1742 | .driver_info = NCTRL(0) }, | ||
1743 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */ | ||
1744 | + .driver_info = NCTRL(0) | RSVD(3) }, | ||
1745 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), | ||
1746 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, | ||
1747 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), | ||
1748 | diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c | ||
1749 | index 731cf54f75c6..05f9f5983ee1 100644 | ||
1750 | --- a/drivers/xen/balloon.c | ||
1751 | +++ b/drivers/xen/balloon.c | ||
1752 | @@ -403,7 +403,8 @@ static struct notifier_block xen_memory_nb = { | ||
1753 | #else | ||
1754 | static enum bp_state reserve_additional_memory(void) | ||
1755 | { | ||
1756 | - balloon_stats.target_pages = balloon_stats.current_pages; | ||
1757 | + balloon_stats.target_pages = balloon_stats.current_pages + | ||
1758 | + balloon_stats.target_unpopulated; | ||
1759 | return BP_ECANCELED; | ||
1760 | } | ||
1761 | #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */ | ||
1762 | diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c | ||
1763 | index 5b832e83772a..02ac9067a354 100644 | ||
1764 | --- a/fs/compat_ioctl.c | ||
1765 | +++ b/fs/compat_ioctl.c | ||
1766 | @@ -1585,9 +1585,10 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, | ||
1767 | #endif | ||
1768 | |||
1769 | case FICLONE: | ||
1770 | + goto do_ioctl; | ||
1771 | case FICLONERANGE: | ||
1772 | case FIDEDUPERANGE: | ||
1773 | - goto do_ioctl; | ||
1774 | + goto found_handler; | ||
1775 | |||
1776 | case FIBMAP: | ||
1777 | case FIGETBSZ: | ||
1778 | diff --git a/fs/locks.c b/fs/locks.c | ||
1779 | index 22c5b4aa4961..8252647c6084 100644 | ||
1780 | --- a/fs/locks.c | ||
1781 | +++ b/fs/locks.c | ||
1782 | @@ -2681,7 +2681,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, | ||
1783 | } | ||
1784 | if (inode) { | ||
1785 | /* userspace relies on this representation of dev_t */ | ||
1786 | - seq_printf(f, "%d %02x:%02x:%ld ", fl_pid, | ||
1787 | + seq_printf(f, "%d %02x:%02x:%lu ", fl_pid, | ||
1788 | MAJOR(inode->i_sb->s_dev), | ||
1789 | MINOR(inode->i_sb->s_dev), inode->i_ino); | ||
1790 | } else { | ||
1791 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c | ||
1792 | index 032fcae3a94f..db4bd70b62d0 100644 | ||
1793 | --- a/fs/nfsd/nfs4state.c | ||
1794 | +++ b/fs/nfsd/nfs4state.c | ||
1795 | @@ -3067,12 +3067,17 @@ static bool replay_matches_cache(struct svc_rqst *rqstp, | ||
1796 | (bool)seq->cachethis) | ||
1797 | return false; | ||
1798 | /* | ||
1799 | - * If there's an error than the reply can have fewer ops than | ||
1800 | - * the call. But if we cached a reply with *more* ops than the | ||
1801 | - * call you're sending us now, then this new call is clearly not | ||
1802 | - * really a replay of the old one: | ||
1803 | + * If there's an error then the reply can have fewer ops than | ||
1804 | + * the call. | ||
1805 | */ | ||
1806 | - if (slot->sl_opcnt < argp->opcnt) | ||
1807 | + if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) | ||
1808 | + return false; | ||
1809 | + /* | ||
1810 | + * But if we cached a reply with *more* ops than the call you're | ||
1811 | + * sending us now, then this new call is clearly not really a | ||
1812 | + * replay of the old one: | ||
1813 | + */ | ||
1814 | + if (slot->sl_opcnt > argp->opcnt) | ||
1815 | return false; | ||
1816 | /* This is the only check explicitly called by spec: */ | ||
1817 | if (!same_creds(&rqstp->rq_cred, &slot->sl_cred)) | ||
1818 | diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c | ||
1819 | index 8b09271e5d66..a73959e6ae32 100644 | ||
1820 | --- a/fs/pstore/ram.c | ||
1821 | +++ b/fs/pstore/ram.c | ||
1822 | @@ -321,6 +321,17 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type, | ||
1823 | |||
1824 | prz = cxt->przs[cxt->dump_write_cnt]; | ||
1825 | |||
1826 | + /* | ||
1827 | + * Since this is a new crash dump, we need to reset the buffer in | ||
1828 | + * case it still has an old dump present. Without this, the new dump | ||
1829 | + * will get appended, which would seriously confuse anything trying | ||
1830 | + * to check dump file contents. Specifically, ramoops_read_kmsg_hdr() | ||
1831 | + * expects to find a dump header in the beginning of buffer data, so | ||
1832 | + * we must to reset the buffer values, in order to ensure that the | ||
1833 | + * header will be written to the beginning of the buffer. | ||
1834 | + */ | ||
1835 | + persistent_ram_zap(prz); | ||
1836 | + | ||
1837 | hlen = ramoops_write_kmsg_hdr(prz, compressed); | ||
1838 | if (size + hlen > prz->buffer_size) | ||
1839 | size = prz->buffer_size - hlen; | ||
1840 | diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c | ||
1841 | index d34085bf4a40..9ca8809ee3d0 100644 | ||
1842 | --- a/fs/xfs/libxfs/xfs_bmap.c | ||
1843 | +++ b/fs/xfs/libxfs/xfs_bmap.c | ||
1844 | @@ -5688,7 +5688,7 @@ __xfs_bunmapi( | ||
1845 | * Make sure we don't touch multiple AGF headers out of order | ||
1846 | * in a single transaction, as that could cause AB-BA deadlocks. | ||
1847 | */ | ||
1848 | - if (!wasdel) { | ||
1849 | + if (!wasdel && !isrt) { | ||
1850 | agno = XFS_FSB_TO_AGNO(mp, del.br_startblock); | ||
1851 | if (prev_agno != NULLAGNUMBER && prev_agno > agno) | ||
1852 | break; | ||
1853 | diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c | ||
1854 | index 33c9a3aae948..7bfcd09d446b 100644 | ||
1855 | --- a/fs/xfs/xfs_log.c | ||
1856 | +++ b/fs/xfs/xfs_log.c | ||
1857 | @@ -1540,6 +1540,8 @@ out_free_iclog: | ||
1858 | if (iclog->ic_bp) | ||
1859 | xfs_buf_free(iclog->ic_bp); | ||
1860 | kmem_free(iclog); | ||
1861 | + if (prev_iclog == log->l_iclog) | ||
1862 | + break; | ||
1863 | } | ||
1864 | spinlock_destroy(&log->l_icloglock); | ||
1865 | xfs_buf_free(log->l_xbuf); | ||
1866 | diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h | ||
1867 | index a270f25ee7c7..1a527e40d601 100644 | ||
1868 | --- a/include/linux/ahci_platform.h | ||
1869 | +++ b/include/linux/ahci_platform.h | ||
1870 | @@ -23,6 +23,8 @@ struct ahci_host_priv; | ||
1871 | struct platform_device; | ||
1872 | struct scsi_host_template; | ||
1873 | |||
1874 | +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv); | ||
1875 | +void ahci_platform_disable_phys(struct ahci_host_priv *hpriv); | ||
1876 | int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); | ||
1877 | void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); | ||
1878 | int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv); | ||
1879 | diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h | ||
1880 | index cc535a478bae..710f269764dc 100644 | ||
1881 | --- a/include/linux/dmaengine.h | ||
1882 | +++ b/include/linux/dmaengine.h | ||
1883 | @@ -1358,8 +1358,11 @@ static inline int dma_get_slave_caps(struct dma_chan *chan, | ||
1884 | static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx) | ||
1885 | { | ||
1886 | struct dma_slave_caps caps; | ||
1887 | + int ret; | ||
1888 | |||
1889 | - dma_get_slave_caps(tx->chan, &caps); | ||
1890 | + ret = dma_get_slave_caps(tx->chan, &caps); | ||
1891 | + if (ret) | ||
1892 | + return ret; | ||
1893 | |||
1894 | if (caps.descriptor_reuse) { | ||
1895 | tx->flags |= DMA_CTRL_REUSE; | ||
1896 | diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h | ||
1897 | index 548fd535fd02..d433f5e292c9 100644 | ||
1898 | --- a/include/linux/if_ether.h | ||
1899 | +++ b/include/linux/if_ether.h | ||
1900 | @@ -28,6 +28,14 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) | ||
1901 | return (struct ethhdr *)skb_mac_header(skb); | ||
1902 | } | ||
1903 | |||
1904 | +/* Prefer this version in TX path, instead of | ||
1905 | + * skb_reset_mac_header() + eth_hdr() | ||
1906 | + */ | ||
1907 | +static inline struct ethhdr *skb_eth_hdr(const struct sk_buff *skb) | ||
1908 | +{ | ||
1909 | + return (struct ethhdr *)skb->data; | ||
1910 | +} | ||
1911 | + | ||
1912 | static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb) | ||
1913 | { | ||
1914 | return (struct ethhdr *)skb_inner_mac_header(skb); | ||
1915 | diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h | ||
1916 | index d8ecefaf63ca..260c4aa1d976 100644 | ||
1917 | --- a/include/linux/regulator/ab8500.h | ||
1918 | +++ b/include/linux/regulator/ab8500.h | ||
1919 | @@ -38,7 +38,6 @@ enum ab8505_regulator_id { | ||
1920 | AB8505_LDO_AUX6, | ||
1921 | AB8505_LDO_INTCORE, | ||
1922 | AB8505_LDO_ADC, | ||
1923 | - AB8505_LDO_USB, | ||
1924 | AB8505_LDO_AUDIO, | ||
1925 | AB8505_LDO_ANAMIC1, | ||
1926 | AB8505_LDO_ANAMIC2, | ||
1927 | diff --git a/include/net/neighbour.h b/include/net/neighbour.h | ||
1928 | index 1c0d07376125..a68a460fa4f3 100644 | ||
1929 | --- a/include/net/neighbour.h | ||
1930 | +++ b/include/net/neighbour.h | ||
1931 | @@ -454,7 +454,7 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb | ||
1932 | |||
1933 | do { | ||
1934 | seq = read_seqbegin(&hh->hh_lock); | ||
1935 | - hh_len = hh->hh_len; | ||
1936 | + hh_len = READ_ONCE(hh->hh_len); | ||
1937 | if (likely(hh_len <= HH_DATA_MOD)) { | ||
1938 | hh_alen = HH_DATA_MOD; | ||
1939 | |||
1940 | diff --git a/include/uapi/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h | ||
1941 | index 58ffcfb7978e..c2b0886c7c25 100644 | ||
1942 | --- a/include/uapi/linux/netfilter/xt_sctp.h | ||
1943 | +++ b/include/uapi/linux/netfilter/xt_sctp.h | ||
1944 | @@ -40,19 +40,19 @@ struct xt_sctp_info { | ||
1945 | #define SCTP_CHUNKMAP_SET(chunkmap, type) \ | ||
1946 | do { \ | ||
1947 | (chunkmap)[type / bytes(__u32)] |= \ | ||
1948 | - 1 << (type % bytes(__u32)); \ | ||
1949 | + 1u << (type % bytes(__u32)); \ | ||
1950 | } while (0) | ||
1951 | |||
1952 | #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ | ||
1953 | do { \ | ||
1954 | (chunkmap)[type / bytes(__u32)] &= \ | ||
1955 | - ~(1 << (type % bytes(__u32))); \ | ||
1956 | + ~(1u << (type % bytes(__u32))); \ | ||
1957 | } while (0) | ||
1958 | |||
1959 | #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ | ||
1960 | ({ \ | ||
1961 | ((chunkmap)[type / bytes (__u32)] & \ | ||
1962 | - (1 << (type % bytes (__u32)))) ? 1: 0; \ | ||
1963 | + (1u << (type % bytes (__u32)))) ? 1: 0; \ | ||
1964 | }) | ||
1965 | |||
1966 | #define SCTP_CHUNKMAP_RESET(chunkmap) \ | ||
1967 | diff --git a/kernel/cred.c b/kernel/cred.c | ||
1968 | index 0966fab0f48b..d63a2d861ac2 100644 | ||
1969 | --- a/kernel/cred.c | ||
1970 | +++ b/kernel/cred.c | ||
1971 | @@ -219,7 +219,7 @@ struct cred *cred_alloc_blank(void) | ||
1972 | new->magic = CRED_MAGIC; | ||
1973 | #endif | ||
1974 | |||
1975 | - if (security_cred_alloc_blank(new, GFP_KERNEL) < 0) | ||
1976 | + if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) | ||
1977 | goto error; | ||
1978 | |||
1979 | return new; | ||
1980 | @@ -278,7 +278,7 @@ struct cred *prepare_creds(void) | ||
1981 | new->security = NULL; | ||
1982 | #endif | ||
1983 | |||
1984 | - if (security_prepare_creds(new, old, GFP_KERNEL) < 0) | ||
1985 | + if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) | ||
1986 | goto error; | ||
1987 | validate_creds(new); | ||
1988 | return new; | ||
1989 | @@ -653,7 +653,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) | ||
1990 | #ifdef CONFIG_SECURITY | ||
1991 | new->security = NULL; | ||
1992 | #endif | ||
1993 | - if (security_prepare_creds(new, old, GFP_KERNEL) < 0) | ||
1994 | + if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) | ||
1995 | goto error; | ||
1996 | |||
1997 | put_cred(old); | ||
1998 | diff --git a/kernel/locking/spinlock_debug.c b/kernel/locking/spinlock_debug.c | ||
1999 | index 9aa0fccd5d43..03595c29c566 100644 | ||
2000 | --- a/kernel/locking/spinlock_debug.c | ||
2001 | +++ b/kernel/locking/spinlock_debug.c | ||
2002 | @@ -51,19 +51,19 @@ EXPORT_SYMBOL(__rwlock_init); | ||
2003 | |||
2004 | static void spin_dump(raw_spinlock_t *lock, const char *msg) | ||
2005 | { | ||
2006 | - struct task_struct *owner = NULL; | ||
2007 | + struct task_struct *owner = READ_ONCE(lock->owner); | ||
2008 | |||
2009 | - if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) | ||
2010 | - owner = lock->owner; | ||
2011 | + if (owner == SPINLOCK_OWNER_INIT) | ||
2012 | + owner = NULL; | ||
2013 | printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n", | ||
2014 | msg, raw_smp_processor_id(), | ||
2015 | current->comm, task_pid_nr(current)); | ||
2016 | printk(KERN_EMERG " lock: %pS, .magic: %08x, .owner: %s/%d, " | ||
2017 | ".owner_cpu: %d\n", | ||
2018 | - lock, lock->magic, | ||
2019 | + lock, READ_ONCE(lock->magic), | ||
2020 | owner ? owner->comm : "<none>", | ||
2021 | owner ? task_pid_nr(owner) : -1, | ||
2022 | - lock->owner_cpu); | ||
2023 | + READ_ONCE(lock->owner_cpu)); | ||
2024 | dump_stack(); | ||
2025 | } | ||
2026 | |||
2027 | @@ -80,16 +80,16 @@ static void spin_bug(raw_spinlock_t *lock, const char *msg) | ||
2028 | static inline void | ||
2029 | debug_spin_lock_before(raw_spinlock_t *lock) | ||
2030 | { | ||
2031 | - SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); | ||
2032 | - SPIN_BUG_ON(lock->owner == current, lock, "recursion"); | ||
2033 | - SPIN_BUG_ON(lock->owner_cpu == raw_smp_processor_id(), | ||
2034 | + SPIN_BUG_ON(READ_ONCE(lock->magic) != SPINLOCK_MAGIC, lock, "bad magic"); | ||
2035 | + SPIN_BUG_ON(READ_ONCE(lock->owner) == current, lock, "recursion"); | ||
2036 | + SPIN_BUG_ON(READ_ONCE(lock->owner_cpu) == raw_smp_processor_id(), | ||
2037 | lock, "cpu recursion"); | ||
2038 | } | ||
2039 | |||
2040 | static inline void debug_spin_lock_after(raw_spinlock_t *lock) | ||
2041 | { | ||
2042 | - lock->owner_cpu = raw_smp_processor_id(); | ||
2043 | - lock->owner = current; | ||
2044 | + WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id()); | ||
2045 | + WRITE_ONCE(lock->owner, current); | ||
2046 | } | ||
2047 | |||
2048 | static inline void debug_spin_unlock(raw_spinlock_t *lock) | ||
2049 | @@ -99,8 +99,8 @@ static inline void debug_spin_unlock(raw_spinlock_t *lock) | ||
2050 | SPIN_BUG_ON(lock->owner != current, lock, "wrong owner"); | ||
2051 | SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), | ||
2052 | lock, "wrong CPU"); | ||
2053 | - lock->owner = SPINLOCK_OWNER_INIT; | ||
2054 | - lock->owner_cpu = -1; | ||
2055 | + WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT); | ||
2056 | + WRITE_ONCE(lock->owner_cpu, -1); | ||
2057 | } | ||
2058 | |||
2059 | /* | ||
2060 | @@ -183,8 +183,8 @@ static inline void debug_write_lock_before(rwlock_t *lock) | ||
2061 | |||
2062 | static inline void debug_write_lock_after(rwlock_t *lock) | ||
2063 | { | ||
2064 | - lock->owner_cpu = raw_smp_processor_id(); | ||
2065 | - lock->owner = current; | ||
2066 | + WRITE_ONCE(lock->owner_cpu, raw_smp_processor_id()); | ||
2067 | + WRITE_ONCE(lock->owner, current); | ||
2068 | } | ||
2069 | |||
2070 | static inline void debug_write_unlock(rwlock_t *lock) | ||
2071 | @@ -193,8 +193,8 @@ static inline void debug_write_unlock(rwlock_t *lock) | ||
2072 | RWLOCK_BUG_ON(lock->owner != current, lock, "wrong owner"); | ||
2073 | RWLOCK_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), | ||
2074 | lock, "wrong CPU"); | ||
2075 | - lock->owner = SPINLOCK_OWNER_INIT; | ||
2076 | - lock->owner_cpu = -1; | ||
2077 | + WRITE_ONCE(lock->owner, SPINLOCK_OWNER_INIT); | ||
2078 | + WRITE_ONCE(lock->owner_cpu, -1); | ||
2079 | } | ||
2080 | |||
2081 | void do_raw_write_lock(rwlock_t *lock) | ||
2082 | diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c | ||
2083 | index 4f0f0604f1c4..5dfac92521fa 100644 | ||
2084 | --- a/kernel/power/snapshot.c | ||
2085 | +++ b/kernel/power/snapshot.c | ||
2086 | @@ -732,8 +732,15 @@ zone_found: | ||
2087 | * We have found the zone. Now walk the radix tree to find the leaf node | ||
2088 | * for our PFN. | ||
2089 | */ | ||
2090 | + | ||
2091 | + /* | ||
2092 | + * If the zone we wish to scan is the the current zone and the | ||
2093 | + * pfn falls into the current node then we do not need to walk | ||
2094 | + * the tree. | ||
2095 | + */ | ||
2096 | node = bm->cur.node; | ||
2097 | - if (((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) | ||
2098 | + if (zone == bm->cur.zone && | ||
2099 | + ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) | ||
2100 | goto node_found; | ||
2101 | |||
2102 | node = zone->rtree; | ||
2103 | diff --git a/kernel/taskstats.c b/kernel/taskstats.c | ||
2104 | index cbb387a265db..23df1fbad4b4 100644 | ||
2105 | --- a/kernel/taskstats.c | ||
2106 | +++ b/kernel/taskstats.c | ||
2107 | @@ -559,25 +559,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info) | ||
2108 | static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk) | ||
2109 | { | ||
2110 | struct signal_struct *sig = tsk->signal; | ||
2111 | - struct taskstats *stats; | ||
2112 | + struct taskstats *stats_new, *stats; | ||
2113 | |||
2114 | - if (sig->stats || thread_group_empty(tsk)) | ||
2115 | - goto ret; | ||
2116 | + /* Pairs with smp_store_release() below. */ | ||
2117 | + stats = smp_load_acquire(&sig->stats); | ||
2118 | + if (stats || thread_group_empty(tsk)) | ||
2119 | + return stats; | ||
2120 | |||
2121 | /* No problem if kmem_cache_zalloc() fails */ | ||
2122 | - stats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL); | ||
2123 | + stats_new = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL); | ||
2124 | |||
2125 | spin_lock_irq(&tsk->sighand->siglock); | ||
2126 | - if (!sig->stats) { | ||
2127 | - sig->stats = stats; | ||
2128 | - stats = NULL; | ||
2129 | + stats = sig->stats; | ||
2130 | + if (!stats) { | ||
2131 | + /* | ||
2132 | + * Pairs with smp_store_release() above and order the | ||
2133 | + * kmem_cache_zalloc(). | ||
2134 | + */ | ||
2135 | + smp_store_release(&sig->stats, stats_new); | ||
2136 | + stats = stats_new; | ||
2137 | + stats_new = NULL; | ||
2138 | } | ||
2139 | spin_unlock_irq(&tsk->sighand->siglock); | ||
2140 | |||
2141 | - if (stats) | ||
2142 | - kmem_cache_free(taskstats_cache, stats); | ||
2143 | -ret: | ||
2144 | - return sig->stats; | ||
2145 | + if (stats_new) | ||
2146 | + kmem_cache_free(taskstats_cache, stats_new); | ||
2147 | + | ||
2148 | + return stats; | ||
2149 | } | ||
2150 | |||
2151 | /* Send pid data out on exit */ | ||
2152 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c | ||
2153 | index 77109b9cf733..71a40e5c3a9f 100644 | ||
2154 | --- a/kernel/trace/ftrace.c | ||
2155 | +++ b/kernel/trace/ftrace.c | ||
2156 | @@ -609,8 +609,7 @@ static int function_stat_show(struct seq_file *m, void *v) | ||
2157 | } | ||
2158 | |||
2159 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
2160 | - avg = rec->time; | ||
2161 | - do_div(avg, rec->counter); | ||
2162 | + avg = div64_ul(rec->time, rec->counter); | ||
2163 | if (tracing_thresh && (avg < tracing_thresh)) | ||
2164 | goto out; | ||
2165 | #endif | ||
2166 | @@ -636,7 +635,8 @@ static int function_stat_show(struct seq_file *m, void *v) | ||
2167 | * Divide only 1000 for ns^2 -> us^2 conversion. | ||
2168 | * trace_print_graph_duration will divide 1000 again. | ||
2169 | */ | ||
2170 | - do_div(stddev, rec->counter * (rec->counter - 1) * 1000); | ||
2171 | + stddev = div64_ul(stddev, | ||
2172 | + rec->counter * (rec->counter - 1) * 1000); | ||
2173 | } | ||
2174 | |||
2175 | trace_seq_init(&s); | ||
2176 | diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c | ||
2177 | index 305039b122fa..35b2ba07f3c6 100644 | ||
2178 | --- a/kernel/trace/tracing_map.c | ||
2179 | +++ b/kernel/trace/tracing_map.c | ||
2180 | @@ -90,8 +90,8 @@ static int tracing_map_cmp_atomic64(void *val_a, void *val_b) | ||
2181 | #define DEFINE_TRACING_MAP_CMP_FN(type) \ | ||
2182 | static int tracing_map_cmp_##type(void *val_a, void *val_b) \ | ||
2183 | { \ | ||
2184 | - type a = *(type *)val_a; \ | ||
2185 | - type b = *(type *)val_b; \ | ||
2186 | + type a = (type)(*(u64 *)val_a); \ | ||
2187 | + type b = (type)(*(u64 *)val_b); \ | ||
2188 | \ | ||
2189 | return (a > b) ? 1 : ((a < b) ? -1 : 0); \ | ||
2190 | } | ||
2191 | diff --git a/mm/mmap.c b/mm/mmap.c | ||
2192 | index 19368fbba42a..d221266d100f 100644 | ||
2193 | --- a/mm/mmap.c | ||
2194 | +++ b/mm/mmap.c | ||
2195 | @@ -87,12 +87,6 @@ static void unmap_region(struct mm_struct *mm, | ||
2196 | * MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes | ||
2197 | * w: (no) no w: (no) no w: (copy) copy w: (no) no | ||
2198 | * x: (no) no x: (no) yes x: (no) yes x: (yes) yes | ||
2199 | - * | ||
2200 | - * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and | ||
2201 | - * MAP_PRIVATE: | ||
2202 | - * r: (no) no | ||
2203 | - * w: (no) no | ||
2204 | - * x: (yes) yes | ||
2205 | */ | ||
2206 | pgprot_t protection_map[16] = { | ||
2207 | __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, | ||
2208 | diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c | ||
2209 | index 5a50ad517f0f..e4cca3f5331e 100644 | ||
2210 | --- a/mm/zsmalloc.c | ||
2211 | +++ b/mm/zsmalloc.c | ||
2212 | @@ -2138,6 +2138,11 @@ int zs_page_migrate(struct address_space *mapping, struct page *newpage, | ||
2213 | zs_pool_dec_isolated(pool); | ||
2214 | } | ||
2215 | |||
2216 | + if (page_zone(newpage) != page_zone(page)) { | ||
2217 | + dec_zone_page_state(page, NR_ZSPAGES); | ||
2218 | + inc_zone_page_state(newpage, NR_ZSPAGES); | ||
2219 | + } | ||
2220 | + | ||
2221 | reset_page(page); | ||
2222 | put_page(page); | ||
2223 | page = newpage; | ||
2224 | diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h | ||
2225 | index cc1557978066..ecdfeaafba9c 100644 | ||
2226 | --- a/net/8021q/vlan.h | ||
2227 | +++ b/net/8021q/vlan.h | ||
2228 | @@ -109,6 +109,7 @@ int vlan_check_real_dev(struct net_device *real_dev, | ||
2229 | void vlan_setup(struct net_device *dev); | ||
2230 | int register_vlan_dev(struct net_device *dev); | ||
2231 | void unregister_vlan_dev(struct net_device *dev, struct list_head *head); | ||
2232 | +void vlan_dev_uninit(struct net_device *dev); | ||
2233 | bool vlan_dev_inherit_address(struct net_device *dev, | ||
2234 | struct net_device *real_dev); | ||
2235 | |||
2236 | diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c | ||
2237 | index d06d15db3232..892929d43898 100644 | ||
2238 | --- a/net/8021q/vlan_dev.c | ||
2239 | +++ b/net/8021q/vlan_dev.c | ||
2240 | @@ -610,7 +610,8 @@ static int vlan_dev_init(struct net_device *dev) | ||
2241 | return 0; | ||
2242 | } | ||
2243 | |||
2244 | -static void vlan_dev_uninit(struct net_device *dev) | ||
2245 | +/* Note: this function might be called multiple times for the same device. */ | ||
2246 | +void vlan_dev_uninit(struct net_device *dev) | ||
2247 | { | ||
2248 | struct vlan_priority_tci_mapping *pm; | ||
2249 | struct vlan_dev_priv *vlan = vlan_dev_priv(dev); | ||
2250 | diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c | ||
2251 | index 1270207f3d7c..214cc068ffc2 100644 | ||
2252 | --- a/net/8021q/vlan_netlink.c | ||
2253 | +++ b/net/8021q/vlan_netlink.c | ||
2254 | @@ -92,11 +92,13 @@ static int vlan_changelink(struct net_device *dev, | ||
2255 | struct ifla_vlan_flags *flags; | ||
2256 | struct ifla_vlan_qos_mapping *m; | ||
2257 | struct nlattr *attr; | ||
2258 | - int rem; | ||
2259 | + int rem, err; | ||
2260 | |||
2261 | if (data[IFLA_VLAN_FLAGS]) { | ||
2262 | flags = nla_data(data[IFLA_VLAN_FLAGS]); | ||
2263 | - vlan_dev_change_flags(dev, flags->flags, flags->mask); | ||
2264 | + err = vlan_dev_change_flags(dev, flags->flags, flags->mask); | ||
2265 | + if (err) | ||
2266 | + return err; | ||
2267 | } | ||
2268 | if (data[IFLA_VLAN_INGRESS_QOS]) { | ||
2269 | nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) { | ||
2270 | @@ -107,7 +109,9 @@ static int vlan_changelink(struct net_device *dev, | ||
2271 | if (data[IFLA_VLAN_EGRESS_QOS]) { | ||
2272 | nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) { | ||
2273 | m = nla_data(attr); | ||
2274 | - vlan_dev_set_egress_priority(dev, m->from, m->to); | ||
2275 | + err = vlan_dev_set_egress_priority(dev, m->from, m->to); | ||
2276 | + if (err) | ||
2277 | + return err; | ||
2278 | } | ||
2279 | } | ||
2280 | return 0; | ||
2281 | @@ -153,10 +157,11 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev, | ||
2282 | return -EINVAL; | ||
2283 | |||
2284 | err = vlan_changelink(dev, tb, data); | ||
2285 | - if (err < 0) | ||
2286 | - return err; | ||
2287 | - | ||
2288 | - return register_vlan_dev(dev); | ||
2289 | + if (!err) | ||
2290 | + err = register_vlan_dev(dev); | ||
2291 | + if (err) | ||
2292 | + vlan_dev_uninit(dev); | ||
2293 | + return err; | ||
2294 | } | ||
2295 | |||
2296 | static inline size_t vlan_qos_map_size(unsigned int n) | ||
2297 | diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c | ||
2298 | index bd41b78d131d..1d085eed72d0 100644 | ||
2299 | --- a/net/bluetooth/hci_conn.c | ||
2300 | +++ b/net/bluetooth/hci_conn.c | ||
2301 | @@ -1054,8 +1054,10 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst, | ||
2302 | if (!conn) | ||
2303 | return ERR_PTR(-ENOMEM); | ||
2304 | |||
2305 | - if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) | ||
2306 | + if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) { | ||
2307 | + hci_conn_del(conn); | ||
2308 | return ERR_PTR(-EBUSY); | ||
2309 | + } | ||
2310 | |||
2311 | conn->state = BT_CONNECT; | ||
2312 | set_bit(HCI_CONN_SCANNING, &conn->flags); | ||
2313 | diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c | ||
2314 | index 1306962a792a..11012a509070 100644 | ||
2315 | --- a/net/bluetooth/l2cap_core.c | ||
2316 | +++ b/net/bluetooth/l2cap_core.c | ||
2317 | @@ -4908,10 +4908,8 @@ void __l2cap_physical_cfm(struct l2cap_chan *chan, int result) | ||
2318 | BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d", | ||
2319 | chan, result, local_amp_id, remote_amp_id); | ||
2320 | |||
2321 | - if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) { | ||
2322 | - l2cap_chan_unlock(chan); | ||
2323 | + if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) | ||
2324 | return; | ||
2325 | - } | ||
2326 | |||
2327 | if (chan->state != BT_CONNECTED) { | ||
2328 | l2cap_do_create(chan, result, local_amp_id, remote_amp_id); | ||
2329 | diff --git a/net/core/neighbour.c b/net/core/neighbour.c | ||
2330 | index 44a29be7bfff..cd85cee14bd0 100644 | ||
2331 | --- a/net/core/neighbour.c | ||
2332 | +++ b/net/core/neighbour.c | ||
2333 | @@ -1058,7 +1058,7 @@ static void neigh_update_hhs(struct neighbour *neigh) | ||
2334 | |||
2335 | if (update) { | ||
2336 | hh = &neigh->hh; | ||
2337 | - if (hh->hh_len) { | ||
2338 | + if (READ_ONCE(hh->hh_len)) { | ||
2339 | write_seqlock_bh(&hh->hh_lock); | ||
2340 | update(hh, neigh->dev, neigh->ha); | ||
2341 | write_sequnlock_bh(&hh->hh_lock); | ||
2342 | @@ -1319,7 +1319,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb) | ||
2343 | struct net_device *dev = neigh->dev; | ||
2344 | unsigned int seq; | ||
2345 | |||
2346 | - if (dev->header_ops->cache && !neigh->hh.hh_len) | ||
2347 | + if (dev->header_ops->cache && !READ_ONCE(neigh->hh.hh_len)) | ||
2348 | neigh_hh_init(neigh); | ||
2349 | |||
2350 | do { | ||
2351 | diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c | ||
2352 | index 24d7aff8db1a..204aa0131fbe 100644 | ||
2353 | --- a/net/ethernet/eth.c | ||
2354 | +++ b/net/ethernet/eth.c | ||
2355 | @@ -238,7 +238,12 @@ int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 | ||
2356 | eth->h_proto = type; | ||
2357 | memcpy(eth->h_source, dev->dev_addr, ETH_ALEN); | ||
2358 | memcpy(eth->h_dest, neigh->ha, ETH_ALEN); | ||
2359 | - hh->hh_len = ETH_HLEN; | ||
2360 | + | ||
2361 | + /* Pairs with READ_ONCE() in neigh_resolve_output(), | ||
2362 | + * neigh_hh_output() and neigh_update_hhs(). | ||
2363 | + */ | ||
2364 | + smp_store_release(&hh->hh_len, ETH_HLEN); | ||
2365 | + | ||
2366 | return 0; | ||
2367 | } | ||
2368 | EXPORT_SYMBOL(eth_header_cache); | ||
2369 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c | ||
2370 | index 84ff36a6d4e3..4901d17a8e63 100644 | ||
2371 | --- a/net/ipv4/tcp_input.c | ||
2372 | +++ b/net/ipv4/tcp_input.c | ||
2373 | @@ -1741,8 +1741,11 @@ tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, | ||
2374 | } | ||
2375 | |||
2376 | /* Ignore very old stuff early */ | ||
2377 | - if (!after(sp[used_sacks].end_seq, prior_snd_una)) | ||
2378 | + if (!after(sp[used_sacks].end_seq, prior_snd_una)) { | ||
2379 | + if (i == 0) | ||
2380 | + first_sack_index = -1; | ||
2381 | continue; | ||
2382 | + } | ||
2383 | |||
2384 | used_sacks++; | ||
2385 | } | ||
2386 | diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c | ||
2387 | index 204a8351efff..c29170e767a8 100644 | ||
2388 | --- a/net/llc/llc_station.c | ||
2389 | +++ b/net/llc/llc_station.c | ||
2390 | @@ -32,7 +32,7 @@ static int llc_stat_ev_rx_null_dsap_xid_c(struct sk_buff *skb) | ||
2391 | return LLC_PDU_IS_CMD(pdu) && /* command PDU */ | ||
2392 | LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ | ||
2393 | LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_XID && | ||
2394 | - !pdu->dsap ? 0 : 1; /* NULL DSAP value */ | ||
2395 | + !pdu->dsap; /* NULL DSAP value */ | ||
2396 | } | ||
2397 | |||
2398 | static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb) | ||
2399 | @@ -42,7 +42,7 @@ static int llc_stat_ev_rx_null_dsap_test_c(struct sk_buff *skb) | ||
2400 | return LLC_PDU_IS_CMD(pdu) && /* command PDU */ | ||
2401 | LLC_PDU_TYPE_IS_U(pdu) && /* U type PDU */ | ||
2402 | LLC_U_PDU_CMD(pdu) == LLC_1_PDU_CMD_TEST && | ||
2403 | - !pdu->dsap ? 0 : 1; /* NULL DSAP */ | ||
2404 | + !pdu->dsap; /* NULL DSAP */ | ||
2405 | } | ||
2406 | |||
2407 | static int llc_station_ac_send_xid_r(struct sk_buff *skb) | ||
2408 | diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c | ||
2409 | index deea281ab169..5e28702c801f 100644 | ||
2410 | --- a/net/netfilter/nf_conntrack_netlink.c | ||
2411 | +++ b/net/netfilter/nf_conntrack_netlink.c | ||
2412 | @@ -3388,6 +3388,9 @@ static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list) | ||
2413 | |||
2414 | list_for_each_entry(net, net_exit_list, exit_list) | ||
2415 | ctnetlink_net_exit(net); | ||
2416 | + | ||
2417 | + /* wait for other cpus until they are done with ctnl_notifiers */ | ||
2418 | + synchronize_rcu(); | ||
2419 | } | ||
2420 | |||
2421 | static struct pernet_operations ctnetlink_net_ops = { | ||
2422 | diff --git a/net/rfkill/core.c b/net/rfkill/core.c | ||
2423 | index 884027f62783..87c35844d7d9 100644 | ||
2424 | --- a/net/rfkill/core.c | ||
2425 | +++ b/net/rfkill/core.c | ||
2426 | @@ -940,10 +940,13 @@ static void rfkill_sync_work(struct work_struct *work) | ||
2427 | int __must_check rfkill_register(struct rfkill *rfkill) | ||
2428 | { | ||
2429 | static unsigned long rfkill_no; | ||
2430 | - struct device *dev = &rfkill->dev; | ||
2431 | + struct device *dev; | ||
2432 | int error; | ||
2433 | |||
2434 | - BUG_ON(!rfkill); | ||
2435 | + if (!rfkill) | ||
2436 | + return -EINVAL; | ||
2437 | + | ||
2438 | + dev = &rfkill->dev; | ||
2439 | |||
2440 | mutex_lock(&rfkill_global_mutex); | ||
2441 | |||
2442 | diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c | ||
2443 | index bf13b8470c9a..80950a4384aa 100644 | ||
2444 | --- a/net/rxrpc/peer_event.c | ||
2445 | +++ b/net/rxrpc/peer_event.c | ||
2446 | @@ -148,6 +148,9 @@ void rxrpc_error_report(struct sock *sk) | ||
2447 | struct rxrpc_peer *peer; | ||
2448 | struct sk_buff *skb; | ||
2449 | |||
2450 | + if (unlikely(!local)) | ||
2451 | + return; | ||
2452 | + | ||
2453 | _enter("%p{%d}", sk, local->debug_id); | ||
2454 | |||
2455 | skb = sock_dequeue_err_skb(sk); | ||
2456 | diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c | ||
2457 | index b57b4de73038..7e7eba33bbdb 100644 | ||
2458 | --- a/net/sched/sch_fq.c | ||
2459 | +++ b/net/sched/sch_fq.c | ||
2460 | @@ -736,7 +736,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt) | ||
2461 | if (tb[TCA_FQ_QUANTUM]) { | ||
2462 | u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); | ||
2463 | |||
2464 | - if (quantum > 0) | ||
2465 | + if (quantum > 0 && quantum <= (1 << 20)) | ||
2466 | q->quantum = quantum; | ||
2467 | else | ||
2468 | err = -EINVAL; | ||
2469 | diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c | ||
2470 | index 2cca1ead96b5..2332984ba422 100644 | ||
2471 | --- a/net/sched/sch_prio.c | ||
2472 | +++ b/net/sched/sch_prio.c | ||
2473 | @@ -232,8 +232,14 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, | ||
2474 | struct prio_sched_data *q = qdisc_priv(sch); | ||
2475 | unsigned long band = arg - 1; | ||
2476 | |||
2477 | - if (new == NULL) | ||
2478 | - new = &noop_qdisc; | ||
2479 | + if (!new) { | ||
2480 | + new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, | ||
2481 | + TC_H_MAKE(sch->handle, arg)); | ||
2482 | + if (!new) | ||
2483 | + new = &noop_qdisc; | ||
2484 | + else | ||
2485 | + qdisc_hash_add(new); | ||
2486 | + } | ||
2487 | |||
2488 | *old = qdisc_replace(sch, new, &q->queues[band]); | ||
2489 | return 0; | ||
2490 | diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c | ||
2491 | index 8b4cf78987e4..1133fa0830f4 100644 | ||
2492 | --- a/net/sctp/sm_sideeffect.c | ||
2493 | +++ b/net/sctp/sm_sideeffect.c | ||
2494 | @@ -1321,8 +1321,10 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | ||
2495 | /* Generate an INIT ACK chunk. */ | ||
2496 | new_obj = sctp_make_init_ack(asoc, chunk, GFP_ATOMIC, | ||
2497 | 0); | ||
2498 | - if (!new_obj) | ||
2499 | - goto nomem; | ||
2500 | + if (!new_obj) { | ||
2501 | + error = -ENOMEM; | ||
2502 | + break; | ||
2503 | + } | ||
2504 | |||
2505 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, | ||
2506 | SCTP_CHUNK(new_obj)); | ||
2507 | @@ -1344,7 +1346,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | ||
2508 | if (!new_obj) { | ||
2509 | if (cmd->obj.chunk) | ||
2510 | sctp_chunk_free(cmd->obj.chunk); | ||
2511 | - goto nomem; | ||
2512 | + error = -ENOMEM; | ||
2513 | + break; | ||
2514 | } | ||
2515 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, | ||
2516 | SCTP_CHUNK(new_obj)); | ||
2517 | @@ -1391,8 +1394,10 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | ||
2518 | |||
2519 | /* Generate a SHUTDOWN chunk. */ | ||
2520 | new_obj = sctp_make_shutdown(asoc, chunk); | ||
2521 | - if (!new_obj) | ||
2522 | - goto nomem; | ||
2523 | + if (!new_obj) { | ||
2524 | + error = -ENOMEM; | ||
2525 | + break; | ||
2526 | + } | ||
2527 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, | ||
2528 | SCTP_CHUNK(new_obj)); | ||
2529 | break; | ||
2530 | @@ -1721,11 +1726,17 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | ||
2531 | break; | ||
2532 | } | ||
2533 | |||
2534 | - if (error) | ||
2535 | + if (error) { | ||
2536 | + cmd = sctp_next_cmd(commands); | ||
2537 | + while (cmd) { | ||
2538 | + if (cmd->verb == SCTP_CMD_REPLY) | ||
2539 | + sctp_chunk_free(cmd->obj.chunk); | ||
2540 | + cmd = sctp_next_cmd(commands); | ||
2541 | + } | ||
2542 | break; | ||
2543 | + } | ||
2544 | } | ||
2545 | |||
2546 | -out: | ||
2547 | /* If this is in response to a received chunk, wait until | ||
2548 | * we are done with the packet to open the queue so that we don't | ||
2549 | * send multiple packets in response to a single request. | ||
2550 | @@ -1740,8 +1751,5 @@ out: | ||
2551 | sp->data_ready_signalled = 0; | ||
2552 | |||
2553 | return error; | ||
2554 | -nomem: | ||
2555 | - error = -ENOMEM; | ||
2556 | - goto out; | ||
2557 | } | ||
2558 | |||
2559 | diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c | ||
2560 | index 9a130d31ecf2..6fbb5eb9daf3 100644 | ||
2561 | --- a/samples/bpf/trace_event_user.c | ||
2562 | +++ b/samples/bpf/trace_event_user.c | ||
2563 | @@ -33,9 +33,9 @@ static void print_ksym(__u64 addr) | ||
2564 | return; | ||
2565 | sym = ksym_search(addr); | ||
2566 | printf("%s;", sym->name); | ||
2567 | - if (!strcmp(sym->name, "sys_read")) | ||
2568 | + if (!strstr(sym->name, "sys_read")) | ||
2569 | sys_read_seen = true; | ||
2570 | - else if (!strcmp(sym->name, "sys_write")) | ||
2571 | + else if (!strstr(sym->name, "sys_write")) | ||
2572 | sys_write_seen = true; | ||
2573 | } | ||
2574 | |||
2575 | diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c | ||
2576 | index ed29bad1f03a..96420b620963 100644 | ||
2577 | --- a/scripts/kconfig/expr.c | ||
2578 | +++ b/scripts/kconfig/expr.c | ||
2579 | @@ -201,6 +201,13 @@ static int expr_eq(struct expr *e1, struct expr *e2) | ||
2580 | { | ||
2581 | int res, old_count; | ||
2582 | |||
2583 | + /* | ||
2584 | + * A NULL expr is taken to be yes, but there's also a different way to | ||
2585 | + * represent yes. expr_is_yes() checks for either representation. | ||
2586 | + */ | ||
2587 | + if (!e1 || !e2) | ||
2588 | + return expr_is_yes(e1) && expr_is_yes(e2); | ||
2589 | + | ||
2590 | if (e1->type != e2->type) | ||
2591 | return 0; | ||
2592 | switch (e1->type) { | ||
2593 | diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c | ||
2594 | index 9d7582c90a95..c67d379cb6d6 100644 | ||
2595 | --- a/sound/isa/cs423x/cs4236.c | ||
2596 | +++ b/sound/isa/cs423x/cs4236.c | ||
2597 | @@ -293,7 +293,8 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) | ||
2598 | } else { | ||
2599 | mpu_port[dev] = pnp_port_start(pdev, 0); | ||
2600 | if (mpu_irq[dev] >= 0 && | ||
2601 | - pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) { | ||
2602 | + pnp_irq_valid(pdev, 0) && | ||
2603 | + pnp_irq(pdev, 0) != (resource_size_t)-1) { | ||
2604 | mpu_irq[dev] = pnp_irq(pdev, 0); | ||
2605 | } else { | ||
2606 | mpu_irq[dev] = -1; /* disable interrupt */ | ||
2607 | diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c | ||
2608 | index e5c52ed9b674..8c06de37b467 100644 | ||
2609 | --- a/sound/pci/ice1712/ice1724.c | ||
2610 | +++ b/sound/pci/ice1712/ice1724.c | ||
2611 | @@ -661,6 +661,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, | ||
2612 | unsigned long flags; | ||
2613 | unsigned char mclk_change; | ||
2614 | unsigned int i, old_rate; | ||
2615 | + bool call_set_rate = false; | ||
2616 | |||
2617 | if (rate > ice->hw_rates->list[ice->hw_rates->count - 1]) | ||
2618 | return -EINVAL; | ||
2619 | @@ -684,7 +685,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, | ||
2620 | * setting clock rate for internal clock mode */ | ||
2621 | old_rate = ice->get_rate(ice); | ||
2622 | if (force || (old_rate != rate)) | ||
2623 | - ice->set_rate(ice, rate); | ||
2624 | + call_set_rate = true; | ||
2625 | else if (rate == ice->cur_rate) { | ||
2626 | spin_unlock_irqrestore(&ice->reg_lock, flags); | ||
2627 | return 0; | ||
2628 | @@ -692,12 +693,14 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, | ||
2629 | } | ||
2630 | |||
2631 | ice->cur_rate = rate; | ||
2632 | + spin_unlock_irqrestore(&ice->reg_lock, flags); | ||
2633 | + | ||
2634 | + if (call_set_rate) | ||
2635 | + ice->set_rate(ice, rate); | ||
2636 | |||
2637 | /* setting master clock */ | ||
2638 | mclk_change = ice->set_mclk(ice, rate); | ||
2639 | |||
2640 | - spin_unlock_irqrestore(&ice->reg_lock, flags); | ||
2641 | - | ||
2642 | if (mclk_change && ice->gpio.i2s_mclk_changed) | ||
2643 | ice->gpio.i2s_mclk_changed(ice); | ||
2644 | if (ice->gpio.set_pro_rate) | ||
2645 | diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c | ||
2646 | index fd2731d171dd..0e8008d38161 100644 | ||
2647 | --- a/sound/soc/codecs/wm8962.c | ||
2648 | +++ b/sound/soc/codecs/wm8962.c | ||
2649 | @@ -2791,7 +2791,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, | ||
2650 | |||
2651 | if (target % Fref == 0) { | ||
2652 | fll_div->theta = 0; | ||
2653 | - fll_div->lambda = 0; | ||
2654 | + fll_div->lambda = 1; | ||
2655 | } else { | ||
2656 | gcd_fll = gcd(target, fratio * Fref); | ||
2657 | |||
2658 | @@ -2861,7 +2861,7 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source, | ||
2659 | return -EINVAL; | ||
2660 | } | ||
2661 | |||
2662 | - if (fll_div.theta || fll_div.lambda) | ||
2663 | + if (fll_div.theta) | ||
2664 | fll1 |= WM8962_FLL_FRAC; | ||
2665 | |||
2666 | /* Stop the FLL while we reconfigure */ | ||
2667 | diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c | ||
2668 | index 33ff5c843346..6e88460cd13d 100644 | ||
2669 | --- a/tools/perf/builtin-report.c | ||
2670 | +++ b/tools/perf/builtin-report.c | ||
2671 | @@ -292,13 +292,6 @@ static int report__setup_sample_type(struct report *rep) | ||
2672 | PERF_SAMPLE_BRANCH_ANY)) | ||
2673 | rep->nonany_branch_mode = true; | ||
2674 | |||
2675 | -#ifndef HAVE_LIBUNWIND_SUPPORT | ||
2676 | - if (dwarf_callchain_users) { | ||
2677 | - ui__warning("Please install libunwind development packages " | ||
2678 | - "during the perf build.\n"); | ||
2679 | - } | ||
2680 | -#endif | ||
2681 | - | ||
2682 | return 0; | ||
2683 | } | ||
2684 |