Magellan Linux

Contents of /trunk/kernel-magellan/patches-5.0/0100-5.0.1-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3327 - (show annotations) (download)
Fri Apr 26 12:19:47 2019 UTC (5 years ago) by niro
File size: 71154 byte(s)
-linux-5.0.1
1 diff --git a/Makefile b/Makefile
2 index d5713e7b1e506..3cd7163fe1646 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 0
9 -SUBLEVEL = 0
10 +SUBLEVEL = 1
11 EXTRAVERSION =
12 NAME = Shy Crocodile
13
14 diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
15 index 7b56a53be5e30..e09558edae73a 100644
16 --- a/arch/alpha/kernel/syscalls/syscall.tbl
17 +++ b/arch/alpha/kernel/syscalls/syscall.tbl
18 @@ -451,3 +451,4 @@
19 520 common preadv2 sys_preadv2
20 521 common pwritev2 sys_pwritev2
21 522 common statx sys_statx
22 +523 common io_pgetevents sys_io_pgetevents
23 diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
24 index ba150c755fcce..85b6c60f285d2 100644
25 --- a/arch/mips/kernel/irq.c
26 +++ b/arch/mips/kernel/irq.c
27 @@ -52,6 +52,7 @@ asmlinkage void spurious_interrupt(void)
28 void __init init_IRQ(void)
29 {
30 int i;
31 + unsigned int order = get_order(IRQ_STACK_SIZE);
32
33 for (i = 0; i < NR_IRQS; i++)
34 irq_set_noprobe(i);
35 @@ -62,8 +63,7 @@ void __init init_IRQ(void)
36 arch_init_irq();
37
38 for_each_possible_cpu(i) {
39 - int irq_pages = IRQ_STACK_SIZE / PAGE_SIZE;
40 - void *s = (void *)__get_free_pages(GFP_KERNEL, irq_pages);
41 + void *s = (void *)__get_free_pages(GFP_KERNEL, order);
42
43 irq_stack[i] = s;
44 pr_debug("CPU%d IRQ stack at 0x%p - 0x%p\n", i,
45 diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c
46 index 9e21573714910..f8debf7aeb4c1 100644
47 --- a/arch/x86/boot/compressed/pgtable_64.c
48 +++ b/arch/x86/boot/compressed/pgtable_64.c
49 @@ -1,5 +1,7 @@
50 +#include <linux/efi.h>
51 #include <asm/e820/types.h>
52 #include <asm/processor.h>
53 +#include <asm/efi.h>
54 #include "pgtable.h"
55 #include "../string.h"
56
57 @@ -37,9 +39,10 @@ int cmdline_find_option_bool(const char *option);
58
59 static unsigned long find_trampoline_placement(void)
60 {
61 - unsigned long bios_start, ebda_start;
62 + unsigned long bios_start = 0, ebda_start = 0;
63 unsigned long trampoline_start;
64 struct boot_e820_entry *entry;
65 + char *signature;
66 int i;
67
68 /*
69 @@ -47,8 +50,18 @@ static unsigned long find_trampoline_placement(void)
70 * This code is based on reserve_bios_regions().
71 */
72
73 - ebda_start = *(unsigned short *)0x40e << 4;
74 - bios_start = *(unsigned short *)0x413 << 10;
75 + /*
76 + * EFI systems may not provide legacy ROM. The memory may not be mapped
77 + * at all.
78 + *
79 + * Only look for values in the legacy ROM for non-EFI system.
80 + */
81 + signature = (char *)&boot_params->efi_info.efi_loader_signature;
82 + if (strncmp(signature, EFI32_LOADER_SIGNATURE, 4) &&
83 + strncmp(signature, EFI64_LOADER_SIGNATURE, 4)) {
84 + ebda_start = *(unsigned short *)0x40e << 4;
85 + bios_start = *(unsigned short *)0x413 << 10;
86 + }
87
88 if (bios_start < BIOS_START_MIN || bios_start > BIOS_START_MAX)
89 bios_start = BIOS_START_MAX;
90 diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
91 index 69f6bbb41be0b..01004bfb1a1bc 100644
92 --- a/arch/x86/kernel/cpu/amd.c
93 +++ b/arch/x86/kernel/cpu/amd.c
94 @@ -819,11 +819,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
95 static void init_amd_zn(struct cpuinfo_x86 *c)
96 {
97 set_cpu_cap(c, X86_FEATURE_ZEN);
98 - /*
99 - * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
100 - * all up to and including B1.
101 - */
102 - if (c->x86_model <= 1 && c->x86_stepping <= 1)
103 +
104 + /* Fix erratum 1076: CPB feature bit not being set in CPUID. */
105 + if (!cpu_has(c, X86_FEATURE_CPB))
106 set_cpu_cap(c, X86_FEATURE_CPB);
107 }
108
109 diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
110 index 74969a437a37c..2e73395f0560c 100644
111 --- a/arch/xtensa/kernel/process.c
112 +++ b/arch/xtensa/kernel/process.c
113 @@ -321,8 +321,8 @@ unsigned long get_wchan(struct task_struct *p)
114
115 /* Stack layout: sp-4: ra, sp-3: sp' */
116
117 - pc = MAKE_PC_FROM_RA(*(unsigned long*)sp - 4, sp);
118 - sp = *(unsigned long *)sp - 3;
119 + pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp);
120 + sp = SPILL_SLOT(sp, 1);
121 } while (count++ < 16);
122 return 0;
123 }
124 diff --git a/drivers/android/binder.c b/drivers/android/binder.c
125 index 4d2b2ad1ee0e1..01f80cbd27418 100644
126 --- a/drivers/android/binder.c
127 +++ b/drivers/android/binder.c
128 @@ -329,6 +329,8 @@ struct binder_error {
129 * (invariant after initialized)
130 * @min_priority: minimum scheduling priority
131 * (invariant after initialized)
132 + * @txn_security_ctx: require sender's security context
133 + * (invariant after initialized)
134 * @async_todo: list of async work items
135 * (protected by @proc->inner_lock)
136 *
137 @@ -365,6 +367,7 @@ struct binder_node {
138 * invariant after initialization
139 */
140 u8 accept_fds:1;
141 + u8 txn_security_ctx:1;
142 u8 min_priority;
143 };
144 bool has_async_transaction;
145 @@ -615,6 +618,7 @@ struct binder_transaction {
146 long saved_priority;
147 kuid_t sender_euid;
148 struct list_head fd_fixups;
149 + binder_uintptr_t security_ctx;
150 /**
151 * @lock: protects @from, @to_proc, and @to_thread
152 *
153 @@ -1152,6 +1156,7 @@ static struct binder_node *binder_init_node_ilocked(
154 node->work.type = BINDER_WORK_NODE;
155 node->min_priority = flags & FLAT_BINDER_FLAG_PRIORITY_MASK;
156 node->accept_fds = !!(flags & FLAT_BINDER_FLAG_ACCEPTS_FDS);
157 + node->txn_security_ctx = !!(flags & FLAT_BINDER_FLAG_TXN_SECURITY_CTX);
158 spin_lock_init(&node->lock);
159 INIT_LIST_HEAD(&node->work.entry);
160 INIT_LIST_HEAD(&node->async_todo);
161 @@ -2778,6 +2783,8 @@ static void binder_transaction(struct binder_proc *proc,
162 binder_size_t last_fixup_min_off = 0;
163 struct binder_context *context = proc->context;
164 int t_debug_id = atomic_inc_return(&binder_last_id);
165 + char *secctx = NULL;
166 + u32 secctx_sz = 0;
167
168 e = binder_transaction_log_add(&binder_transaction_log);
169 e->debug_id = t_debug_id;
170 @@ -3020,6 +3027,20 @@ static void binder_transaction(struct binder_proc *proc,
171 t->flags = tr->flags;
172 t->priority = task_nice(current);
173
174 + if (target_node && target_node->txn_security_ctx) {
175 + u32 secid;
176 +
177 + security_task_getsecid(proc->tsk, &secid);
178 + ret = security_secid_to_secctx(secid, &secctx, &secctx_sz);
179 + if (ret) {
180 + return_error = BR_FAILED_REPLY;
181 + return_error_param = ret;
182 + return_error_line = __LINE__;
183 + goto err_get_secctx_failed;
184 + }
185 + extra_buffers_size += ALIGN(secctx_sz, sizeof(u64));
186 + }
187 +
188 trace_binder_transaction(reply, t, target_node);
189
190 t->buffer = binder_alloc_new_buf(&target_proc->alloc, tr->data_size,
191 @@ -3036,6 +3057,19 @@ static void binder_transaction(struct binder_proc *proc,
192 t->buffer = NULL;
193 goto err_binder_alloc_buf_failed;
194 }
195 + if (secctx) {
196 + size_t buf_offset = ALIGN(tr->data_size, sizeof(void *)) +
197 + ALIGN(tr->offsets_size, sizeof(void *)) +
198 + ALIGN(extra_buffers_size, sizeof(void *)) -
199 + ALIGN(secctx_sz, sizeof(u64));
200 + char *kptr = t->buffer->data + buf_offset;
201 +
202 + t->security_ctx = (uintptr_t)kptr +
203 + binder_alloc_get_user_buffer_offset(&target_proc->alloc);
204 + memcpy(kptr, secctx, secctx_sz);
205 + security_release_secctx(secctx, secctx_sz);
206 + secctx = NULL;
207 + }
208 t->buffer->debug_id = t->debug_id;
209 t->buffer->transaction = t;
210 t->buffer->target_node = target_node;
211 @@ -3305,6 +3339,9 @@ err_copy_data_failed:
212 t->buffer->transaction = NULL;
213 binder_alloc_free_buf(&target_proc->alloc, t->buffer);
214 err_binder_alloc_buf_failed:
215 + if (secctx)
216 + security_release_secctx(secctx, secctx_sz);
217 +err_get_secctx_failed:
218 kfree(tcomplete);
219 binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE);
220 err_alloc_tcomplete_failed:
221 @@ -4036,11 +4073,13 @@ retry:
222
223 while (1) {
224 uint32_t cmd;
225 - struct binder_transaction_data tr;
226 + struct binder_transaction_data_secctx tr;
227 + struct binder_transaction_data *trd = &tr.transaction_data;
228 struct binder_work *w = NULL;
229 struct list_head *list = NULL;
230 struct binder_transaction *t = NULL;
231 struct binder_thread *t_from;
232 + size_t trsize = sizeof(*trd);
233
234 binder_inner_proc_lock(proc);
235 if (!binder_worklist_empty_ilocked(&thread->todo))
236 @@ -4240,8 +4279,8 @@ retry:
237 if (t->buffer->target_node) {
238 struct binder_node *target_node = t->buffer->target_node;
239
240 - tr.target.ptr = target_node->ptr;
241 - tr.cookie = target_node->cookie;
242 + trd->target.ptr = target_node->ptr;
243 + trd->cookie = target_node->cookie;
244 t->saved_priority = task_nice(current);
245 if (t->priority < target_node->min_priority &&
246 !(t->flags & TF_ONE_WAY))
247 @@ -4251,22 +4290,23 @@ retry:
248 binder_set_nice(target_node->min_priority);
249 cmd = BR_TRANSACTION;
250 } else {
251 - tr.target.ptr = 0;
252 - tr.cookie = 0;
253 + trd->target.ptr = 0;
254 + trd->cookie = 0;
255 cmd = BR_REPLY;
256 }
257 - tr.code = t->code;
258 - tr.flags = t->flags;
259 - tr.sender_euid = from_kuid(current_user_ns(), t->sender_euid);
260 + trd->code = t->code;
261 + trd->flags = t->flags;
262 + trd->sender_euid = from_kuid(current_user_ns(), t->sender_euid);
263
264 t_from = binder_get_txn_from(t);
265 if (t_from) {
266 struct task_struct *sender = t_from->proc->tsk;
267
268 - tr.sender_pid = task_tgid_nr_ns(sender,
269 - task_active_pid_ns(current));
270 + trd->sender_pid =
271 + task_tgid_nr_ns(sender,
272 + task_active_pid_ns(current));
273 } else {
274 - tr.sender_pid = 0;
275 + trd->sender_pid = 0;
276 }
277
278 ret = binder_apply_fd_fixups(t);
279 @@ -4297,15 +4337,20 @@ retry:
280 }
281 continue;
282 }
283 - tr.data_size = t->buffer->data_size;
284 - tr.offsets_size = t->buffer->offsets_size;
285 - tr.data.ptr.buffer = (binder_uintptr_t)
286 + trd->data_size = t->buffer->data_size;
287 + trd->offsets_size = t->buffer->offsets_size;
288 + trd->data.ptr.buffer = (binder_uintptr_t)
289 ((uintptr_t)t->buffer->data +
290 binder_alloc_get_user_buffer_offset(&proc->alloc));
291 - tr.data.ptr.offsets = tr.data.ptr.buffer +
292 + trd->data.ptr.offsets = trd->data.ptr.buffer +
293 ALIGN(t->buffer->data_size,
294 sizeof(void *));
295
296 + tr.secctx = t->security_ctx;
297 + if (t->security_ctx) {
298 + cmd = BR_TRANSACTION_SEC_CTX;
299 + trsize = sizeof(tr);
300 + }
301 if (put_user(cmd, (uint32_t __user *)ptr)) {
302 if (t_from)
303 binder_thread_dec_tmpref(t_from);
304 @@ -4316,7 +4361,7 @@ retry:
305 return -EFAULT;
306 }
307 ptr += sizeof(uint32_t);
308 - if (copy_to_user(ptr, &tr, sizeof(tr))) {
309 + if (copy_to_user(ptr, &tr, trsize)) {
310 if (t_from)
311 binder_thread_dec_tmpref(t_from);
312
313 @@ -4325,7 +4370,7 @@ retry:
314
315 return -EFAULT;
316 }
317 - ptr += sizeof(tr);
318 + ptr += trsize;
319
320 trace_binder_transaction_received(t);
321 binder_stat_br(proc, thread, cmd);
322 @@ -4333,16 +4378,18 @@ retry:
323 "%d:%d %s %d %d:%d, cmd %d size %zd-%zd ptr %016llx-%016llx\n",
324 proc->pid, thread->pid,
325 (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
326 - "BR_REPLY",
327 + (cmd == BR_TRANSACTION_SEC_CTX) ?
328 + "BR_TRANSACTION_SEC_CTX" : "BR_REPLY",
329 t->debug_id, t_from ? t_from->proc->pid : 0,
330 t_from ? t_from->pid : 0, cmd,
331 t->buffer->data_size, t->buffer->offsets_size,
332 - (u64)tr.data.ptr.buffer, (u64)tr.data.ptr.offsets);
333 + (u64)trd->data.ptr.buffer,
334 + (u64)trd->data.ptr.offsets);
335
336 if (t_from)
337 binder_thread_dec_tmpref(t_from);
338 t->buffer->allow_user_free = 1;
339 - if (cmd == BR_TRANSACTION && !(t->flags & TF_ONE_WAY)) {
340 + if (cmd != BR_REPLY && !(t->flags & TF_ONE_WAY)) {
341 binder_inner_proc_lock(thread->proc);
342 t->to_parent = thread->transaction_stack;
343 t->to_thread = thread;
344 @@ -4690,7 +4737,8 @@ out:
345 return ret;
346 }
347
348 -static int binder_ioctl_set_ctx_mgr(struct file *filp)
349 +static int binder_ioctl_set_ctx_mgr(struct file *filp,
350 + struct flat_binder_object *fbo)
351 {
352 int ret = 0;
353 struct binder_proc *proc = filp->private_data;
354 @@ -4719,7 +4767,7 @@ static int binder_ioctl_set_ctx_mgr(struct file *filp)
355 } else {
356 context->binder_context_mgr_uid = curr_euid;
357 }
358 - new_node = binder_new_node(proc, NULL);
359 + new_node = binder_new_node(proc, fbo);
360 if (!new_node) {
361 ret = -ENOMEM;
362 goto out;
363 @@ -4842,8 +4890,20 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
364 binder_inner_proc_unlock(proc);
365 break;
366 }
367 + case BINDER_SET_CONTEXT_MGR_EXT: {
368 + struct flat_binder_object fbo;
369 +
370 + if (copy_from_user(&fbo, ubuf, sizeof(fbo))) {
371 + ret = -EINVAL;
372 + goto err;
373 + }
374 + ret = binder_ioctl_set_ctx_mgr(filp, &fbo);
375 + if (ret)
376 + goto err;
377 + break;
378 + }
379 case BINDER_SET_CONTEXT_MGR:
380 - ret = binder_ioctl_set_ctx_mgr(filp);
381 + ret = binder_ioctl_set_ctx_mgr(filp, NULL);
382 if (ret)
383 goto err;
384 break;
385 diff --git a/drivers/base/dd.c b/drivers/base/dd.c
386 index 8ac10af17c004..d62487d024559 100644
387 --- a/drivers/base/dd.c
388 +++ b/drivers/base/dd.c
389 @@ -968,9 +968,9 @@ static void __device_release_driver(struct device *dev, struct device *parent)
390 drv->remove(dev);
391
392 device_links_driver_cleanup(dev);
393 - arch_teardown_dma_ops(dev);
394
395 devres_release_all(dev);
396 + arch_teardown_dma_ops(dev);
397 dev->driver = NULL;
398 dev_set_drvdata(dev, NULL);
399 if (dev->pm_domain && dev->pm_domain->dismiss)
400 diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
401 index 41405de27d665..c91bba00df4e4 100644
402 --- a/drivers/bluetooth/btrtl.c
403 +++ b/drivers/bluetooth/btrtl.c
404 @@ -552,10 +552,9 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
405 hdev->bus);
406
407 if (!btrtl_dev->ic_info) {
408 - rtl_dev_err(hdev, "rtl: unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
409 + rtl_dev_info(hdev, "rtl: unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
410 lmp_subver, hci_rev, hci_ver);
411 - ret = -EINVAL;
412 - goto err_free;
413 + return btrtl_dev;
414 }
415
416 if (btrtl_dev->ic_info->has_rom_version) {
417 @@ -610,6 +609,11 @@ int btrtl_download_firmware(struct hci_dev *hdev,
418 * standard btusb. Once that firmware is uploaded, the subver changes
419 * to a different value.
420 */
421 + if (!btrtl_dev->ic_info) {
422 + rtl_dev_info(hdev, "rtl: assuming no firmware upload needed\n");
423 + return 0;
424 + }
425 +
426 switch (btrtl_dev->ic_info->lmp_subver) {
427 case RTL_ROM_LMP_8723A:
428 case RTL_ROM_LMP_3499:
429 diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
430 index c0a5b1f3a9863..4ccc39e00ced3 100644
431 --- a/drivers/char/applicom.c
432 +++ b/drivers/char/applicom.c
433 @@ -32,6 +32,7 @@
434 #include <linux/wait.h>
435 #include <linux/init.h>
436 #include <linux/fs.h>
437 +#include <linux/nospec.h>
438
439 #include <asm/io.h>
440 #include <linux/uaccess.h>
441 @@ -386,7 +387,11 @@ static ssize_t ac_write(struct file *file, const char __user *buf, size_t count,
442 TicCard = st_loc.tic_des_from_pc; /* tic number to send */
443 IndexCard = NumCard - 1;
444
445 - if((NumCard < 1) || (NumCard > MAX_BOARD) || !apbs[IndexCard].RamIO)
446 + if (IndexCard >= MAX_BOARD)
447 + return -EINVAL;
448 + IndexCard = array_index_nospec(IndexCard, MAX_BOARD);
449 +
450 + if (!apbs[IndexCard].RamIO)
451 return -EINVAL;
452
453 #ifdef DEBUG
454 @@ -697,6 +702,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
455 unsigned char IndexCard;
456 void __iomem *pmem;
457 int ret = 0;
458 + static int warncount = 10;
459 volatile unsigned char byte_reset_it;
460 struct st_ram_io *adgl;
461 void __user *argp = (void __user *)arg;
462 @@ -711,16 +717,12 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
463 mutex_lock(&ac_mutex);
464 IndexCard = adgl->num_card-1;
465
466 - if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
467 - static int warncount = 10;
468 - if (warncount) {
469 - printk( KERN_WARNING "APPLICOM driver IOCTL, bad board number %d\n",(int)IndexCard+1);
470 - warncount--;
471 - }
472 - kfree(adgl);
473 - mutex_unlock(&ac_mutex);
474 - return -EINVAL;
475 - }
476 + if (cmd != 6 && IndexCard >= MAX_BOARD)
477 + goto err;
478 + IndexCard = array_index_nospec(IndexCard, MAX_BOARD);
479 +
480 + if (cmd != 6 && !apbs[IndexCard].RamIO)
481 + goto err;
482
483 switch (cmd) {
484
485 @@ -838,5 +840,16 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
486 kfree(adgl);
487 mutex_unlock(&ac_mutex);
488 return 0;
489 +
490 +err:
491 + if (warncount) {
492 + pr_warn("APPLICOM driver IOCTL, bad board number %d\n",
493 + (int)IndexCard + 1);
494 + warncount--;
495 + }
496 + kfree(adgl);
497 + mutex_unlock(&ac_mutex);
498 + return -EINVAL;
499 +
500 }
501
502 diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
503 index e35a886e00bcf..ef0e33e21b988 100644
504 --- a/drivers/cpufreq/cpufreq.c
505 +++ b/drivers/cpufreq/cpufreq.c
506 @@ -545,13 +545,13 @@ EXPORT_SYMBOL_GPL(cpufreq_policy_transition_delay_us);
507 * SYSFS INTERFACE *
508 *********************************************************************/
509 static ssize_t show_boost(struct kobject *kobj,
510 - struct attribute *attr, char *buf)
511 + struct kobj_attribute *attr, char *buf)
512 {
513 return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled);
514 }
515
516 -static ssize_t store_boost(struct kobject *kobj, struct attribute *attr,
517 - const char *buf, size_t count)
518 +static ssize_t store_boost(struct kobject *kobj, struct kobj_attribute *attr,
519 + const char *buf, size_t count)
520 {
521 int ret, enable;
522
523 diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
524 index dd66decf2087c..5ab6a4fe93aa6 100644
525 --- a/drivers/cpufreq/intel_pstate.c
526 +++ b/drivers/cpufreq/intel_pstate.c
527 @@ -895,7 +895,7 @@ static void intel_pstate_update_policies(void)
528 /************************** sysfs begin ************************/
529 #define show_one(file_name, object) \
530 static ssize_t show_##file_name \
531 - (struct kobject *kobj, struct attribute *attr, char *buf) \
532 + (struct kobject *kobj, struct kobj_attribute *attr, char *buf) \
533 { \
534 return sprintf(buf, "%u\n", global.object); \
535 }
536 @@ -904,7 +904,7 @@ static ssize_t intel_pstate_show_status(char *buf);
537 static int intel_pstate_update_status(const char *buf, size_t size);
538
539 static ssize_t show_status(struct kobject *kobj,
540 - struct attribute *attr, char *buf)
541 + struct kobj_attribute *attr, char *buf)
542 {
543 ssize_t ret;
544
545 @@ -915,7 +915,7 @@ static ssize_t show_status(struct kobject *kobj,
546 return ret;
547 }
548
549 -static ssize_t store_status(struct kobject *a, struct attribute *b,
550 +static ssize_t store_status(struct kobject *a, struct kobj_attribute *b,
551 const char *buf, size_t count)
552 {
553 char *p = memchr(buf, '\n', count);
554 @@ -929,7 +929,7 @@ static ssize_t store_status(struct kobject *a, struct attribute *b,
555 }
556
557 static ssize_t show_turbo_pct(struct kobject *kobj,
558 - struct attribute *attr, char *buf)
559 + struct kobj_attribute *attr, char *buf)
560 {
561 struct cpudata *cpu;
562 int total, no_turbo, turbo_pct;
563 @@ -955,7 +955,7 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
564 }
565
566 static ssize_t show_num_pstates(struct kobject *kobj,
567 - struct attribute *attr, char *buf)
568 + struct kobj_attribute *attr, char *buf)
569 {
570 struct cpudata *cpu;
571 int total;
572 @@ -976,7 +976,7 @@ static ssize_t show_num_pstates(struct kobject *kobj,
573 }
574
575 static ssize_t show_no_turbo(struct kobject *kobj,
576 - struct attribute *attr, char *buf)
577 + struct kobj_attribute *attr, char *buf)
578 {
579 ssize_t ret;
580
581 @@ -998,7 +998,7 @@ static ssize_t show_no_turbo(struct kobject *kobj,
582 return ret;
583 }
584
585 -static ssize_t store_no_turbo(struct kobject *a, struct attribute *b,
586 +static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
587 const char *buf, size_t count)
588 {
589 unsigned int input;
590 @@ -1045,7 +1045,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b,
591 return count;
592 }
593
594 -static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
595 +static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b,
596 const char *buf, size_t count)
597 {
598 unsigned int input;
599 @@ -1075,7 +1075,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
600 return count;
601 }
602
603 -static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
604 +static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b,
605 const char *buf, size_t count)
606 {
607 unsigned int input;
608 @@ -1107,12 +1107,13 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
609 }
610
611 static ssize_t show_hwp_dynamic_boost(struct kobject *kobj,
612 - struct attribute *attr, char *buf)
613 + struct kobj_attribute *attr, char *buf)
614 {
615 return sprintf(buf, "%u\n", hwp_boost);
616 }
617
618 -static ssize_t store_hwp_dynamic_boost(struct kobject *a, struct attribute *b,
619 +static ssize_t store_hwp_dynamic_boost(struct kobject *a,
620 + struct kobj_attribute *b,
621 const char *buf, size_t count)
622 {
623 unsigned int input;
624 diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c
625 index 226f6e6fe01bc..8e3f6a776e02e 100644
626 --- a/drivers/gnss/sirf.c
627 +++ b/drivers/gnss/sirf.c
628 @@ -310,30 +310,26 @@ static int sirf_probe(struct serdev_device *serdev)
629 ret = -ENODEV;
630 goto err_put_device;
631 }
632 +
633 + ret = regulator_enable(data->vcc);
634 + if (ret)
635 + goto err_put_device;
636 +
637 + /* Wait for chip to boot into hibernate mode. */
638 + msleep(SIRF_BOOT_DELAY);
639 }
640
641 if (data->wakeup) {
642 ret = gpiod_to_irq(data->wakeup);
643 if (ret < 0)
644 - goto err_put_device;
645 -
646 + goto err_disable_vcc;
647 data->irq = ret;
648
649 - ret = devm_request_threaded_irq(dev, data->irq, NULL,
650 - sirf_wakeup_handler,
651 + ret = request_threaded_irq(data->irq, NULL, sirf_wakeup_handler,
652 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
653 "wakeup", data);
654 if (ret)
655 - goto err_put_device;
656 - }
657 -
658 - if (data->on_off) {
659 - ret = regulator_enable(data->vcc);
660 - if (ret)
661 - goto err_put_device;
662 -
663 - /* Wait for chip to boot into hibernate mode */
664 - msleep(SIRF_BOOT_DELAY);
665 + goto err_disable_vcc;
666 }
667
668 if (IS_ENABLED(CONFIG_PM)) {
669 @@ -342,7 +338,7 @@ static int sirf_probe(struct serdev_device *serdev)
670 } else {
671 ret = sirf_runtime_resume(dev);
672 if (ret < 0)
673 - goto err_disable_vcc;
674 + goto err_free_irq;
675 }
676
677 ret = gnss_register_device(gdev);
678 @@ -356,6 +352,9 @@ err_disable_rpm:
679 pm_runtime_disable(dev);
680 else
681 sirf_runtime_suspend(dev);
682 +err_free_irq:
683 + if (data->wakeup)
684 + free_irq(data->irq, data);
685 err_disable_vcc:
686 if (data->on_off)
687 regulator_disable(data->vcc);
688 @@ -376,6 +375,9 @@ static void sirf_remove(struct serdev_device *serdev)
689 else
690 sirf_runtime_suspend(&serdev->dev);
691
692 + if (data->wakeup)
693 + free_irq(data->irq, data);
694 +
695 if (data->on_off)
696 regulator_disable(data->vcc);
697
698 diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
699 index 7e3c00bd9532a..76cc163b3cf15 100644
700 --- a/drivers/net/dsa/mv88e6xxx/chip.c
701 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
702 @@ -4222,7 +4222,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
703 .name = "Marvell 88E6190",
704 .num_databases = 4096,
705 .num_ports = 11, /* 10 + Z80 */
706 - .num_internal_phys = 11,
707 + .num_internal_phys = 9,
708 .num_gpio = 16,
709 .max_vid = 8191,
710 .port_base_addr = 0x0,
711 @@ -4245,7 +4245,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
712 .name = "Marvell 88E6190X",
713 .num_databases = 4096,
714 .num_ports = 11, /* 10 + Z80 */
715 - .num_internal_phys = 11,
716 + .num_internal_phys = 9,
717 .num_gpio = 16,
718 .max_vid = 8191,
719 .port_base_addr = 0x0,
720 @@ -4268,7 +4268,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
721 .name = "Marvell 88E6191",
722 .num_databases = 4096,
723 .num_ports = 11, /* 10 + Z80 */
724 - .num_internal_phys = 11,
725 + .num_internal_phys = 9,
726 .max_vid = 8191,
727 .port_base_addr = 0x0,
728 .phy_base_addr = 0x0,
729 @@ -4315,7 +4315,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
730 .name = "Marvell 88E6290",
731 .num_databases = 4096,
732 .num_ports = 11, /* 10 + Z80 */
733 - .num_internal_phys = 11,
734 + .num_internal_phys = 9,
735 .num_gpio = 16,
736 .max_vid = 8191,
737 .port_base_addr = 0x0,
738 @@ -4477,7 +4477,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
739 .name = "Marvell 88E6390",
740 .num_databases = 4096,
741 .num_ports = 11, /* 10 + Z80 */
742 - .num_internal_phys = 11,
743 + .num_internal_phys = 9,
744 .num_gpio = 16,
745 .max_vid = 8191,
746 .port_base_addr = 0x0,
747 @@ -4500,7 +4500,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
748 .name = "Marvell 88E6390X",
749 .num_databases = 4096,
750 .num_ports = 11, /* 10 + Z80 */
751 - .num_internal_phys = 11,
752 + .num_internal_phys = 9,
753 .num_gpio = 16,
754 .max_vid = 8191,
755 .port_base_addr = 0x0,
756 @@ -4847,6 +4847,7 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
757 if (err)
758 goto out;
759
760 + mv88e6xxx_ports_cmode_init(chip);
761 mv88e6xxx_phy_init(chip);
762
763 if (chip->info->ops->get_eeprom) {
764 diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c
765 index 79ab51e69aee4..184c2b1b31159 100644
766 --- a/drivers/net/dsa/mv88e6xxx/port.c
767 +++ b/drivers/net/dsa/mv88e6xxx/port.c
768 @@ -190,7 +190,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup)
769 /* normal duplex detection */
770 break;
771 default:
772 - return -EINVAL;
773 + return -EOPNOTSUPP;
774 }
775
776 err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg);
777 diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
778 index 57727fe1501ee..8b3495ee2b6eb 100644
779 --- a/drivers/net/ethernet/marvell/sky2.c
780 +++ b/drivers/net/ethernet/marvell/sky2.c
781 @@ -46,6 +46,7 @@
782 #include <linux/mii.h>
783 #include <linux/of_device.h>
784 #include <linux/of_net.h>
785 +#include <linux/dmi.h>
786
787 #include <asm/irq.h>
788
789 @@ -93,7 +94,7 @@ static int copybreak __read_mostly = 128;
790 module_param(copybreak, int, 0);
791 MODULE_PARM_DESC(copybreak, "Receive copy threshold");
792
793 -static int disable_msi = 0;
794 +static int disable_msi = -1;
795 module_param(disable_msi, int, 0);
796 MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
797
798 @@ -4917,6 +4918,24 @@ static const char *sky2_name(u8 chipid, char *buf, int sz)
799 return buf;
800 }
801
802 +static const struct dmi_system_id msi_blacklist[] = {
803 + {
804 + .ident = "Dell Inspiron 1545",
805 + .matches = {
806 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
807 + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1545"),
808 + },
809 + },
810 + {
811 + .ident = "Gateway P-79",
812 + .matches = {
813 + DMI_MATCH(DMI_SYS_VENDOR, "Gateway"),
814 + DMI_MATCH(DMI_PRODUCT_NAME, "P-79"),
815 + },
816 + },
817 + {}
818 +};
819 +
820 static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
821 {
822 struct net_device *dev, *dev1;
823 @@ -5028,6 +5047,9 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
824 goto err_out_free_pci;
825 }
826
827 + if (disable_msi == -1)
828 + disable_msi = !!dmi_check_system(msi_blacklist);
829 +
830 if (!disable_msi && pci_enable_msi(pdev) == 0) {
831 err = sky2_test_msi(hw);
832 if (err) {
833 diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
834 index ca3ea2fbfcd08..80d87798c62b8 100644
835 --- a/drivers/net/ethernet/mscc/ocelot_board.c
836 +++ b/drivers/net/ethernet/mscc/ocelot_board.c
837 @@ -267,6 +267,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
838 struct phy *serdes;
839 void __iomem *regs;
840 char res_name[8];
841 + int phy_mode;
842 u32 port;
843
844 if (of_property_read_u32(portnp, "reg", &port))
845 @@ -292,11 +293,11 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
846 if (err)
847 return err;
848
849 - err = of_get_phy_mode(portnp);
850 - if (err < 0)
851 + phy_mode = of_get_phy_mode(portnp);
852 + if (phy_mode < 0)
853 ocelot->ports[port]->phy_mode = PHY_INTERFACE_MODE_NA;
854 else
855 - ocelot->ports[port]->phy_mode = err;
856 + ocelot->ports[port]->phy_mode = phy_mode;
857
858 switch (ocelot->ports[port]->phy_mode) {
859 case PHY_INTERFACE_MODE_NA:
860 @@ -304,6 +305,13 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
861 case PHY_INTERFACE_MODE_SGMII:
862 break;
863 case PHY_INTERFACE_MODE_QSGMII:
864 + /* Ensure clock signals and speed is set on all
865 + * QSGMII links
866 + */
867 + ocelot_port_writel(ocelot->ports[port],
868 + DEV_CLOCK_CFG_LINK_SPEED
869 + (OCELOT_SPEED_1000),
870 + DEV_CLOCK_CFG);
871 break;
872 default:
873 dev_err(ocelot->dev,
874 diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
875 index a5ef97010eb34..5541e1c19936c 100644
876 --- a/drivers/net/team/team_mode_loadbalance.c
877 +++ b/drivers/net/team/team_mode_loadbalance.c
878 @@ -325,6 +325,20 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx)
879 return 0;
880 }
881
882 +static void lb_bpf_func_free(struct team *team)
883 +{
884 + struct lb_priv *lb_priv = get_lb_priv(team);
885 + struct bpf_prog *fp;
886 +
887 + if (!lb_priv->ex->orig_fprog)
888 + return;
889 +
890 + __fprog_destroy(lb_priv->ex->orig_fprog);
891 + fp = rcu_dereference_protected(lb_priv->fp,
892 + lockdep_is_held(&team->lock));
893 + bpf_prog_destroy(fp);
894 +}
895 +
896 static int lb_tx_method_get(struct team *team, struct team_gsetter_ctx *ctx)
897 {
898 struct lb_priv *lb_priv = get_lb_priv(team);
899 @@ -639,6 +653,7 @@ static void lb_exit(struct team *team)
900
901 team_options_unregister(team, lb_options,
902 ARRAY_SIZE(lb_options));
903 + lb_bpf_func_free(team);
904 cancel_delayed_work_sync(&lb_priv->ex->stats.refresh_dw);
905 free_percpu(lb_priv->pcpu_stats);
906 kfree(lb_priv->ex);
907 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
908 index 18af2f8eee96a..74bebbdb4b158 100644
909 --- a/drivers/net/usb/qmi_wwan.c
910 +++ b/drivers/net/usb/qmi_wwan.c
911 @@ -976,6 +976,13 @@ static const struct usb_device_id products[] = {
912 0xff),
913 .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,
914 },
915 + { /* Quectel EG12/EM12 */
916 + USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0512,
917 + USB_CLASS_VENDOR_SPEC,
918 + USB_SUBCLASS_VENDOR_SPEC,
919 + 0xff),
920 + .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,
921 + },
922
923 /* 3. Combined interface devices matching on interface number */
924 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
925 @@ -1343,17 +1350,20 @@ static bool quectel_ec20_detected(struct usb_interface *intf)
926 return false;
927 }
928
929 -static bool quectel_ep06_diag_detected(struct usb_interface *intf)
930 +static bool quectel_diag_detected(struct usb_interface *intf)
931 {
932 struct usb_device *dev = interface_to_usbdev(intf);
933 struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc;
934 + u16 id_vendor = le16_to_cpu(dev->descriptor.idVendor);
935 + u16 id_product = le16_to_cpu(dev->descriptor.idProduct);
936
937 - if (le16_to_cpu(dev->descriptor.idVendor) == 0x2c7c &&
938 - le16_to_cpu(dev->descriptor.idProduct) == 0x0306 &&
939 - intf_desc.bNumEndpoints == 2)
940 - return true;
941 + if (id_vendor != 0x2c7c || intf_desc.bNumEndpoints != 2)
942 + return false;
943
944 - return false;
945 + if (id_product == 0x0306 || id_product == 0x0512)
946 + return true;
947 + else
948 + return false;
949 }
950
951 static int qmi_wwan_probe(struct usb_interface *intf,
952 @@ -1390,13 +1400,13 @@ static int qmi_wwan_probe(struct usb_interface *intf,
953 return -ENODEV;
954 }
955
956 - /* Quectel EP06/EM06/EG06 supports dynamic interface configuration, so
957 + /* Several Quectel modems supports dynamic interface configuration, so
958 * we need to match on class/subclass/protocol. These values are
959 * identical for the diagnostic- and QMI-interface, but bNumEndpoints is
960 * different. Ignore the current interface if the number of endpoints
961 * the number for the diag interface (two).
962 */
963 - if (quectel_ep06_diag_detected(intf))
964 + if (quectel_diag_detected(intf))
965 return -ENODEV;
966
967 return usbnet_probe(intf, id);
968 diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
969 index 90a8a9f1ac7d8..910826df4a316 100644
970 --- a/drivers/staging/android/ashmem.c
971 +++ b/drivers/staging/android/ashmem.c
972 @@ -75,6 +75,9 @@ struct ashmem_range {
973 /* LRU list of unpinned pages, protected by ashmem_mutex */
974 static LIST_HEAD(ashmem_lru_list);
975
976 +static atomic_t ashmem_shrink_inflight = ATOMIC_INIT(0);
977 +static DECLARE_WAIT_QUEUE_HEAD(ashmem_shrink_wait);
978 +
979 /*
980 * long lru_count - The count of pages on our LRU list.
981 *
982 @@ -168,19 +171,15 @@ static inline void lru_del(struct ashmem_range *range)
983 * @end: The ending page (inclusive)
984 *
985 * This function is protected by ashmem_mutex.
986 - *
987 - * Return: 0 if successful, or -ENOMEM if there is an error
988 */
989 -static int range_alloc(struct ashmem_area *asma,
990 - struct ashmem_range *prev_range, unsigned int purged,
991 - size_t start, size_t end)
992 +static void range_alloc(struct ashmem_area *asma,
993 + struct ashmem_range *prev_range, unsigned int purged,
994 + size_t start, size_t end,
995 + struct ashmem_range **new_range)
996 {
997 - struct ashmem_range *range;
998 -
999 - range = kmem_cache_zalloc(ashmem_range_cachep, GFP_KERNEL);
1000 - if (!range)
1001 - return -ENOMEM;
1002 + struct ashmem_range *range = *new_range;
1003
1004 + *new_range = NULL;
1005 range->asma = asma;
1006 range->pgstart = start;
1007 range->pgend = end;
1008 @@ -190,8 +189,6 @@ static int range_alloc(struct ashmem_area *asma,
1009
1010 if (range_on_lru(range))
1011 lru_add(range);
1012 -
1013 - return 0;
1014 }
1015
1016 /**
1017 @@ -438,7 +435,6 @@ out:
1018 static unsigned long
1019 ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
1020 {
1021 - struct ashmem_range *range, *next;
1022 unsigned long freed = 0;
1023
1024 /* We might recurse into filesystem code, so bail out if necessary */
1025 @@ -448,21 +444,33 @@ ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
1026 if (!mutex_trylock(&ashmem_mutex))
1027 return -1;
1028
1029 - list_for_each_entry_safe(range, next, &ashmem_lru_list, lru) {
1030 + while (!list_empty(&ashmem_lru_list)) {
1031 + struct ashmem_range *range =
1032 + list_first_entry(&ashmem_lru_list, typeof(*range), lru);
1033 loff_t start = range->pgstart * PAGE_SIZE;
1034 loff_t end = (range->pgend + 1) * PAGE_SIZE;
1035 + struct file *f = range->asma->file;
1036
1037 - range->asma->file->f_op->fallocate(range->asma->file,
1038 - FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
1039 - start, end - start);
1040 + get_file(f);
1041 + atomic_inc(&ashmem_shrink_inflight);
1042 range->purged = ASHMEM_WAS_PURGED;
1043 lru_del(range);
1044
1045 freed += range_size(range);
1046 + mutex_unlock(&ashmem_mutex);
1047 + f->f_op->fallocate(f,
1048 + FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
1049 + start, end - start);
1050 + fput(f);
1051 + if (atomic_dec_and_test(&ashmem_shrink_inflight))
1052 + wake_up_all(&ashmem_shrink_wait);
1053 + if (!mutex_trylock(&ashmem_mutex))
1054 + goto out;
1055 if (--sc->nr_to_scan <= 0)
1056 break;
1057 }
1058 mutex_unlock(&ashmem_mutex);
1059 +out:
1060 return freed;
1061 }
1062
1063 @@ -582,7 +590,8 @@ static int get_name(struct ashmem_area *asma, void __user *name)
1064 *
1065 * Caller must hold ashmem_mutex.
1066 */
1067 -static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1068 +static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend,
1069 + struct ashmem_range **new_range)
1070 {
1071 struct ashmem_range *range, *next;
1072 int ret = ASHMEM_NOT_PURGED;
1073 @@ -635,7 +644,7 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1074 * second half and adjust the first chunk's endpoint.
1075 */
1076 range_alloc(asma, range, range->purged,
1077 - pgend + 1, range->pgend);
1078 + pgend + 1, range->pgend, new_range);
1079 range_shrink(range, range->pgstart, pgstart - 1);
1080 break;
1081 }
1082 @@ -649,7 +658,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1083 *
1084 * Caller must hold ashmem_mutex.
1085 */
1086 -static int ashmem_unpin(struct ashmem_area *asma, size_t pgstart, size_t pgend)
1087 +static int ashmem_unpin(struct ashmem_area *asma, size_t pgstart, size_t pgend,
1088 + struct ashmem_range **new_range)
1089 {
1090 struct ashmem_range *range, *next;
1091 unsigned int purged = ASHMEM_NOT_PURGED;
1092 @@ -675,7 +685,8 @@ restart:
1093 }
1094 }
1095
1096 - return range_alloc(asma, range, purged, pgstart, pgend);
1097 + range_alloc(asma, range, purged, pgstart, pgend, new_range);
1098 + return 0;
1099 }
1100
1101 /*
1102 @@ -708,11 +719,19 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
1103 struct ashmem_pin pin;
1104 size_t pgstart, pgend;
1105 int ret = -EINVAL;
1106 + struct ashmem_range *range = NULL;
1107
1108 if (copy_from_user(&pin, p, sizeof(pin)))
1109 return -EFAULT;
1110
1111 + if (cmd == ASHMEM_PIN || cmd == ASHMEM_UNPIN) {
1112 + range = kmem_cache_zalloc(ashmem_range_cachep, GFP_KERNEL);
1113 + if (!range)
1114 + return -ENOMEM;
1115 + }
1116 +
1117 mutex_lock(&ashmem_mutex);
1118 + wait_event(ashmem_shrink_wait, !atomic_read(&ashmem_shrink_inflight));
1119
1120 if (!asma->file)
1121 goto out_unlock;
1122 @@ -735,10 +754,10 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
1123
1124 switch (cmd) {
1125 case ASHMEM_PIN:
1126 - ret = ashmem_pin(asma, pgstart, pgend);
1127 + ret = ashmem_pin(asma, pgstart, pgend, &range);
1128 break;
1129 case ASHMEM_UNPIN:
1130 - ret = ashmem_unpin(asma, pgstart, pgend);
1131 + ret = ashmem_unpin(asma, pgstart, pgend, &range);
1132 break;
1133 case ASHMEM_GET_PIN_STATUS:
1134 ret = ashmem_get_pin_status(asma, pgstart, pgend);
1135 @@ -747,6 +766,8 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
1136
1137 out_unlock:
1138 mutex_unlock(&ashmem_mutex);
1139 + if (range)
1140 + kmem_cache_free(ashmem_range_cachep, range);
1141
1142 return ret;
1143 }
1144 diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
1145 index 0383f7548d48e..20f2103a4ebfb 100644
1146 --- a/drivers/staging/android/ion/ion_system_heap.c
1147 +++ b/drivers/staging/android/ion/ion_system_heap.c
1148 @@ -223,10 +223,10 @@ static void ion_system_heap_destroy_pools(struct ion_page_pool **pools)
1149 static int ion_system_heap_create_pools(struct ion_page_pool **pools)
1150 {
1151 int i;
1152 - gfp_t gfp_flags = low_order_gfp_flags;
1153
1154 for (i = 0; i < NUM_ORDERS; i++) {
1155 struct ion_page_pool *pool;
1156 + gfp_t gfp_flags = low_order_gfp_flags;
1157
1158 if (orders[i] > 4)
1159 gfp_flags = high_order_gfp_flags;
1160 diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
1161 index e70a461e723f8..405573e927cfc 100644
1162 --- a/drivers/staging/comedi/drivers/ni_660x.c
1163 +++ b/drivers/staging/comedi/drivers/ni_660x.c
1164 @@ -656,6 +656,7 @@ static int ni_660x_set_pfi_routing(struct comedi_device *dev,
1165 case NI_660X_PFI_OUTPUT_DIO:
1166 if (chan > 31)
1167 return -EINVAL;
1168 + break;
1169 default:
1170 return -EINVAL;
1171 }
1172 diff --git a/drivers/staging/erofs/inode.c b/drivers/staging/erofs/inode.c
1173 index d7fbf5f4600f3..f99954dbfdb58 100644
1174 --- a/drivers/staging/erofs/inode.c
1175 +++ b/drivers/staging/erofs/inode.c
1176 @@ -185,16 +185,16 @@ static int fill_inode(struct inode *inode, int isdir)
1177 /* setup the new inode */
1178 if (S_ISREG(inode->i_mode)) {
1179 #ifdef CONFIG_EROFS_FS_XATTR
1180 - if (vi->xattr_isize)
1181 - inode->i_op = &erofs_generic_xattr_iops;
1182 + inode->i_op = &erofs_generic_xattr_iops;
1183 #endif
1184 inode->i_fop = &generic_ro_fops;
1185 } else if (S_ISDIR(inode->i_mode)) {
1186 inode->i_op =
1187 #ifdef CONFIG_EROFS_FS_XATTR
1188 - vi->xattr_isize ? &erofs_dir_xattr_iops :
1189 -#endif
1190 + &erofs_dir_xattr_iops;
1191 +#else
1192 &erofs_dir_iops;
1193 +#endif
1194 inode->i_fop = &erofs_dir_fops;
1195 } else if (S_ISLNK(inode->i_mode)) {
1196 /* by default, page_get_link is used for symlink */
1197 diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h
1198 index e049d00c087a0..16249d7f08953 100644
1199 --- a/drivers/staging/erofs/internal.h
1200 +++ b/drivers/staging/erofs/internal.h
1201 @@ -354,12 +354,17 @@ static inline erofs_off_t iloc(struct erofs_sb_info *sbi, erofs_nid_t nid)
1202 return blknr_to_addr(sbi->meta_blkaddr) + (nid << sbi->islotbits);
1203 }
1204
1205 -#define inode_set_inited_xattr(inode) (EROFS_V(inode)->flags |= 1)
1206 -#define inode_has_inited_xattr(inode) (EROFS_V(inode)->flags & 1)
1207 +/* atomic flag definitions */
1208 +#define EROFS_V_EA_INITED_BIT 0
1209 +
1210 +/* bitlock definitions (arranged in reverse order) */
1211 +#define EROFS_V_BL_XATTR_BIT (BITS_PER_LONG - 1)
1212
1213 struct erofs_vnode {
1214 erofs_nid_t nid;
1215 - unsigned int flags;
1216 +
1217 + /* atomic flags (including bitlocks) */
1218 + unsigned long flags;
1219
1220 unsigned char data_mapping_mode;
1221 /* inline size in bytes */
1222 diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
1223 index 4ac1099a39c6c..ca2e8fd789591 100644
1224 --- a/drivers/staging/erofs/unzip_vle.c
1225 +++ b/drivers/staging/erofs/unzip_vle.c
1226 @@ -107,15 +107,30 @@ enum z_erofs_vle_work_role {
1227 Z_EROFS_VLE_WORK_SECONDARY,
1228 Z_EROFS_VLE_WORK_PRIMARY,
1229 /*
1230 - * The current work has at least been linked with the following
1231 - * processed chained works, which means if the processing page
1232 - * is the tail partial page of the work, the current work can
1233 - * safely use the whole page, as illustrated below:
1234 - * +--------------+-------------------------------------------+
1235 - * | tail page | head page (of the previous work) |
1236 - * +--------------+-------------------------------------------+
1237 - * /\ which belongs to the current work
1238 - * [ (*) this page can be used for the current work itself. ]
1239 + * The current work was the tail of an exist chain, and the previous
1240 + * processed chained works are all decided to be hooked up to it.
1241 + * A new chain should be created for the remaining unprocessed works,
1242 + * therefore different from Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED,
1243 + * the next work cannot reuse the whole page in the following scenario:
1244 + * ________________________________________________________________
1245 + * | tail (partial) page | head (partial) page |
1246 + * | (belongs to the next work) | (belongs to the current work) |
1247 + * |_______PRIMARY_FOLLOWED_______|________PRIMARY_HOOKED___________|
1248 + */
1249 + Z_EROFS_VLE_WORK_PRIMARY_HOOKED,
1250 + /*
1251 + * The current work has been linked with the processed chained works,
1252 + * and could be also linked with the potential remaining works, which
1253 + * means if the processing page is the tail partial page of the work,
1254 + * the current work can safely use the whole page (since the next work
1255 + * is under control) for in-place decompression, as illustrated below:
1256 + * ________________________________________________________________
1257 + * | tail (partial) page | head (partial) page |
1258 + * | (of the current work) | (of the previous work) |
1259 + * | PRIMARY_FOLLOWED or | |
1260 + * |_____PRIMARY_HOOKED____|____________PRIMARY_FOLLOWED____________|
1261 + *
1262 + * [ (*) the above page can be used for the current work itself. ]
1263 */
1264 Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED,
1265 Z_EROFS_VLE_WORK_MAX
1266 @@ -315,10 +330,10 @@ static int z_erofs_vle_work_add_page(
1267 return ret ? 0 : -EAGAIN;
1268 }
1269
1270 -static inline bool try_to_claim_workgroup(
1271 - struct z_erofs_vle_workgroup *grp,
1272 - z_erofs_vle_owned_workgrp_t *owned_head,
1273 - bool *hosted)
1274 +static enum z_erofs_vle_work_role
1275 +try_to_claim_workgroup(struct z_erofs_vle_workgroup *grp,
1276 + z_erofs_vle_owned_workgrp_t *owned_head,
1277 + bool *hosted)
1278 {
1279 DBG_BUGON(*hosted == true);
1280
1281 @@ -332,6 +347,9 @@ retry:
1282
1283 *owned_head = &grp->next;
1284 *hosted = true;
1285 + /* lucky, I am the followee :) */
1286 + return Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED;
1287 +
1288 } else if (grp->next == Z_EROFS_VLE_WORKGRP_TAIL) {
1289 /*
1290 * type 2, link to the end of a existing open chain,
1291 @@ -341,12 +359,11 @@ retry:
1292 if (cmpxchg(&grp->next, Z_EROFS_VLE_WORKGRP_TAIL,
1293 *owned_head) != Z_EROFS_VLE_WORKGRP_TAIL)
1294 goto retry;
1295 -
1296 *owned_head = Z_EROFS_VLE_WORKGRP_TAIL;
1297 - } else
1298 - return false; /* :( better luck next time */
1299 + return Z_EROFS_VLE_WORK_PRIMARY_HOOKED;
1300 + }
1301
1302 - return true; /* lucky, I am the followee :) */
1303 + return Z_EROFS_VLE_WORK_PRIMARY; /* :( better luck next time */
1304 }
1305
1306 struct z_erofs_vle_work_finder {
1307 @@ -424,12 +441,9 @@ z_erofs_vle_work_lookup(const struct z_erofs_vle_work_finder *f)
1308 *f->hosted = false;
1309 if (!primary)
1310 *f->role = Z_EROFS_VLE_WORK_SECONDARY;
1311 - /* claim the workgroup if possible */
1312 - else if (try_to_claim_workgroup(grp, f->owned_head, f->hosted))
1313 - *f->role = Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED;
1314 - else
1315 - *f->role = Z_EROFS_VLE_WORK_PRIMARY;
1316 -
1317 + else /* claim the workgroup if possible */
1318 + *f->role = try_to_claim_workgroup(grp, f->owned_head,
1319 + f->hosted);
1320 return work;
1321 }
1322
1323 @@ -493,6 +507,9 @@ z_erofs_vle_work_register(const struct z_erofs_vle_work_finder *f,
1324 return work;
1325 }
1326
1327 +#define builder_is_hooked(builder) \
1328 + ((builder)->role >= Z_EROFS_VLE_WORK_PRIMARY_HOOKED)
1329 +
1330 #define builder_is_followed(builder) \
1331 ((builder)->role >= Z_EROFS_VLE_WORK_PRIMARY_FOLLOWED)
1332
1333 @@ -686,7 +703,7 @@ static int z_erofs_do_read_page(struct z_erofs_vle_frontend *fe,
1334 struct z_erofs_vle_work_builder *const builder = &fe->builder;
1335 const loff_t offset = page_offset(page);
1336
1337 - bool tight = builder_is_followed(builder);
1338 + bool tight = builder_is_hooked(builder);
1339 struct z_erofs_vle_work *work = builder->work;
1340
1341 enum z_erofs_cache_alloctype cache_strategy;
1342 @@ -704,8 +721,12 @@ repeat:
1343
1344 /* lucky, within the range of the current map_blocks */
1345 if (offset + cur >= map->m_la &&
1346 - offset + cur < map->m_la + map->m_llen)
1347 + offset + cur < map->m_la + map->m_llen) {
1348 + /* didn't get a valid unzip work previously (very rare) */
1349 + if (!builder->work)
1350 + goto restart_now;
1351 goto hitted;
1352 + }
1353
1354 /* go ahead the next map_blocks */
1355 debugln("%s: [out-of-range] pos %llu", __func__, offset + cur);
1356 @@ -719,6 +740,7 @@ repeat:
1357 if (unlikely(err))
1358 goto err_out;
1359
1360 +restart_now:
1361 if (unlikely(!(map->m_flags & EROFS_MAP_MAPPED)))
1362 goto hitted;
1363
1364 @@ -740,7 +762,7 @@ repeat:
1365 map->m_plen / PAGE_SIZE,
1366 cache_strategy, page_pool, GFP_KERNEL);
1367
1368 - tight &= builder_is_followed(builder);
1369 + tight &= builder_is_hooked(builder);
1370 work = builder->work;
1371 hitted:
1372 cur = end - min_t(unsigned int, offset + end - map->m_la, end);
1373 @@ -755,6 +777,9 @@ hitted:
1374 (tight ? Z_EROFS_PAGE_TYPE_EXCLUSIVE :
1375 Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED));
1376
1377 + if (cur)
1378 + tight &= builder_is_followed(builder);
1379 +
1380 retry:
1381 err = z_erofs_vle_work_add_page(builder, page, page_type);
1382 /* should allocate an additional staging page for pagevec */
1383 diff --git a/drivers/staging/erofs/xattr.c b/drivers/staging/erofs/xattr.c
1384 index 80dca6a4adbe2..6cb05ae312338 100644
1385 --- a/drivers/staging/erofs/xattr.c
1386 +++ b/drivers/staging/erofs/xattr.c
1387 @@ -44,19 +44,48 @@ static inline void xattr_iter_end_final(struct xattr_iter *it)
1388
1389 static int init_inode_xattrs(struct inode *inode)
1390 {
1391 + struct erofs_vnode *const vi = EROFS_V(inode);
1392 struct xattr_iter it;
1393 unsigned int i;
1394 struct erofs_xattr_ibody_header *ih;
1395 struct super_block *sb;
1396 struct erofs_sb_info *sbi;
1397 - struct erofs_vnode *vi;
1398 bool atomic_map;
1399 + int ret = 0;
1400
1401 - if (likely(inode_has_inited_xattr(inode)))
1402 + /* the most case is that xattrs of this inode are initialized. */
1403 + if (test_bit(EROFS_V_EA_INITED_BIT, &vi->flags))
1404 return 0;
1405
1406 - vi = EROFS_V(inode);
1407 - BUG_ON(!vi->xattr_isize);
1408 + if (wait_on_bit_lock(&vi->flags, EROFS_V_BL_XATTR_BIT, TASK_KILLABLE))
1409 + return -ERESTARTSYS;
1410 +
1411 + /* someone has initialized xattrs for us? */
1412 + if (test_bit(EROFS_V_EA_INITED_BIT, &vi->flags))
1413 + goto out_unlock;
1414 +
1415 + /*
1416 + * bypass all xattr operations if ->xattr_isize is not greater than
1417 + * sizeof(struct erofs_xattr_ibody_header), in detail:
1418 + * 1) it is not enough to contain erofs_xattr_ibody_header then
1419 + * ->xattr_isize should be 0 (it means no xattr);
1420 + * 2) it is just to contain erofs_xattr_ibody_header, which is on-disk
1421 + * undefined right now (maybe use later with some new sb feature).
1422 + */
1423 + if (vi->xattr_isize == sizeof(struct erofs_xattr_ibody_header)) {
1424 + errln("xattr_isize %d of nid %llu is not supported yet",
1425 + vi->xattr_isize, vi->nid);
1426 + ret = -ENOTSUPP;
1427 + goto out_unlock;
1428 + } else if (vi->xattr_isize < sizeof(struct erofs_xattr_ibody_header)) {
1429 + if (unlikely(vi->xattr_isize)) {
1430 + DBG_BUGON(1);
1431 + ret = -EIO;
1432 + goto out_unlock; /* xattr ondisk layout error */
1433 + }
1434 + ret = -ENOATTR;
1435 + goto out_unlock;
1436 + }
1437
1438 sb = inode->i_sb;
1439 sbi = EROFS_SB(sb);
1440 @@ -64,8 +93,10 @@ static int init_inode_xattrs(struct inode *inode)
1441 it.ofs = erofs_blkoff(iloc(sbi, vi->nid) + vi->inode_isize);
1442
1443 it.page = erofs_get_inline_page(inode, it.blkaddr);
1444 - if (IS_ERR(it.page))
1445 - return PTR_ERR(it.page);
1446 + if (IS_ERR(it.page)) {
1447 + ret = PTR_ERR(it.page);
1448 + goto out_unlock;
1449 + }
1450
1451 /* read in shared xattr array (non-atomic, see kmalloc below) */
1452 it.kaddr = kmap(it.page);
1453 @@ -78,7 +109,8 @@ static int init_inode_xattrs(struct inode *inode)
1454 sizeof(uint), GFP_KERNEL);
1455 if (vi->xattr_shared_xattrs == NULL) {
1456 xattr_iter_end(&it, atomic_map);
1457 - return -ENOMEM;
1458 + ret = -ENOMEM;
1459 + goto out_unlock;
1460 }
1461
1462 /* let's skip ibody header */
1463 @@ -92,8 +124,12 @@ static int init_inode_xattrs(struct inode *inode)
1464
1465 it.page = erofs_get_meta_page(sb,
1466 ++it.blkaddr, S_ISDIR(inode->i_mode));
1467 - if (IS_ERR(it.page))
1468 - return PTR_ERR(it.page);
1469 + if (IS_ERR(it.page)) {
1470 + kfree(vi->xattr_shared_xattrs);
1471 + vi->xattr_shared_xattrs = NULL;
1472 + ret = PTR_ERR(it.page);
1473 + goto out_unlock;
1474 + }
1475
1476 it.kaddr = kmap_atomic(it.page);
1477 atomic_map = true;
1478 @@ -105,8 +141,11 @@ static int init_inode_xattrs(struct inode *inode)
1479 }
1480 xattr_iter_end(&it, atomic_map);
1481
1482 - inode_set_inited_xattr(inode);
1483 - return 0;
1484 + set_bit(EROFS_V_EA_INITED_BIT, &vi->flags);
1485 +
1486 +out_unlock:
1487 + clear_and_wake_up_bit(EROFS_V_BL_XATTR_BIT, &vi->flags);
1488 + return ret;
1489 }
1490
1491 /*
1492 @@ -422,7 +461,6 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
1493 struct dentry *unused, struct inode *inode,
1494 const char *name, void *buffer, size_t size)
1495 {
1496 - struct erofs_vnode *const vi = EROFS_V(inode);
1497 struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
1498
1499 switch (handler->flags) {
1500 @@ -440,9 +478,6 @@ static int erofs_xattr_generic_get(const struct xattr_handler *handler,
1501 return -EINVAL;
1502 }
1503
1504 - if (!vi->xattr_isize)
1505 - return -ENOATTR;
1506 -
1507 return erofs_getxattr(inode, handler->flags, name, buffer, size);
1508 }
1509
1510 diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
1511 index 721689048648e..5e5149c9a92d9 100644
1512 --- a/drivers/staging/wilc1000/linux_wlan.c
1513 +++ b/drivers/staging/wilc1000/linux_wlan.c
1514 @@ -1086,8 +1086,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
1515 vif->wilc = *wilc;
1516 vif->ndev = ndev;
1517 wl->vif[i] = vif;
1518 - wl->vif_num = i;
1519 - vif->idx = wl->vif_num;
1520 + wl->vif_num = i + 1;
1521 + vif->idx = i;
1522
1523 ndev->netdev_ops = &wilc_netdev_ops;
1524
1525 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1526 index a9ec7051f2864..c2fe218e051f0 100644
1527 --- a/drivers/usb/host/xhci-pci.c
1528 +++ b/drivers/usb/host/xhci-pci.c
1529 @@ -194,6 +194,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1530 xhci->quirks |= XHCI_SSIC_PORT_UNUSED;
1531 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
1532 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
1533 + pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
1534 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI))
1535 xhci->quirks |= XHCI_INTEL_USB_ROLE_SW;
1536 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
1537 diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
1538 index 938ff06c03495..efb0cad8710e3 100644
1539 --- a/drivers/usb/host/xhci-tegra.c
1540 +++ b/drivers/usb/host/xhci-tegra.c
1541 @@ -941,9 +941,9 @@ static void tegra_xusb_powerdomain_remove(struct device *dev,
1542 device_link_del(tegra->genpd_dl_ss);
1543 if (tegra->genpd_dl_host)
1544 device_link_del(tegra->genpd_dl_host);
1545 - if (tegra->genpd_dev_ss)
1546 + if (!IS_ERR_OR_NULL(tegra->genpd_dev_ss))
1547 dev_pm_domain_detach(tegra->genpd_dev_ss, true);
1548 - if (tegra->genpd_dev_host)
1549 + if (!IS_ERR_OR_NULL(tegra->genpd_dev_host))
1550 dev_pm_domain_detach(tegra->genpd_dev_host, true);
1551 }
1552
1553 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1554 index c0777a374a88f..4c66edf533fe9 100644
1555 --- a/drivers/usb/serial/cp210x.c
1556 +++ b/drivers/usb/serial/cp210x.c
1557 @@ -61,6 +61,7 @@ static const struct usb_device_id id_table[] = {
1558 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
1559 { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
1560 { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */
1561 + { USB_DEVICE(0x0B00, 0x3070) }, /* Ingenico 3070 */
1562 { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
1563 { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */
1564 { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
1565 @@ -1353,8 +1354,13 @@ static int cp210x_gpio_get(struct gpio_chip *gc, unsigned int gpio)
1566 if (priv->partnum == CP210X_PARTNUM_CP2105)
1567 req_type = REQTYPE_INTERFACE_TO_HOST;
1568
1569 + result = usb_autopm_get_interface(serial->interface);
1570 + if (result)
1571 + return result;
1572 +
1573 result = cp210x_read_vendor_block(serial, req_type,
1574 CP210X_READ_LATCH, &buf, sizeof(buf));
1575 + usb_autopm_put_interface(serial->interface);
1576 if (result < 0)
1577 return result;
1578
1579 @@ -1375,6 +1381,10 @@ static void cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
1580
1581 buf.mask = BIT(gpio);
1582
1583 + result = usb_autopm_get_interface(serial->interface);
1584 + if (result)
1585 + goto out;
1586 +
1587 if (priv->partnum == CP210X_PARTNUM_CP2105) {
1588 result = cp210x_write_vendor_block(serial,
1589 REQTYPE_HOST_TO_INTERFACE,
1590 @@ -1392,6 +1402,8 @@ static void cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
1591 NULL, 0, USB_CTRL_SET_TIMEOUT);
1592 }
1593
1594 + usb_autopm_put_interface(serial->interface);
1595 +out:
1596 if (result < 0) {
1597 dev_err(&serial->interface->dev, "failed to set GPIO value: %d\n",
1598 result);
1599 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1600 index 77ef4c481f3ce..8f5b174717594 100644
1601 --- a/drivers/usb/serial/ftdi_sio.c
1602 +++ b/drivers/usb/serial/ftdi_sio.c
1603 @@ -1025,6 +1025,8 @@ static const struct usb_device_id id_table_combined[] = {
1604 { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) },
1605 { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) },
1606 { USB_DEVICE(AIRBUS_DS_VID, AIRBUS_DS_P8GR) },
1607 + /* EZPrototypes devices */
1608 + { USB_DEVICE(EZPROTOTYPES_VID, HJELMSLUND_USB485_ISO_PID) },
1609 { } /* Terminating entry */
1610 };
1611
1612 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1613 index 975d02666c5a0..b863bedb55a13 100644
1614 --- a/drivers/usb/serial/ftdi_sio_ids.h
1615 +++ b/drivers/usb/serial/ftdi_sio_ids.h
1616 @@ -1308,6 +1308,12 @@
1617 #define IONICS_VID 0x1c0c
1618 #define IONICS_PLUGCOMPUTER_PID 0x0102
1619
1620 +/*
1621 + * EZPrototypes (PID reseller)
1622 + */
1623 +#define EZPROTOTYPES_VID 0x1c40
1624 +#define HJELMSLUND_USB485_ISO_PID 0x0477
1625 +
1626 /*
1627 * Dresden Elektronik Sensor Terminal Board
1628 */
1629 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1630 index aef15497ff31f..11b21d9410f35 100644
1631 --- a/drivers/usb/serial/option.c
1632 +++ b/drivers/usb/serial/option.c
1633 @@ -1148,6 +1148,8 @@ static const struct usb_device_id option_ids[] = {
1634 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
1635 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
1636 .driver_info = NCTRL(0) | RSVD(3) },
1637 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1102, 0xff), /* Telit ME910 (ECM) */
1638 + .driver_info = NCTRL(0) },
1639 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
1640 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1641 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
1642 diff --git a/fs/aio.c b/fs/aio.c
1643 index aaaaf4d12c739..528d03680526f 100644
1644 --- a/fs/aio.c
1645 +++ b/fs/aio.c
1646 @@ -1680,6 +1680,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
1647 struct poll_iocb *req = container_of(wait, struct poll_iocb, wait);
1648 struct aio_kiocb *iocb = container_of(req, struct aio_kiocb, poll);
1649 __poll_t mask = key_to_poll(key);
1650 + unsigned long flags;
1651
1652 req->woken = true;
1653
1654 @@ -1688,10 +1689,15 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
1655 if (!(mask & req->events))
1656 return 0;
1657
1658 - /* try to complete the iocb inline if we can: */
1659 - if (spin_trylock(&iocb->ki_ctx->ctx_lock)) {
1660 + /*
1661 + * Try to complete the iocb inline if we can. Use
1662 + * irqsave/irqrestore because not all filesystems (e.g. fuse)
1663 + * call this function with IRQs disabled and because IRQs
1664 + * have to be disabled before ctx_lock is obtained.
1665 + */
1666 + if (spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) {
1667 list_del(&iocb->ki_list);
1668 - spin_unlock(&iocb->ki_ctx->ctx_lock);
1669 + spin_unlock_irqrestore(&iocb->ki_ctx->ctx_lock, flags);
1670
1671 list_del_init(&req->wait.entry);
1672 aio_poll_complete(iocb, mask);
1673 diff --git a/fs/exec.c b/fs/exec.c
1674 index fb72d36f7823e..bcf383730bea9 100644
1675 --- a/fs/exec.c
1676 +++ b/fs/exec.c
1677 @@ -932,7 +932,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
1678 bytes = kernel_read(file, *buf + pos, i_size - pos, &pos);
1679 if (bytes < 0) {
1680 ret = bytes;
1681 - goto out;
1682 + goto out_free;
1683 }
1684
1685 if (bytes == 0)
1686 diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
1687 index c86d6d8bdfed2..0b427d5df0fea 100644
1688 --- a/include/linux/cpufreq.h
1689 +++ b/include/linux/cpufreq.h
1690 @@ -254,20 +254,12 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
1691 static struct freq_attr _name = \
1692 __ATTR(_name, 0200, NULL, store_##_name)
1693
1694 -struct global_attr {
1695 - struct attribute attr;
1696 - ssize_t (*show)(struct kobject *kobj,
1697 - struct attribute *attr, char *buf);
1698 - ssize_t (*store)(struct kobject *a, struct attribute *b,
1699 - const char *c, size_t count);
1700 -};
1701 -
1702 #define define_one_global_ro(_name) \
1703 -static struct global_attr _name = \
1704 +static struct kobj_attribute _name = \
1705 __ATTR(_name, 0444, show_##_name, NULL)
1706
1707 #define define_one_global_rw(_name) \
1708 -static struct global_attr _name = \
1709 +static struct kobj_attribute _name = \
1710 __ATTR(_name, 0644, show_##_name, store_##_name)
1711
1712
1713 diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
1714 index ec9d6bc658559..fabee6db0abb7 100644
1715 --- a/include/net/bluetooth/bluetooth.h
1716 +++ b/include/net/bluetooth/bluetooth.h
1717 @@ -276,7 +276,7 @@ int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
1718 int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
1719 int bt_sock_wait_ready(struct sock *sk, unsigned long flags);
1720
1721 -void bt_accept_enqueue(struct sock *parent, struct sock *sk);
1722 +void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh);
1723 void bt_accept_unlink(struct sock *sk);
1724 struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
1725
1726 diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
1727 index 9481f2c142e26..e7eb4aa6ccc94 100644
1728 --- a/include/net/sch_generic.h
1729 +++ b/include/net/sch_generic.h
1730 @@ -51,7 +51,10 @@ struct qdisc_size_table {
1731 struct qdisc_skb_head {
1732 struct sk_buff *head;
1733 struct sk_buff *tail;
1734 - __u32 qlen;
1735 + union {
1736 + u32 qlen;
1737 + atomic_t atomic_qlen;
1738 + };
1739 spinlock_t lock;
1740 };
1741
1742 @@ -408,27 +411,19 @@ static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
1743 BUILD_BUG_ON(sizeof(qcb->data) < sz);
1744 }
1745
1746 -static inline int qdisc_qlen_cpu(const struct Qdisc *q)
1747 -{
1748 - return this_cpu_ptr(q->cpu_qstats)->qlen;
1749 -}
1750 -
1751 static inline int qdisc_qlen(const struct Qdisc *q)
1752 {
1753 return q->q.qlen;
1754 }
1755
1756 -static inline int qdisc_qlen_sum(const struct Qdisc *q)
1757 +static inline u32 qdisc_qlen_sum(const struct Qdisc *q)
1758 {
1759 - __u32 qlen = q->qstats.qlen;
1760 - int i;
1761 + u32 qlen = q->qstats.qlen;
1762
1763 - if (q->flags & TCQ_F_NOLOCK) {
1764 - for_each_possible_cpu(i)
1765 - qlen += per_cpu_ptr(q->cpu_qstats, i)->qlen;
1766 - } else {
1767 + if (q->flags & TCQ_F_NOLOCK)
1768 + qlen += atomic_read(&q->q.atomic_qlen);
1769 + else
1770 qlen += q->q.qlen;
1771 - }
1772
1773 return qlen;
1774 }
1775 @@ -825,14 +820,14 @@ static inline void qdisc_qstats_cpu_backlog_inc(struct Qdisc *sch,
1776 this_cpu_add(sch->cpu_qstats->backlog, qdisc_pkt_len(skb));
1777 }
1778
1779 -static inline void qdisc_qstats_cpu_qlen_inc(struct Qdisc *sch)
1780 +static inline void qdisc_qstats_atomic_qlen_inc(struct Qdisc *sch)
1781 {
1782 - this_cpu_inc(sch->cpu_qstats->qlen);
1783 + atomic_inc(&sch->q.atomic_qlen);
1784 }
1785
1786 -static inline void qdisc_qstats_cpu_qlen_dec(struct Qdisc *sch)
1787 +static inline void qdisc_qstats_atomic_qlen_dec(struct Qdisc *sch)
1788 {
1789 - this_cpu_dec(sch->cpu_qstats->qlen);
1790 + atomic_dec(&sch->q.atomic_qlen);
1791 }
1792
1793 static inline void qdisc_qstats_cpu_requeues_inc(struct Qdisc *sch)
1794 diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h
1795 index b9ba520f7e4bb..2832134e53971 100644
1796 --- a/include/uapi/linux/android/binder.h
1797 +++ b/include/uapi/linux/android/binder.h
1798 @@ -41,6 +41,14 @@ enum {
1799 enum {
1800 FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
1801 FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
1802 +
1803 + /**
1804 + * @FLAT_BINDER_FLAG_TXN_SECURITY_CTX: request security contexts
1805 + *
1806 + * Only when set, causes senders to include their security
1807 + * context
1808 + */
1809 + FLAT_BINDER_FLAG_TXN_SECURITY_CTX = 0x1000,
1810 };
1811
1812 #ifdef BINDER_IPC_32BIT
1813 @@ -218,6 +226,7 @@ struct binder_node_info_for_ref {
1814 #define BINDER_VERSION _IOWR('b', 9, struct binder_version)
1815 #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info)
1816 #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref)
1817 +#define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object)
1818
1819 /*
1820 * NOTE: Two special error codes you should check for when calling
1821 @@ -276,6 +285,11 @@ struct binder_transaction_data {
1822 } data;
1823 };
1824
1825 +struct binder_transaction_data_secctx {
1826 + struct binder_transaction_data transaction_data;
1827 + binder_uintptr_t secctx;
1828 +};
1829 +
1830 struct binder_transaction_data_sg {
1831 struct binder_transaction_data transaction_data;
1832 binder_size_t buffers_size;
1833 @@ -311,6 +325,11 @@ enum binder_driver_return_protocol {
1834 BR_OK = _IO('r', 1),
1835 /* No parameters! */
1836
1837 + BR_TRANSACTION_SEC_CTX = _IOR('r', 2,
1838 + struct binder_transaction_data_secctx),
1839 + /*
1840 + * binder_transaction_data_secctx: the received command.
1841 + */
1842 BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data),
1843 BR_REPLY = _IOR('r', 3, struct binder_transaction_data),
1844 /*
1845 diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
1846 index 27821480105e6..217ef481fbbb6 100644
1847 --- a/kernel/trace/trace_events_filter.c
1848 +++ b/kernel/trace/trace_events_filter.c
1849 @@ -1301,7 +1301,7 @@ static int parse_pred(const char *str, void *data,
1850 /* go past the last quote */
1851 i++;
1852
1853 - } else if (isdigit(str[i])) {
1854 + } else if (isdigit(str[i]) || str[i] == '-') {
1855
1856 /* Make sure the field is not a string */
1857 if (is_string_field(field)) {
1858 @@ -1314,6 +1314,9 @@ static int parse_pred(const char *str, void *data,
1859 goto err_free;
1860 }
1861
1862 + if (str[i] == '-')
1863 + i++;
1864 +
1865 /* We allow 0xDEADBEEF */
1866 while (isalnum(str[i]))
1867 i++;
1868 diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
1869 index deacc52d7ff18..8d12198eaa949 100644
1870 --- a/net/bluetooth/af_bluetooth.c
1871 +++ b/net/bluetooth/af_bluetooth.c
1872 @@ -154,15 +154,25 @@ void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
1873 }
1874 EXPORT_SYMBOL(bt_sock_unlink);
1875
1876 -void bt_accept_enqueue(struct sock *parent, struct sock *sk)
1877 +void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh)
1878 {
1879 BT_DBG("parent %p, sk %p", parent, sk);
1880
1881 sock_hold(sk);
1882 - lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
1883 +
1884 + if (bh)
1885 + bh_lock_sock_nested(sk);
1886 + else
1887 + lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
1888 +
1889 list_add_tail(&bt_sk(sk)->accept_q, &bt_sk(parent)->accept_q);
1890 bt_sk(sk)->parent = parent;
1891 - release_sock(sk);
1892 +
1893 + if (bh)
1894 + bh_unlock_sock(sk);
1895 + else
1896 + release_sock(sk);
1897 +
1898 parent->sk_ack_backlog++;
1899 }
1900 EXPORT_SYMBOL(bt_accept_enqueue);
1901 diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
1902 index 686bdc6b35b03..a3a2cd55e23a9 100644
1903 --- a/net/bluetooth/l2cap_sock.c
1904 +++ b/net/bluetooth/l2cap_sock.c
1905 @@ -1252,7 +1252,7 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(struct l2cap_chan *chan)
1906
1907 l2cap_sock_init(sk, parent);
1908
1909 - bt_accept_enqueue(parent, sk);
1910 + bt_accept_enqueue(parent, sk, false);
1911
1912 release_sock(parent);
1913
1914 diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
1915 index aa0db1d1bd9b4..b1f49fcc04780 100644
1916 --- a/net/bluetooth/rfcomm/sock.c
1917 +++ b/net/bluetooth/rfcomm/sock.c
1918 @@ -988,7 +988,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
1919 rfcomm_pi(sk)->channel = channel;
1920
1921 sk->sk_state = BT_CONFIG;
1922 - bt_accept_enqueue(parent, sk);
1923 + bt_accept_enqueue(parent, sk, true);
1924
1925 /* Accept connection and return socket DLC */
1926 *d = rfcomm_pi(sk)->dlc;
1927 diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
1928 index 529b38996d8bc..9a580999ca57e 100644
1929 --- a/net/bluetooth/sco.c
1930 +++ b/net/bluetooth/sco.c
1931 @@ -193,7 +193,7 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk,
1932 conn->sk = sk;
1933
1934 if (parent)
1935 - bt_accept_enqueue(parent, sk);
1936 + bt_accept_enqueue(parent, sk, true);
1937 }
1938
1939 static int sco_chan_add(struct sco_conn *conn, struct sock *sk,
1940 diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
1941 index 9bf1b9ad17806..ac679f74ba475 100644
1942 --- a/net/core/gen_stats.c
1943 +++ b/net/core/gen_stats.c
1944 @@ -291,7 +291,6 @@ __gnet_stats_copy_queue_cpu(struct gnet_stats_queue *qstats,
1945 for_each_possible_cpu(i) {
1946 const struct gnet_stats_queue *qcpu = per_cpu_ptr(q, i);
1947
1948 - qstats->qlen = 0;
1949 qstats->backlog += qcpu->backlog;
1950 qstats->drops += qcpu->drops;
1951 qstats->requeues += qcpu->requeues;
1952 @@ -307,7 +306,6 @@ void __gnet_stats_copy_queue(struct gnet_stats_queue *qstats,
1953 if (cpu) {
1954 __gnet_stats_copy_queue_cpu(qstats, cpu);
1955 } else {
1956 - qstats->qlen = q->qlen;
1957 qstats->backlog = q->backlog;
1958 qstats->drops = q->drops;
1959 qstats->requeues = q->requeues;
1960 diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
1961 index ff9fd2bb4ce43..73ad7607dcd1a 100644
1962 --- a/net/core/net-sysfs.c
1963 +++ b/net/core/net-sysfs.c
1964 @@ -1547,6 +1547,9 @@ static int register_queue_kobjects(struct net_device *dev)
1965 error:
1966 netdev_queue_update_kobjects(dev, txq, 0);
1967 net_rx_queue_update_kobjects(dev, rxq, 0);
1968 +#ifdef CONFIG_SYSFS
1969 + kset_unregister(dev->queues_kset);
1970 +#endif
1971 return error;
1972 }
1973
1974 diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
1975 index cc01aa3f2b5e3..af91a1a402f13 100644
1976 --- a/net/ipv6/ip6mr.c
1977 +++ b/net/ipv6/ip6mr.c
1978 @@ -1964,10 +1964,10 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
1979
1980 static inline int ip6mr_forward2_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
1981 {
1982 - __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
1983 - IPSTATS_MIB_OUTFORWDATAGRAMS);
1984 - __IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)),
1985 - IPSTATS_MIB_OUTOCTETS, skb->len);
1986 + IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
1987 + IPSTATS_MIB_OUTFORWDATAGRAMS);
1988 + IP6_ADD_STATS(net, ip6_dst_idev(skb_dst(skb)),
1989 + IPSTATS_MIB_OUTOCTETS, skb->len);
1990 return dst_output(net, sk, skb);
1991 }
1992
1993 diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
1994 index 968a85fe4d4a9..de31f2f3b9730 100644
1995 --- a/net/sched/sch_generic.c
1996 +++ b/net/sched/sch_generic.c
1997 @@ -68,7 +68,7 @@ static inline struct sk_buff *__skb_dequeue_bad_txq(struct Qdisc *q)
1998 skb = __skb_dequeue(&q->skb_bad_txq);
1999 if (qdisc_is_percpu_stats(q)) {
2000 qdisc_qstats_cpu_backlog_dec(q, skb);
2001 - qdisc_qstats_cpu_qlen_dec(q);
2002 + qdisc_qstats_atomic_qlen_dec(q);
2003 } else {
2004 qdisc_qstats_backlog_dec(q, skb);
2005 q->q.qlen--;
2006 @@ -108,7 +108,7 @@ static inline void qdisc_enqueue_skb_bad_txq(struct Qdisc *q,
2007
2008 if (qdisc_is_percpu_stats(q)) {
2009 qdisc_qstats_cpu_backlog_inc(q, skb);
2010 - qdisc_qstats_cpu_qlen_inc(q);
2011 + qdisc_qstats_atomic_qlen_inc(q);
2012 } else {
2013 qdisc_qstats_backlog_inc(q, skb);
2014 q->q.qlen++;
2015 @@ -147,7 +147,7 @@ static inline int dev_requeue_skb_locked(struct sk_buff *skb, struct Qdisc *q)
2016
2017 qdisc_qstats_cpu_requeues_inc(q);
2018 qdisc_qstats_cpu_backlog_inc(q, skb);
2019 - qdisc_qstats_cpu_qlen_inc(q);
2020 + qdisc_qstats_atomic_qlen_inc(q);
2021
2022 skb = next;
2023 }
2024 @@ -252,7 +252,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate,
2025 skb = __skb_dequeue(&q->gso_skb);
2026 if (qdisc_is_percpu_stats(q)) {
2027 qdisc_qstats_cpu_backlog_dec(q, skb);
2028 - qdisc_qstats_cpu_qlen_dec(q);
2029 + qdisc_qstats_atomic_qlen_dec(q);
2030 } else {
2031 qdisc_qstats_backlog_dec(q, skb);
2032 q->q.qlen--;
2033 @@ -645,7 +645,7 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc,
2034 if (unlikely(err))
2035 return qdisc_drop_cpu(skb, qdisc, to_free);
2036
2037 - qdisc_qstats_cpu_qlen_inc(qdisc);
2038 + qdisc_qstats_atomic_qlen_inc(qdisc);
2039 /* Note: skb can not be used after skb_array_produce(),
2040 * so we better not use qdisc_qstats_cpu_backlog_inc()
2041 */
2042 @@ -670,7 +670,7 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
2043 if (likely(skb)) {
2044 qdisc_qstats_cpu_backlog_dec(qdisc, skb);
2045 qdisc_bstats_cpu_update(qdisc, skb);
2046 - qdisc_qstats_cpu_qlen_dec(qdisc);
2047 + qdisc_qstats_atomic_qlen_dec(qdisc);
2048 }
2049
2050 return skb;
2051 @@ -714,7 +714,6 @@ static void pfifo_fast_reset(struct Qdisc *qdisc)
2052 struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i);
2053
2054 q->backlog = 0;
2055 - q->qlen = 0;
2056 }
2057 }
2058
2059 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
2060 index 65d6d04546aee..a2771b3b3c148 100644
2061 --- a/net/sctp/socket.c
2062 +++ b/net/sctp/socket.c
2063 @@ -1866,6 +1866,7 @@ static int sctp_sendmsg_check_sflags(struct sctp_association *asoc,
2064
2065 pr_debug("%s: aborting association:%p\n", __func__, asoc);
2066 sctp_primitive_ABORT(net, asoc, chunk);
2067 + iov_iter_revert(&msg->msg_iter, msg_len);
2068
2069 return 0;
2070 }
2071 diff --git a/net/tipc/socket.c b/net/tipc/socket.c
2072 index 70343ac448b18..139694f2c576c 100644
2073 --- a/net/tipc/socket.c
2074 +++ b/net/tipc/socket.c
2075 @@ -1333,7 +1333,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
2076
2077 if (unlikely(!dest)) {
2078 dest = &tsk->peer;
2079 - if (!syn || dest->family != AF_TIPC)
2080 + if (!syn && dest->family != AF_TIPC)
2081 return -EDESTADDRREQ;
2082 }
2083
2084 diff --git a/tools/testing/selftests/firmware/config b/tools/testing/selftests/firmware/config
2085 index 913a25a4a32be..bf634dda07201 100644
2086 --- a/tools/testing/selftests/firmware/config
2087 +++ b/tools/testing/selftests/firmware/config
2088 @@ -1,6 +1,5 @@
2089 CONFIG_TEST_FIRMWARE=y
2090 CONFIG_FW_LOADER=y
2091 CONFIG_FW_LOADER_USER_HELPER=y
2092 -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
2093 CONFIG_IKCONFIG=y
2094 CONFIG_IKCONFIG_PROC=y
2095 diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
2096 index 466cf2f91ba01..a4320c4b44dc9 100755
2097 --- a/tools/testing/selftests/firmware/fw_filesystem.sh
2098 +++ b/tools/testing/selftests/firmware/fw_filesystem.sh
2099 @@ -155,8 +155,11 @@ read_firmwares()
2100 {
2101 for i in $(seq 0 3); do
2102 config_set_read_fw_idx $i
2103 - # Verify the contents match
2104 - if ! diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
2105 + # Verify the contents are what we expect.
2106 + # -Z required for now -- check for yourself, md5sum
2107 + # on $FW and DIR/read_firmware will yield the same. Even
2108 + # cmp agrees, so something is off.
2109 + if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
2110 echo "request #$i: firmware was not loaded" >&2
2111 exit 1
2112 fi
2113 @@ -168,7 +171,7 @@ read_firmwares_expect_nofile()
2114 for i in $(seq 0 3); do
2115 config_set_read_fw_idx $i
2116 # Ensures contents differ
2117 - if diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
2118 + if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
2119 echo "request $i: file was not expected to match" >&2
2120 exit 1
2121 fi
2122 diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh
2123 index 6c5f1b2ffb745..1cbb12e284a68 100755
2124 --- a/tools/testing/selftests/firmware/fw_lib.sh
2125 +++ b/tools/testing/selftests/firmware/fw_lib.sh
2126 @@ -91,7 +91,7 @@ verify_reqs()
2127 if [ "$TEST_REQS_FW_SYSFS_FALLBACK" = "yes" ]; then
2128 if [ ! "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then
2129 echo "usermode helper disabled so ignoring test"
2130 - exit $ksft_skip
2131 + exit 0
2132 fi
2133 fi
2134 }