Magellan Linux

Contents of /trunk/kernel-alx/patches-4.9/0252-4.9.153-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3305 - (show annotations) (download)
Tue Mar 12 10:43:12 2019 UTC (5 years, 1 month ago) by niro
File size: 38335 byte(s)
-linux-4.9.153
1 diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
2 index 74329fd0add2..077c37ed976f 100644
3 --- a/Documentation/filesystems/proc.txt
4 +++ b/Documentation/filesystems/proc.txt
5 @@ -484,7 +484,9 @@ manner. The codes are the following:
6
7 Note that there is no guarantee that every flag and associated mnemonic will
8 be present in all further kernel releases. Things get changed, the flags may
9 -be vanished or the reverse -- new added.
10 +be vanished or the reverse -- new added. Interpretation of their meaning
11 +might change in future as well. So each consumer of these flags has to
12 +follow each specific kernel version for the exact semantic.
13
14 This file is only present if the CONFIG_MMU kernel configuration option is
15 enabled.
16 diff --git a/Makefile b/Makefile
17 index 27a9292fc0ed..44a487ee24d2 100644
18 --- a/Makefile
19 +++ b/Makefile
20 @@ -1,6 +1,6 @@
21 VERSION = 4
22 PATCHLEVEL = 9
23 -SUBLEVEL = 152
24 +SUBLEVEL = 153
25 EXTRAVERSION =
26 NAME = Roaring Lionus
27
28 diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
29 index 199a23f058d5..0770d6d1c37f 100644
30 --- a/arch/arm64/kernel/perf_event.c
31 +++ b/arch/arm64/kernel/perf_event.c
32 @@ -1114,6 +1114,7 @@ static struct platform_driver armv8_pmu_driver = {
33 .driver = {
34 .name = ARMV8_PMU_PDEV_NAME,
35 .of_match_table = armv8_pmu_of_device_ids,
36 + .suppress_bind_attrs = true,
37 },
38 .probe = armv8_pmu_device_probe,
39 };
40 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
41 index 1d987061d1a1..bb9940c6927e 100644
42 --- a/arch/mips/Kconfig
43 +++ b/arch/mips/Kconfig
44 @@ -791,6 +791,7 @@ config SIBYTE_SWARM
45 select SYS_SUPPORTS_HIGHMEM
46 select SYS_SUPPORTS_LITTLE_ENDIAN
47 select ZONE_DMA32 if 64BIT
48 + select SWIOTLB if ARCH_DMA_ADDR_T_64BIT && PCI
49
50 config SIBYTE_LITTLESUR
51 bool "Sibyte BCM91250C2-LittleSur"
52 @@ -813,6 +814,7 @@ config SIBYTE_SENTOSA
53 select SYS_HAS_CPU_SB1
54 select SYS_SUPPORTS_BIG_ENDIAN
55 select SYS_SUPPORTS_LITTLE_ENDIAN
56 + select SWIOTLB if ARCH_DMA_ADDR_T_64BIT && PCI
57
58 config SIBYTE_BIGSUR
59 bool "Sibyte BCM91480B-BigSur"
60 @@ -826,6 +828,7 @@ config SIBYTE_BIGSUR
61 select SYS_SUPPORTS_HIGHMEM
62 select SYS_SUPPORTS_LITTLE_ENDIAN
63 select ZONE_DMA32 if 64BIT
64 + select SWIOTLB if ARCH_DMA_ADDR_T_64BIT && PCI
65
66 config SNI_RM
67 bool "SNI RM200/300/400"
68 diff --git a/arch/mips/sibyte/common/Makefile b/arch/mips/sibyte/common/Makefile
69 index b3d6bf23a662..3ef3fb658136 100644
70 --- a/arch/mips/sibyte/common/Makefile
71 +++ b/arch/mips/sibyte/common/Makefile
72 @@ -1,4 +1,5 @@
73 obj-y := cfe.o
74 +obj-$(CONFIG_SWIOTLB) += dma.o
75 obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
76 obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o
77 obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o
78 diff --git a/arch/mips/sibyte/common/dma.c b/arch/mips/sibyte/common/dma.c
79 new file mode 100644
80 index 000000000000..eb47a94f3583
81 --- /dev/null
82 +++ b/arch/mips/sibyte/common/dma.c
83 @@ -0,0 +1,14 @@
84 +// SPDX-License-Identifier: GPL-2.0+
85 +/*
86 + * DMA support for Broadcom SiByte platforms.
87 + *
88 + * Copyright (c) 2018 Maciej W. Rozycki
89 + */
90 +
91 +#include <linux/swiotlb.h>
92 +#include <asm/bootinfo.h>
93 +
94 +void __init plat_swiotlb_setup(void)
95 +{
96 + swiotlb_init(1);
97 +}
98 diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
99 index 760545519a0b..687e8b8bf5c6 100644
100 --- a/arch/powerpc/xmon/xmon.c
101 +++ b/arch/powerpc/xmon/xmon.c
102 @@ -73,6 +73,9 @@ static int xmon_gate;
103 #define xmon_owner 0
104 #endif /* CONFIG_SMP */
105
106 +#ifdef CONFIG_PPC_PSERIES
107 +static int set_indicator_token = RTAS_UNKNOWN_SERVICE;
108 +#endif
109 static unsigned long in_xmon __read_mostly = 0;
110
111 static unsigned long adrs;
112 @@ -340,7 +343,6 @@ static inline void disable_surveillance(void)
113 #ifdef CONFIG_PPC_PSERIES
114 /* Since this can't be a module, args should end up below 4GB. */
115 static struct rtas_args args;
116 - int token;
117
118 /*
119 * At this point we have got all the cpus we can into
120 @@ -349,11 +351,11 @@ static inline void disable_surveillance(void)
121 * If we did try to take rtas.lock there would be a
122 * real possibility of deadlock.
123 */
124 - token = rtas_token("set-indicator");
125 - if (token == RTAS_UNKNOWN_SERVICE)
126 + if (set_indicator_token == RTAS_UNKNOWN_SERVICE)
127 return;
128
129 - rtas_call_unlocked(&args, token, 3, 1, NULL, SURVEILLANCE_TOKEN, 0, 0);
130 + rtas_call_unlocked(&args, set_indicator_token, 3, 1, NULL,
131 + SURVEILLANCE_TOKEN, 0, 0);
132
133 #endif /* CONFIG_PPC_PSERIES */
134 }
135 @@ -3227,6 +3229,14 @@ static void xmon_init(int enable)
136 __debugger_iabr_match = xmon_iabr_match;
137 __debugger_break_match = xmon_break_match;
138 __debugger_fault_handler = xmon_fault_handler;
139 +
140 +#ifdef CONFIG_PPC_PSERIES
141 + /*
142 + * Get the token here to avoid trying to get a lock
143 + * during the crash, causing a deadlock.
144 + */
145 + set_indicator_token = rtas_token("set-indicator");
146 +#endif
147 } else {
148 __debugger = NULL;
149 __debugger_ipi = NULL;
150 diff --git a/drivers/base/bus.c b/drivers/base/bus.c
151 index e32a74eb28a3..a7ae9a0e8a78 100644
152 --- a/drivers/base/bus.c
153 +++ b/drivers/base/bus.c
154 @@ -33,6 +33,9 @@ static struct kset *system_kset;
155
156 #define to_drv_attr(_attr) container_of(_attr, struct driver_attribute, attr)
157
158 +#define DRIVER_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
159 + struct driver_attribute driver_attr_##_name = \
160 + __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
161
162 static int __must_check bus_rescan_devices_helper(struct device *dev,
163 void *data);
164 @@ -197,7 +200,7 @@ static ssize_t unbind_store(struct device_driver *drv, const char *buf,
165 bus_put(bus);
166 return err;
167 }
168 -static DRIVER_ATTR_WO(unbind);
169 +static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, S_IWUSR, NULL, unbind_store);
170
171 /*
172 * Manually attach a device to a driver.
173 @@ -233,7 +236,7 @@ static ssize_t bind_store(struct device_driver *drv, const char *buf,
174 bus_put(bus);
175 return err;
176 }
177 -static DRIVER_ATTR_WO(bind);
178 +static DRIVER_ATTR_IGNORE_LOCKDEP(bind, S_IWUSR, NULL, bind_store);
179
180 static ssize_t show_drivers_autoprobe(struct bus_type *bus, char *buf)
181 {
182 diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
183 index a0bb52bc6582..dac36ef450ba 100644
184 --- a/drivers/char/ipmi/ipmi_ssif.c
185 +++ b/drivers/char/ipmi/ipmi_ssif.c
186 @@ -641,8 +641,9 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
187
188 /* Remove the multi-part read marker. */
189 len -= 2;
190 + data += 2;
191 for (i = 0; i < len; i++)
192 - ssif_info->data[i] = data[i+2];
193 + ssif_info->data[i] = data[i];
194 ssif_info->multi_len = len;
195 ssif_info->multi_pos = 1;
196
197 @@ -670,8 +671,19 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
198 }
199
200 blocknum = data[0];
201 + len--;
202 + data++;
203 +
204 + if (blocknum != 0xff && len != 31) {
205 + /* All blocks but the last must have 31 data bytes. */
206 + result = -EIO;
207 + if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
208 + pr_info("Received middle message <31\n");
209
210 - if (ssif_info->multi_len + len - 1 > IPMI_MAX_MSG_LENGTH) {
211 + goto continue_op;
212 + }
213 +
214 + if (ssif_info->multi_len + len > IPMI_MAX_MSG_LENGTH) {
215 /* Received message too big, abort the operation. */
216 result = -E2BIG;
217 if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
218 @@ -680,16 +692,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
219 goto continue_op;
220 }
221
222 - /* Remove the blocknum from the data. */
223 - len--;
224 for (i = 0; i < len; i++)
225 - ssif_info->data[i + ssif_info->multi_len] = data[i + 1];
226 + ssif_info->data[i + ssif_info->multi_len] = data[i];
227 ssif_info->multi_len += len;
228 if (blocknum == 0xff) {
229 /* End of read */
230 len = ssif_info->multi_len;
231 data = ssif_info->data;
232 - } else if (blocknum + 1 != ssif_info->multi_pos) {
233 + } else if (blocknum != ssif_info->multi_pos) {
234 /*
235 * Out of sequence block, just abort. Block
236 * numbers start at zero for the second block,
237 @@ -717,6 +727,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
238 }
239 }
240
241 + continue_op:
242 if (result < 0) {
243 ssif_inc_stat(ssif_info, receive_errors);
244 } else {
245 @@ -724,8 +735,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
246 ssif_inc_stat(ssif_info, received_message_parts);
247 }
248
249 -
250 - continue_op:
251 if (ssif_info->ssif_debug & SSIF_DEBUG_STATE)
252 pr_info(PFX "DONE 1: state = %d, result=%d.\n",
253 ssif_info->ssif_state, result);
254 diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
255 index 93a19667003d..14682df5d312 100644
256 --- a/drivers/clk/imx/clk-imx6q.c
257 +++ b/drivers/clk/imx/clk-imx6q.c
258 @@ -258,8 +258,12 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
259 * lvds1_gate and lvds2_gate are pseudo-gates. Both can be
260 * independently configured as clock inputs or outputs. We treat
261 * the "output_enable" bit as a gate, even though it's really just
262 - * enabling clock output.
263 + * enabling clock output. Initially the gate bits are cleared, as
264 + * otherwise the exclusive configuration gets locked in the setup done
265 + * by software running before the clock driver, with no way to change
266 + * it.
267 */
268 + writel(readl(base + 0x160) & ~0x3c00, base + 0x160);
269 clk[IMX6QDL_CLK_LVDS1_GATE] = imx_clk_gate_exclusive("lvds1_gate", "lvds1_sel", base + 0x160, 10, BIT(12));
270 clk[IMX6QDL_CLK_LVDS2_GATE] = imx_clk_gate_exclusive("lvds2_gate", "lvds2_sel", base + 0x160, 11, BIT(13));
271
272 diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
273 index 166ccd711ec9..83203c59bf59 100644
274 --- a/drivers/cpuidle/cpuidle-pseries.c
275 +++ b/drivers/cpuidle/cpuidle-pseries.c
276 @@ -230,7 +230,13 @@ static int pseries_idle_probe(void)
277 return -ENODEV;
278
279 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
280 - if (lppaca_shared_proc(get_lppaca())) {
281 + /*
282 + * Use local_paca instead of get_lppaca() since
283 + * preemption is not disabled, and it is not required in
284 + * fact, since lppaca_ptr does not need to be the value
285 + * associated to the current CPU, it can be from any CPU.
286 + */
287 + if (lppaca_shared_proc(local_paca->lppaca_ptr)) {
288 cpuidle_state_table = shared_states;
289 max_idle_state = ARRAY_SIZE(shared_states);
290 } else {
291 diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
292 index 47219ebd8ff2..0f9fe2ca2a91 100644
293 --- a/drivers/infiniband/sw/rxe/rxe_req.c
294 +++ b/drivers/infiniband/sw/rxe/rxe_req.c
295 @@ -643,6 +643,7 @@ next_wqe:
296 rmr->access = wqe->wr.wr.reg.access;
297 rmr->lkey = wqe->wr.wr.reg.key;
298 rmr->rkey = wqe->wr.wr.reg.key;
299 + rmr->iova = wqe->wr.wr.reg.mr->iova;
300 wqe->state = wqe_state_done;
301 wqe->status = IB_WC_SUCCESS;
302 } else {
303 diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
304 index 56fcccc30554..e0cfde3501e0 100644
305 --- a/drivers/md/dm-kcopyd.c
306 +++ b/drivers/md/dm-kcopyd.c
307 @@ -55,15 +55,17 @@ struct dm_kcopyd_client {
308 struct dm_kcopyd_throttle *throttle;
309
310 /*
311 - * We maintain three lists of jobs:
312 + * We maintain four lists of jobs:
313 *
314 * i) jobs waiting for pages
315 * ii) jobs that have pages, and are waiting for the io to be issued.
316 - * iii) jobs that have completed.
317 + * iii) jobs that don't need to do any IO and just run a callback
318 + * iv) jobs that have completed.
319 *
320 - * All three of these are protected by job_lock.
321 + * All four of these are protected by job_lock.
322 */
323 spinlock_t job_lock;
324 + struct list_head callback_jobs;
325 struct list_head complete_jobs;
326 struct list_head io_jobs;
327 struct list_head pages_jobs;
328 @@ -584,6 +586,7 @@ static void do_work(struct work_struct *work)
329 struct dm_kcopyd_client *kc = container_of(work,
330 struct dm_kcopyd_client, kcopyd_work);
331 struct blk_plug plug;
332 + unsigned long flags;
333
334 /*
335 * The order that these are called is *very* important.
336 @@ -592,6 +595,10 @@ static void do_work(struct work_struct *work)
337 * list. io jobs call wake when they complete and it all
338 * starts again.
339 */
340 + spin_lock_irqsave(&kc->job_lock, flags);
341 + list_splice_tail_init(&kc->callback_jobs, &kc->complete_jobs);
342 + spin_unlock_irqrestore(&kc->job_lock, flags);
343 +
344 blk_start_plug(&plug);
345 process_jobs(&kc->complete_jobs, kc, run_complete_job);
346 process_jobs(&kc->pages_jobs, kc, run_pages_job);
347 @@ -609,7 +616,7 @@ static void dispatch_job(struct kcopyd_job *job)
348 struct dm_kcopyd_client *kc = job->kc;
349 atomic_inc(&kc->nr_jobs);
350 if (unlikely(!job->source.count))
351 - push(&kc->complete_jobs, job);
352 + push(&kc->callback_jobs, job);
353 else if (job->pages == &zero_page_list)
354 push(&kc->io_jobs, job);
355 else
356 @@ -796,7 +803,7 @@ void dm_kcopyd_do_callback(void *j, int read_err, unsigned long write_err)
357 job->read_err = read_err;
358 job->write_err = write_err;
359
360 - push(&kc->complete_jobs, job);
361 + push(&kc->callback_jobs, job);
362 wake(kc);
363 }
364 EXPORT_SYMBOL(dm_kcopyd_do_callback);
365 @@ -826,6 +833,7 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *thro
366 return ERR_PTR(-ENOMEM);
367
368 spin_lock_init(&kc->job_lock);
369 + INIT_LIST_HEAD(&kc->callback_jobs);
370 INIT_LIST_HEAD(&kc->complete_jobs);
371 INIT_LIST_HEAD(&kc->io_jobs);
372 INIT_LIST_HEAD(&kc->pages_jobs);
373 @@ -875,6 +883,7 @@ void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc)
374 /* Wait for completion of all jobs submitted by this client. */
375 wait_event(kc->destroyq, !atomic_read(&kc->nr_jobs));
376
377 + BUG_ON(!list_empty(&kc->callback_jobs));
378 BUG_ON(!list_empty(&kc->complete_jobs));
379 BUG_ON(!list_empty(&kc->io_jobs));
380 BUG_ON(!list_empty(&kc->pages_jobs));
381 diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
382 index c65feeada864..2da0b9b213c7 100644
383 --- a/drivers/md/dm-snap.c
384 +++ b/drivers/md/dm-snap.c
385 @@ -19,6 +19,7 @@
386 #include <linux/vmalloc.h>
387 #include <linux/log2.h>
388 #include <linux/dm-kcopyd.h>
389 +#include <linux/semaphore.h>
390
391 #include "dm.h"
392
393 @@ -105,6 +106,9 @@ struct dm_snapshot {
394 /* The on disk metadata handler */
395 struct dm_exception_store *store;
396
397 + /* Maximum number of in-flight COW jobs. */
398 + struct semaphore cow_count;
399 +
400 struct dm_kcopyd_client *kcopyd_client;
401
402 /* Wait for events based on state_bits */
403 @@ -145,6 +149,19 @@ struct dm_snapshot {
404 #define RUNNING_MERGE 0
405 #define SHUTDOWN_MERGE 1
406
407 +/*
408 + * Maximum number of chunks being copied on write.
409 + *
410 + * The value was decided experimentally as a trade-off between memory
411 + * consumption, stalling the kernel's workqueues and maintaining a high enough
412 + * throughput.
413 + */
414 +#define DEFAULT_COW_THRESHOLD 2048
415 +
416 +static int cow_threshold = DEFAULT_COW_THRESHOLD;
417 +module_param_named(snapshot_cow_threshold, cow_threshold, int, 0644);
418 +MODULE_PARM_DESC(snapshot_cow_threshold, "Maximum number of chunks being copied on write");
419 +
420 DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle,
421 "A percentage of time allocated for copy on write");
422
423 @@ -1189,6 +1206,8 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
424 goto bad_hash_tables;
425 }
426
427 + sema_init(&s->cow_count, (cow_threshold > 0) ? cow_threshold : INT_MAX);
428 +
429 s->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle);
430 if (IS_ERR(s->kcopyd_client)) {
431 r = PTR_ERR(s->kcopyd_client);
432 @@ -1560,6 +1579,7 @@ static void copy_callback(int read_err, unsigned long write_err, void *context)
433 }
434 list_add(&pe->out_of_order_entry, lh);
435 }
436 + up(&s->cow_count);
437 }
438
439 /*
440 @@ -1583,6 +1603,7 @@ static void start_copy(struct dm_snap_pending_exception *pe)
441 dest.count = src.count;
442
443 /* Hand over to kcopyd */
444 + down(&s->cow_count);
445 dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, copy_callback, pe);
446 }
447
448 @@ -1602,6 +1623,7 @@ static void start_full_bio(struct dm_snap_pending_exception *pe,
449 pe->full_bio = bio;
450 pe->full_bio_end_io = bio->bi_end_io;
451
452 + down(&s->cow_count);
453 callback_data = dm_kcopyd_prepare_callback(s->kcopyd_client,
454 copy_callback, pe);
455
456 diff --git a/drivers/media/firewire/firedtv-avc.c b/drivers/media/firewire/firedtv-avc.c
457 index 251a556112a9..280b5ffea592 100644
458 --- a/drivers/media/firewire/firedtv-avc.c
459 +++ b/drivers/media/firewire/firedtv-avc.c
460 @@ -968,7 +968,8 @@ static int get_ca_object_length(struct avc_response_frame *r)
461 return r->operand[7];
462 }
463
464 -int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
465 +int avc_ca_app_info(struct firedtv *fdtv, unsigned char *app_info,
466 + unsigned int *len)
467 {
468 struct avc_command_frame *c = (void *)fdtv->avc_data;
469 struct avc_response_frame *r = (void *)fdtv->avc_data;
470 @@ -1009,7 +1010,8 @@ out:
471 return ret;
472 }
473
474 -int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len)
475 +int avc_ca_info(struct firedtv *fdtv, unsigned char *app_info,
476 + unsigned int *len)
477 {
478 struct avc_command_frame *c = (void *)fdtv->avc_data;
479 struct avc_response_frame *r = (void *)fdtv->avc_data;
480 diff --git a/drivers/media/firewire/firedtv.h b/drivers/media/firewire/firedtv.h
481 index 345d1eda8c05..5b18a08c6285 100644
482 --- a/drivers/media/firewire/firedtv.h
483 +++ b/drivers/media/firewire/firedtv.h
484 @@ -124,8 +124,10 @@ int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
485 struct dvb_diseqc_master_cmd *diseqcmd);
486 void avc_remote_ctrl_work(struct work_struct *work);
487 int avc_register_remote_control(struct firedtv *fdtv);
488 -int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
489 -int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
490 +int avc_ca_app_info(struct firedtv *fdtv, unsigned char *app_info,
491 + unsigned int *len);
492 +int avc_ca_info(struct firedtv *fdtv, unsigned char *app_info,
493 + unsigned int *len);
494 int avc_ca_reset(struct firedtv *fdtv);
495 int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length);
496 int avc_ca_get_time_date(struct firedtv *fdtv, int *interval);
497 diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
498 index 0ad8ef565b74..b73d68e7b195 100644
499 --- a/drivers/mmc/host/atmel-mci.c
500 +++ b/drivers/mmc/host/atmel-mci.c
501 @@ -1984,13 +1984,14 @@ static void atmci_tasklet_func(unsigned long priv)
502 }
503
504 atmci_request_end(host, host->mrq);
505 - state = STATE_IDLE;
506 + goto unlock; /* atmci_request_end() sets host->state */
507 break;
508 }
509 } while (state != prev_state);
510
511 host->state = state;
512
513 +unlock:
514 spin_unlock(&host->lock);
515 }
516
517 diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c
518 index ad03763e009a..a9f8edc17827 100644
519 --- a/drivers/net/ethernet/intel/e1000e/ptp.c
520 +++ b/drivers/net/ethernet/intel/e1000e/ptp.c
521 @@ -191,10 +191,14 @@ static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
522 struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
523 ptp_clock_info);
524 unsigned long flags;
525 - u64 ns;
526 + u64 cycles, ns;
527
528 spin_lock_irqsave(&adapter->systim_lock, flags);
529 - ns = timecounter_read(&adapter->tc);
530 +
531 + /* Use timecounter_cyc2time() to allow non-monotonic SYSTIM readings */
532 + cycles = adapter->cc.read(&adapter->cc);
533 + ns = timecounter_cyc2time(&adapter->tc, cycles);
534 +
535 spin_unlock_irqrestore(&adapter->systim_lock, flags);
536
537 *ts = ns_to_timespec64(ns);
538 @@ -250,9 +254,12 @@ static void e1000e_systim_overflow_work(struct work_struct *work)
539 systim_overflow_work.work);
540 struct e1000_hw *hw = &adapter->hw;
541 struct timespec64 ts;
542 + u64 ns;
543
544 - adapter->ptp_clock_info.gettime64(&adapter->ptp_clock_info, &ts);
545 + /* Update the timecounter */
546 + ns = timecounter_read(&adapter->tc);
547
548 + ts = ns_to_timespec64(ns);
549 e_dbg("SYSTIM overflow check at %lld.%09lu\n",
550 (long long) ts.tv_sec, ts.tv_nsec);
551
552 diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
553 index 24754d3fb0ac..7a4393ffe98e 100644
554 --- a/drivers/net/ethernet/realtek/r8169.c
555 +++ b/drivers/net/ethernet/realtek/r8169.c
556 @@ -324,6 +324,8 @@ enum cfg_version {
557 };
558
559 static const struct pci_device_id rtl8169_pci_tbl[] = {
560 + { PCI_VDEVICE(REALTEK, 0x2502), RTL_CFG_1 },
561 + { PCI_VDEVICE(REALTEK, 0x2600), RTL_CFG_1 },
562 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 },
563 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 },
564 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 },
565 diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
566 index ed277685da1d..10bd13b30178 100644
567 --- a/drivers/platform/x86/asus-wmi.c
568 +++ b/drivers/platform/x86/asus-wmi.c
569 @@ -2154,7 +2154,8 @@ static int asus_wmi_add(struct platform_device *pdev)
570 err = asus_wmi_backlight_init(asus);
571 if (err && err != -ENODEV)
572 goto fail_backlight;
573 - }
574 + } else
575 + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
576
577 status = wmi_install_notify_handler(asus->driver->event_guid,
578 asus_wmi_notify, asus);
579 diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c
580 index e413113c86ac..663d8f503c86 100644
581 --- a/drivers/scsi/megaraid/megaraid_sas_fp.c
582 +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
583 @@ -1275,7 +1275,7 @@ void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *drv_map,
584
585 for (ldCount = 0; ldCount < MAX_LOGICAL_DRIVES_EXT; ldCount++) {
586 ld = MR_TargetIdToLdGet(ldCount, drv_map);
587 - if (ld >= MAX_LOGICAL_DRIVES_EXT) {
588 + if (ld >= MAX_LOGICAL_DRIVES_EXT - 1) {
589 lbInfo[ldCount].loadBalanceFlag = 0;
590 continue;
591 }
592 diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
593 index f722a0e6caa4..fe1a20973e47 100644
594 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
595 +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
596 @@ -1902,7 +1902,7 @@ static void megasas_build_ld_nonrw_fusion(struct megasas_instance *instance,
597 device_id < instance->fw_supported_vd_count)) {
598
599 ld = MR_TargetIdToLdGet(device_id, local_map_ptr);
600 - if (ld >= instance->fw_supported_vd_count)
601 + if (ld >= instance->fw_supported_vd_count - 1)
602 fp_possible = 0;
603
604 raid = MR_LdRaidGet(ld, local_map_ptr);
605 diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
606 index 96a343ec8313..b2b969990a5d 100644
607 --- a/drivers/scsi/smartpqi/smartpqi_init.c
608 +++ b/drivers/scsi/smartpqi/smartpqi_init.c
609 @@ -2523,6 +2523,9 @@ static unsigned int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info,
610 switch (response->header.iu_type) {
611 case PQI_RESPONSE_IU_RAID_PATH_IO_SUCCESS:
612 case PQI_RESPONSE_IU_AIO_PATH_IO_SUCCESS:
613 + if (io_request->scmd)
614 + io_request->scmd->result = 0;
615 + /* fall through */
616 case PQI_RESPONSE_IU_GENERAL_MANAGEMENT:
617 break;
618 case PQI_RESPONSE_IU_TASK_MANAGEMENT:
619 diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
620 index 2a91ed3ef380..37d7d57cf2c6 100644
621 --- a/drivers/target/target_core_spc.c
622 +++ b/drivers/target/target_core_spc.c
623 @@ -108,12 +108,17 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)
624
625 buf[7] = 0x2; /* CmdQue=1 */
626
627 - memcpy(&buf[8], "LIO-ORG ", 8);
628 - memset(&buf[16], 0x20, 16);
629 + /*
630 + * ASCII data fields described as being left-aligned shall have any
631 + * unused bytes at the end of the field (i.e., highest offset) and the
632 + * unused bytes shall be filled with ASCII space characters (20h).
633 + */
634 + memset(&buf[8], 0x20, 8 + 16 + 4);
635 + memcpy(&buf[8], "LIO-ORG", sizeof("LIO-ORG") - 1);
636 memcpy(&buf[16], dev->t10_wwn.model,
637 - min_t(size_t, strlen(dev->t10_wwn.model), 16));
638 + strnlen(dev->t10_wwn.model, 16));
639 memcpy(&buf[32], dev->t10_wwn.revision,
640 - min_t(size_t, strlen(dev->t10_wwn.revision), 4));
641 + strnlen(dev->t10_wwn.revision, 4));
642 buf[4] = 31; /* Set additional length to 31 */
643
644 return 0;
645 @@ -251,7 +256,9 @@ check_t10_vend_desc:
646 buf[off] = 0x2; /* ASCII */
647 buf[off+1] = 0x1; /* T10 Vendor ID */
648 buf[off+2] = 0x0;
649 - memcpy(&buf[off+4], "LIO-ORG", 8);
650 + /* left align Vendor ID and pad with spaces */
651 + memset(&buf[off+4], 0x20, 8);
652 + memcpy(&buf[off+4], "LIO-ORG", sizeof("LIO-ORG") - 1);
653 /* Extra Byte for NULL Terminator */
654 id_len++;
655 /* Identifier Length */
656 diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
657 index 41b0dd67fcce..2d8089fc2139 100644
658 --- a/drivers/tty/serial/amba-pl011.c
659 +++ b/drivers/tty/serial/amba-pl011.c
660 @@ -2712,6 +2712,7 @@ static struct platform_driver arm_sbsa_uart_platform_driver = {
661 .name = "sbsa-uart",
662 .of_match_table = of_match_ptr(sbsa_uart_of_match),
663 .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match),
664 + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011),
665 },
666 };
667
668 @@ -2740,6 +2741,7 @@ static struct amba_driver pl011_driver = {
669 .drv = {
670 .name = "uart-pl011",
671 .pm = &pl011_dev_pm_ops,
672 + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011),
673 },
674 .id_table = pl011_ids,
675 .probe = pl011_probe,
676 diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
677 index 7f8e99bbcb73..fb77d55a8d95 100644
678 --- a/drivers/tty/serial/pic32_uart.c
679 +++ b/drivers/tty/serial/pic32_uart.c
680 @@ -920,6 +920,7 @@ static struct platform_driver pic32_uart_platform_driver = {
681 .driver = {
682 .name = PIC32_DEV_NAME,
683 .of_match_table = of_match_ptr(pic32_serial_dt_ids),
684 + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_PIC32),
685 },
686 };
687
688 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
689 index 53e6db8b0330..bcfdaf6ddbb2 100644
690 --- a/drivers/tty/serial/serial_core.c
691 +++ b/drivers/tty/serial/serial_core.c
692 @@ -195,10 +195,15 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
693 if (!state->xmit.buf) {
694 state->xmit.buf = (unsigned char *) page;
695 uart_circ_clear(&state->xmit);
696 + uart_port_unlock(uport, flags);
697 } else {
698 + uart_port_unlock(uport, flags);
699 + /*
700 + * Do not free() the page under the port lock, see
701 + * uart_shutdown().
702 + */
703 free_page(page);
704 }
705 - uart_port_unlock(uport, flags);
706
707 retval = uport->ops->startup(uport);
708 if (retval == 0) {
709 @@ -258,6 +263,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
710 struct uart_port *uport = uart_port_check(state);
711 struct tty_port *port = &state->port;
712 unsigned long flags = 0;
713 + char *xmit_buf = NULL;
714
715 /*
716 * Set the TTY IO error marker
717 @@ -288,14 +294,18 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
718 tty_port_set_suspended(port, 0);
719
720 /*
721 - * Free the transmit buffer page.
722 + * Do not free() the transmit buffer page under the port lock since
723 + * this can create various circular locking scenarios. For instance,
724 + * console driver may need to allocate/free a debug object, which
725 + * can endup in printk() recursion.
726 */
727 uart_port_lock(state, flags);
728 - if (state->xmit.buf) {
729 - free_page((unsigned long)state->xmit.buf);
730 - state->xmit.buf = NULL;
731 - }
732 + xmit_buf = state->xmit.buf;
733 + state->xmit.buf = NULL;
734 uart_port_unlock(uport, flags);
735 +
736 + if (xmit_buf)
737 + free_page((unsigned long)xmit_buf);
738 }
739
740 /**
741 diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
742 index fcf2e51f2cfe..7333d64f68f2 100644
743 --- a/drivers/tty/serial/xilinx_uartps.c
744 +++ b/drivers/tty/serial/xilinx_uartps.c
745 @@ -1602,6 +1602,7 @@ static struct platform_driver cdns_uart_platform_driver = {
746 .name = CDNS_UART_NAME,
747 .of_match_table = cdns_uart_of_match,
748 .pm = &cdns_uart_dev_pm_ops,
749 + .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_XILINX_PS_UART),
750 },
751 };
752
753 diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
754 index 79b0de846f21..226640563df3 100644
755 --- a/fs/jffs2/super.c
756 +++ b/fs/jffs2/super.c
757 @@ -101,7 +101,8 @@ static int jffs2_sync_fs(struct super_block *sb, int wait)
758 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
759
760 #ifdef CONFIG_JFFS2_FS_WRITEBUFFER
761 - cancel_delayed_work_sync(&c->wbuf_dwork);
762 + if (jffs2_is_writebuffered(c))
763 + cancel_delayed_work_sync(&c->wbuf_dwork);
764 #endif
765
766 mutex_lock(&c->alloc_sem);
767 diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
768 index fe0d1f9571bb..5d53d0d63d19 100644
769 --- a/fs/ocfs2/localalloc.c
770 +++ b/fs/ocfs2/localalloc.c
771 @@ -345,13 +345,18 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
772 if (num_used
773 || alloc->id1.bitmap1.i_used
774 || alloc->id1.bitmap1.i_total
775 - || la->la_bm_off)
776 - mlog(ML_ERROR, "Local alloc hasn't been recovered!\n"
777 + || la->la_bm_off) {
778 + mlog(ML_ERROR, "inconsistent detected, clean journal with"
779 + " unrecovered local alloc, please run fsck.ocfs2!\n"
780 "found = %u, set = %u, taken = %u, off = %u\n",
781 num_used, le32_to_cpu(alloc->id1.bitmap1.i_used),
782 le32_to_cpu(alloc->id1.bitmap1.i_total),
783 OCFS2_LOCAL_ALLOC(alloc)->la_bm_off);
784
785 + status = -EINVAL;
786 + goto bail;
787 + }
788 +
789 osb->local_alloc_bh = alloc_bh;
790 osb->local_alloc_state = OCFS2_LA_ENABLED;
791
792 diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
793 index ecdb3baa1283..11e558efd61e 100644
794 --- a/fs/pstore/ram_core.c
795 +++ b/fs/pstore/ram_core.c
796 @@ -488,6 +488,11 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig,
797 sig ^= PERSISTENT_RAM_SIG;
798
799 if (prz->buffer->sig == sig) {
800 + if (buffer_size(prz) == 0) {
801 + pr_debug("found existing empty buffer\n");
802 + return 0;
803 + }
804 +
805 if (buffer_size(prz) > prz->buffer_size ||
806 buffer_start(prz) > buffer_size(prz))
807 pr_info("found existing invalid buffer, size %zu, start %zu\n",
808 diff --git a/include/asm-generic/qspinlock_types.h b/include/asm-generic/qspinlock_types.h
809 index d10f1e7d6ba8..6503e96710fa 100644
810 --- a/include/asm-generic/qspinlock_types.h
811 +++ b/include/asm-generic/qspinlock_types.h
812 @@ -18,6 +18,8 @@
813 #ifndef __ASM_GENERIC_QSPINLOCK_TYPES_H
814 #define __ASM_GENERIC_QSPINLOCK_TYPES_H
815
816 +#include <asm/byteorder.h>
817 +
818 /*
819 * Including atomic.h with PARAVIRT on will cause compilation errors because
820 * of recursive header file incluson via paravirt_types.h. So don't include
821 diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
822 index 32728ff8095c..4ea779b25a51 100644
823 --- a/include/linux/backing-dev-defs.h
824 +++ b/include/linux/backing-dev-defs.h
825 @@ -225,6 +225,14 @@ static inline void wb_get(struct bdi_writeback *wb)
826 */
827 static inline void wb_put(struct bdi_writeback *wb)
828 {
829 + if (WARN_ON_ONCE(!wb->bdi)) {
830 + /*
831 + * A driver bug might cause a file to be removed before bdi was
832 + * initialized.
833 + */
834 + return;
835 + }
836 +
837 if (wb != &wb->bdi->wb)
838 percpu_ref_put(&wb->refcnt);
839 }
840 diff --git a/mm/page-writeback.c b/mm/page-writeback.c
841 index 807236aed275..281a46aeae61 100644
842 --- a/mm/page-writeback.c
843 +++ b/mm/page-writeback.c
844 @@ -2148,6 +2148,7 @@ int write_cache_pages(struct address_space *mapping,
845 {
846 int ret = 0;
847 int done = 0;
848 + int error;
849 struct pagevec pvec;
850 int nr_pages;
851 pgoff_t uninitialized_var(writeback_index);
852 @@ -2244,25 +2245,31 @@ continue_unlock:
853 goto continue_unlock;
854
855 trace_wbc_writepage(wbc, inode_to_bdi(mapping->host));
856 - ret = (*writepage)(page, wbc, data);
857 - if (unlikely(ret)) {
858 - if (ret == AOP_WRITEPAGE_ACTIVATE) {
859 + error = (*writepage)(page, wbc, data);
860 + if (unlikely(error)) {
861 + /*
862 + * Handle errors according to the type of
863 + * writeback. There's no need to continue for
864 + * background writeback. Just push done_index
865 + * past this page so media errors won't choke
866 + * writeout for the entire file. For integrity
867 + * writeback, we must process the entire dirty
868 + * set regardless of errors because the fs may
869 + * still have state to clear for each page. In
870 + * that case we continue processing and return
871 + * the first error.
872 + */
873 + if (error == AOP_WRITEPAGE_ACTIVATE) {
874 unlock_page(page);
875 - ret = 0;
876 - } else {
877 - /*
878 - * done_index is set past this page,
879 - * so media errors will not choke
880 - * background writeout for the entire
881 - * file. This has consequences for
882 - * range_cyclic semantics (ie. it may
883 - * not be suitable for data integrity
884 - * writeout).
885 - */
886 + error = 0;
887 + } else if (wbc->sync_mode != WB_SYNC_ALL) {
888 + ret = error;
889 done_index = page->index + 1;
890 done = 1;
891 break;
892 }
893 + if (!ret)
894 + ret = error;
895 }
896
897 /*
898 diff --git a/net/core/sock.c b/net/core/sock.c
899 index 68c831e1a5c0..3041aa6df602 100644
900 --- a/net/core/sock.c
901 +++ b/net/core/sock.c
902 @@ -699,6 +699,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
903 break;
904 case SO_DONTROUTE:
905 sock_valbool_flag(sk, SOCK_LOCALROUTE, valbool);
906 + sk_dst_reset(sk);
907 break;
908 case SO_BROADCAST:
909 sock_valbool_flag(sk, SOCK_BROADCAST, valbool);
910 diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
911 index f7b425615c12..c81b2c5caf26 100644
912 --- a/net/ipv6/af_inet6.c
913 +++ b/net/ipv6/af_inet6.c
914 @@ -306,6 +306,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
915
916 /* Check if the address belongs to the host. */
917 if (addr_type == IPV6_ADDR_MAPPED) {
918 + struct net_device *dev = NULL;
919 int chk_addr_ret;
920
921 /* Binding to v4-mapped address on a v6-only socket
922 @@ -316,9 +317,20 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
923 goto out;
924 }
925
926 + rcu_read_lock();
927 + if (sk->sk_bound_dev_if) {
928 + dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
929 + if (!dev) {
930 + err = -ENODEV;
931 + goto out_unlock;
932 + }
933 + }
934 +
935 /* Reproduce AF_INET checks to make the bindings consistent */
936 v4addr = addr->sin6_addr.s6_addr32[3];
937 - chk_addr_ret = inet_addr_type(net, v4addr);
938 + chk_addr_ret = inet_addr_type_dev_table(net, dev, v4addr);
939 + rcu_read_unlock();
940 +
941 if (!net->ipv4.sysctl_ip_nonlocal_bind &&
942 !(inet->freebind || inet->transparent) &&
943 v4addr != htonl(INADDR_ANY) &&
944 diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
945 index c410d257da06..0c7800112ff5 100644
946 --- a/scripts/kconfig/zconf.l
947 +++ b/scripts/kconfig/zconf.l
948 @@ -71,7 +71,7 @@ static void warn_ignored_character(char chr)
949 {
950 fprintf(stderr,
951 "%s:%d:warning: ignoring unsupported character '%c'\n",
952 - zconf_curname(), zconf_lineno(), chr);
953 + current_file->name, yylineno, chr);
954 }
955 %}
956
957 @@ -191,6 +191,8 @@ n [A-Za-z0-9_-]
958 }
959 <<EOF>> {
960 BEGIN(INITIAL);
961 + yylval.string = text;
962 + return T_WORD_QUOTE;
963 }
964 }
965
966 diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
967 index 8ded80867b92..d293b546a2aa 100644
968 --- a/security/selinux/hooks.c
969 +++ b/security/selinux/hooks.c
970 @@ -2758,7 +2758,7 @@ static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data)
971 return rc;
972
973 /* Allow all mounts performed by the kernel */
974 - if (flags & MS_KERNMOUNT)
975 + if (flags & (MS_KERNMOUNT | MS_SUBMOUNT))
976 return 0;
977
978 ad.type = LSM_AUDIT_DATA_DENTRY;
979 diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig
980 index ab894ed1ff67..8557e54d2659 100644
981 --- a/sound/firewire/Kconfig
982 +++ b/sound/firewire/Kconfig
983 @@ -40,6 +40,7 @@ config SND_OXFW
984 * Mackie(Loud) U.420/U.420d
985 * TASCAM FireOne
986 * Stanton Controllers & Systems 1 Deck/Mixer
987 + * APOGEE duet FireWire
988
989 To compile this driver as a module, choose M here: the module
990 will be called snd-oxfw.
991 diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
992 index d0dfa822266b..3b4eaffe4a7f 100644
993 --- a/sound/firewire/bebob/bebob.c
994 +++ b/sound/firewire/bebob/bebob.c
995 @@ -434,7 +434,7 @@ static const struct ieee1394_device_id bebob_id_table[] = {
996 /* Apogee Electronics, DA/AD/DD-16X (X-FireWire card) */
997 SND_BEBOB_DEV_ENTRY(VEN_APOGEE, 0x00010048, &spec_normal),
998 /* Apogee Electronics, Ensemble */
999 - SND_BEBOB_DEV_ENTRY(VEN_APOGEE, 0x00001eee, &spec_normal),
1000 + SND_BEBOB_DEV_ENTRY(VEN_APOGEE, 0x01eeee, &spec_normal),
1001 /* ESI, Quatafire610 */
1002 SND_BEBOB_DEV_ENTRY(VEN_ESI, 0x00010064, &spec_normal),
1003 /* AcousticReality, eARMasterOne */
1004 diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
1005 index 696b6cf35003..b0395c4209ab 100644
1006 --- a/sound/firewire/oxfw/oxfw.c
1007 +++ b/sound/firewire/oxfw/oxfw.c
1008 @@ -20,6 +20,7 @@
1009 #define VENDOR_LACIE 0x00d04b
1010 #define VENDOR_TASCAM 0x00022e
1011 #define OUI_STANTON 0x001260
1012 +#define OUI_APOGEE 0x0003db
1013
1014 #define MODEL_SATELLITE 0x00200f
1015
1016 @@ -441,6 +442,13 @@ static const struct ieee1394_device_id oxfw_id_table[] = {
1017 .vendor_id = OUI_STANTON,
1018 .model_id = 0x002000,
1019 },
1020 + // APOGEE, duet FireWire
1021 + {
1022 + .match_flags = IEEE1394_MATCH_VENDOR_ID |
1023 + IEEE1394_MATCH_MODEL_ID,
1024 + .vendor_id = OUI_APOGEE,
1025 + .model_id = 0x01dddd,
1026 + },
1027 { }
1028 };
1029 MODULE_DEVICE_TABLE(ieee1394, oxfw_id_table);
1030 diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile
1031 index ce4b7e527566..a690d230c311 100644
1032 --- a/tools/lib/subcmd/Makefile
1033 +++ b/tools/lib/subcmd/Makefile
1034 @@ -29,8 +29,6 @@ endif
1035 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
1036
1037 CFLAGS += -I$(srctree)/tools/include/
1038 -CFLAGS += -I$(srctree)/include/uapi
1039 -CFLAGS += -I$(srctree)/include
1040
1041 SUBCMD_IN := $(OUTPUT)libsubcmd-in.o
1042
1043 diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
1044 index 90fa2286edcf..c88adcbf966e 100644
1045 --- a/tools/perf/arch/x86/util/intel-pt.c
1046 +++ b/tools/perf/arch/x86/util/intel-pt.c
1047 @@ -522,10 +522,21 @@ static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu,
1048 struct perf_evsel *evsel)
1049 {
1050 int err;
1051 + char c;
1052
1053 if (!evsel)
1054 return 0;
1055
1056 + /*
1057 + * If supported, force pass-through config term (pt=1) even if user
1058 + * sets pt=0, which avoids senseless kernel errors.
1059 + */
1060 + if (perf_pmu__scan_file(intel_pt_pmu, "format/pt", "%c", &c) == 1 &&
1061 + !(evsel->attr.config & 1)) {
1062 + pr_warning("pt=0 doesn't make sense, forcing pt=1\n");
1063 + evsel->attr.config |= 1;
1064 + }
1065 +
1066 err = intel_pt_val_config_term(intel_pt_pmu, "caps/cycle_thresholds",
1067 "cyc_thresh", "caps/psb_cyc",
1068 evsel->attr.config);
1069 diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
1070 index 415a9c38d9f0..14f111a10650 100644
1071 --- a/tools/perf/util/parse-events.c
1072 +++ b/tools/perf/util/parse-events.c
1073 @@ -2225,7 +2225,7 @@ restart:
1074 if (!name_only && strlen(syms->alias))
1075 snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias);
1076 else
1077 - strncpy(name, syms->symbol, MAX_NAME_LEN);
1078 + strlcpy(name, syms->symbol, MAX_NAME_LEN);
1079
1080 evt_list[evt_i] = strdup(name);
1081 if (evt_list[evt_i] == NULL)
1082 diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
1083 index 1cbada2dc6be..f735ee038713 100644
1084 --- a/tools/perf/util/svghelper.c
1085 +++ b/tools/perf/util/svghelper.c
1086 @@ -334,7 +334,7 @@ static char *cpu_model(void)
1087 if (file) {
1088 while (fgets(buf, 255, file)) {
1089 if (strstr(buf, "model name")) {
1090 - strncpy(cpu_m, &buf[13], 255);
1091 + strlcpy(cpu_m, &buf[13], 255);
1092 break;
1093 }
1094 }