Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Fri, 31 Jul 2020 16:13:38
Message-Id: 1596212002.6aed8ad7db11b972116e7e37ac56f601dd4cb76b.mpagano@gentoo
1 commit: 6aed8ad7db11b972116e7e37ac56f601dd4cb76b
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 31 16:13:22 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 31 16:13:22 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=6aed8ad7
7
8 Linux patch 4.9.232
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1231_linux-4.9.232.patch | 1945 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1949 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index f3d3878..cf1c30c 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -967,6 +967,10 @@ Patch: 1230_linux-4.9.231.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.231
23
24 +Patch: 1231_linux-4.9.232.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.232
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1231_linux-4.9.232.patch b/1231_linux-4.9.232.patch
33 new file mode 100644
34 index 0000000..4dfa101
35 --- /dev/null
36 +++ b/1231_linux-4.9.232.patch
37 @@ -0,0 +1,1945 @@
38 +diff --git a/Makefile b/Makefile
39 +index 1b1342a8785a..934db3609c16 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 231
46 ++SUBLEVEL = 232
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +@@ -505,7 +505,7 @@ ifeq ($(cc-name),clang)
51 + ifneq ($(CROSS_COMPILE),)
52 + CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
53 + GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
54 +-CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
55 ++CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
56 + GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
57 + endif
58 + ifneq ($(GCC_TOOLCHAIN),)
59 +diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
60 +index a5236a3e5297..3101d1b61713 100644
61 +--- a/arch/arm64/kernel/debug-monitors.c
62 ++++ b/arch/arm64/kernel/debug-monitors.c
63 +@@ -380,14 +380,14 @@ void user_rewind_single_step(struct task_struct *task)
64 + * If single step is active for this thread, then set SPSR.SS
65 + * to 1 to avoid returning to the active-pending state.
66 + */
67 +- if (test_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP))
68 ++ if (test_tsk_thread_flag(task, TIF_SINGLESTEP))
69 + set_regs_spsr_ss(task_pt_regs(task));
70 + }
71 + NOKPROBE_SYMBOL(user_rewind_single_step);
72 +
73 + void user_fastforward_single_step(struct task_struct *task)
74 + {
75 +- if (test_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP))
76 ++ if (test_tsk_thread_flag(task, TIF_SINGLESTEP))
77 + clear_regs_spsr_ss(task_pt_regs(task));
78 + }
79 +
80 +diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
81 +index 5394b9c5f914..1616428a5f95 100644
82 +--- a/arch/parisc/include/asm/atomic.h
83 ++++ b/arch/parisc/include/asm/atomic.h
84 +@@ -255,6 +255,8 @@ atomic64_set(atomic64_t *v, s64 i)
85 + _atomic_spin_unlock_irqrestore(v, flags);
86 + }
87 +
88 ++#define atomic64_set_release(v, i) atomic64_set((v), (i))
89 ++
90 + static __inline__ s64
91 + atomic64_read(const atomic64_t *v)
92 + {
93 +diff --git a/arch/x86/math-emu/wm_sqrt.S b/arch/x86/math-emu/wm_sqrt.S
94 +index d258f59564e1..3b40c98bbbd4 100644
95 +--- a/arch/x86/math-emu/wm_sqrt.S
96 ++++ b/arch/x86/math-emu/wm_sqrt.S
97 +@@ -208,7 +208,7 @@ sqrt_stage_2_finish:
98 +
99 + #ifdef PARANOID
100 + /* It should be possible to get here only if the arg is ffff....ffff */
101 +- cmp $0xffffffff,FPU_fsqrt_arg_1
102 ++ cmpl $0xffffffff,FPU_fsqrt_arg_1
103 + jnz sqrt_stage_2_error
104 + #endif /* PARANOID */
105 +
106 +diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
107 +index b9beae798d72..8679fa306206 100644
108 +--- a/arch/xtensa/kernel/setup.c
109 ++++ b/arch/xtensa/kernel/setup.c
110 +@@ -830,7 +830,8 @@ c_start(struct seq_file *f, loff_t *pos)
111 + static void *
112 + c_next(struct seq_file *f, void *v, loff_t *pos)
113 + {
114 +- return NULL;
115 ++ ++*pos;
116 ++ return c_start(f, pos);
117 + }
118 +
119 + static void
120 +diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
121 +index 9210b9cc4ec9..455c6ec4086c 100644
122 +--- a/arch/xtensa/kernel/xtensa_ksyms.c
123 ++++ b/arch/xtensa/kernel/xtensa_ksyms.c
124 +@@ -82,13 +82,13 @@ void __xtensa_libgcc_window_spill(void)
125 + }
126 + EXPORT_SYMBOL(__xtensa_libgcc_window_spill);
127 +
128 +-unsigned long __sync_fetch_and_and_4(unsigned long *p, unsigned long v)
129 ++unsigned int __sync_fetch_and_and_4(volatile void *p, unsigned int v)
130 + {
131 + BUG();
132 + }
133 + EXPORT_SYMBOL(__sync_fetch_and_and_4);
134 +
135 +-unsigned long __sync_fetch_and_or_4(unsigned long *p, unsigned long v)
136 ++unsigned int __sync_fetch_and_or_4(volatile void *p, unsigned int v)
137 + {
138 + BUG();
139 + }
140 +diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
141 +index 36ce3511c733..7d0c83b47259 100644
142 +--- a/drivers/base/regmap/regmap-debugfs.c
143 ++++ b/drivers/base/regmap/regmap-debugfs.c
144 +@@ -204,6 +204,9 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
145 + if (*ppos < 0 || !count)
146 + return -EINVAL;
147 +
148 ++ if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
149 ++ count = PAGE_SIZE << (MAX_ORDER - 1);
150 ++
151 + buf = kmalloc(count, GFP_KERNEL);
152 + if (!buf)
153 + return -ENOMEM;
154 +@@ -352,6 +355,9 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file,
155 + if (*ppos < 0 || !count)
156 + return -EINVAL;
157 +
158 ++ if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
159 ++ count = PAGE_SIZE << (MAX_ORDER - 1);
160 ++
161 + buf = kmalloc(count, GFP_KERNEL);
162 + if (!buf)
163 + return -ENOMEM;
164 +diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
165 +index 1799a1dfa46e..cd984b59a8a1 100644
166 +--- a/drivers/base/regmap/regmap.c
167 ++++ b/drivers/base/regmap/regmap.c
168 +@@ -1239,7 +1239,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)
169 +
170 + /* If the user didn't specify a name match any */
171 + if (data)
172 +- return (*r)->name == data;
173 ++ return !strcmp((*r)->name, data);
174 + else
175 + return 1;
176 + }
177 +diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
178 +index 1389f0582e29..c5a45c57b8b8 100644
179 +--- a/drivers/dma/ioat/dma.c
180 ++++ b/drivers/dma/ioat/dma.c
181 +@@ -38,6 +38,18 @@
182 +
183 + #include "../dmaengine.h"
184 +
185 ++int completion_timeout = 200;
186 ++module_param(completion_timeout, int, 0644);
187 ++MODULE_PARM_DESC(completion_timeout,
188 ++ "set ioat completion timeout [msec] (default 200 [msec])");
189 ++int idle_timeout = 2000;
190 ++module_param(idle_timeout, int, 0644);
191 ++MODULE_PARM_DESC(idle_timeout,
192 ++ "set ioat idel timeout [msec] (default 2000 [msec])");
193 ++
194 ++#define IDLE_TIMEOUT msecs_to_jiffies(idle_timeout)
195 ++#define COMPLETION_TIMEOUT msecs_to_jiffies(completion_timeout)
196 ++
197 + static char *chanerr_str[] = {
198 + "DMA Transfer Destination Address Error",
199 + "Next Descriptor Address Error",
200 +diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
201 +index a9bc1a15b0d1..b0152288983b 100644
202 +--- a/drivers/dma/ioat/dma.h
203 ++++ b/drivers/dma/ioat/dma.h
204 +@@ -111,8 +111,6 @@ struct ioatdma_chan {
205 + #define IOAT_RUN 5
206 + #define IOAT_CHAN_ACTIVE 6
207 + struct timer_list timer;
208 +- #define COMPLETION_TIMEOUT msecs_to_jiffies(100)
209 +- #define IDLE_TIMEOUT msecs_to_jiffies(2000)
210 + #define RESET_DELAY msecs_to_jiffies(100)
211 + struct ioatdma_device *ioat_dma;
212 + dma_addr_t completion_dma;
213 +diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
214 +index c16c06b3dd2f..54296e262dea 100644
215 +--- a/drivers/dma/tegra210-adma.c
216 ++++ b/drivers/dma/tegra210-adma.c
217 +@@ -583,6 +583,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc)
218 +
219 + ret = pm_runtime_get_sync(tdc2dev(tdc));
220 + if (ret < 0) {
221 ++ pm_runtime_put_noidle(tdc2dev(tdc));
222 + free_irq(tdc->irq, tdc);
223 + return ret;
224 + }
225 +@@ -764,8 +765,10 @@ static int tegra_adma_probe(struct platform_device *pdev)
226 + pm_runtime_enable(&pdev->dev);
227 +
228 + ret = pm_runtime_get_sync(&pdev->dev);
229 +- if (ret < 0)
230 ++ if (ret < 0) {
231 ++ pm_runtime_put_noidle(&pdev->dev);
232 + goto rpm_disable;
233 ++ }
234 +
235 + ret = tegra_adma_init(tdma);
236 + if (ret)
237 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
238 +index 954f5b76bfcf..d44965f805fe 100644
239 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
240 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
241 +@@ -118,10 +118,10 @@ g94_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
242 + if (retries)
243 + udelay(400);
244 +
245 +- /* transaction request, wait up to 1ms for it to complete */
246 ++ /* transaction request, wait up to 2ms for it to complete */
247 + nvkm_wr32(device, 0x00e4e4 + base, 0x00010000 | ctrl);
248 +
249 +- timeout = 1000;
250 ++ timeout = 2000;
251 + do {
252 + ctrl = nvkm_rd32(device, 0x00e4e4 + base);
253 + udelay(1);
254 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
255 +index 61d729b82c69..a5783f4d972e 100644
256 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
257 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
258 +@@ -118,10 +118,10 @@ gm200_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
259 + if (retries)
260 + udelay(400);
261 +
262 +- /* transaction request, wait up to 1ms for it to complete */
263 ++ /* transaction request, wait up to 2ms for it to complete */
264 + nvkm_wr32(device, 0x00d954 + base, 0x00010000 | ctrl);
265 +
266 +- timeout = 1000;
267 ++ timeout = 2000;
268 + do {
269 + ctrl = nvkm_rd32(device, 0x00d954 + base);
270 + udelay(1);
271 +diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
272 +index 197eb75d10ef..959a9e38b4f5 100644
273 +--- a/drivers/hid/hid-apple.c
274 ++++ b/drivers/hid/hid-apple.c
275 +@@ -55,6 +55,7 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\")
276 + struct apple_sc {
277 + unsigned long quirks;
278 + unsigned int fn_on;
279 ++ unsigned int fn_found;
280 + DECLARE_BITMAP(pressed_numlock, KEY_CNT);
281 + };
282 +
283 +@@ -340,12 +341,15 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
284 + struct hid_field *field, struct hid_usage *usage,
285 + unsigned long **bit, int *max)
286 + {
287 ++ struct apple_sc *asc = hid_get_drvdata(hdev);
288 ++
289 + if (usage->hid == (HID_UP_CUSTOM | 0x0003) ||
290 + usage->hid == (HID_UP_MSVENDOR | 0x0003) ||
291 + usage->hid == (HID_UP_HPVENDOR2 | 0x0003)) {
292 + /* The fn key on Apple USB keyboards */
293 + set_bit(EV_REP, hi->input->evbit);
294 + hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN);
295 ++ asc->fn_found = true;
296 + apple_setup_input(hi->input);
297 + return 1;
298 + }
299 +@@ -372,6 +376,19 @@ static int apple_input_mapped(struct hid_device *hdev, struct hid_input *hi,
300 + return 0;
301 + }
302 +
303 ++static int apple_input_configured(struct hid_device *hdev,
304 ++ struct hid_input *hidinput)
305 ++{
306 ++ struct apple_sc *asc = hid_get_drvdata(hdev);
307 ++
308 ++ if ((asc->quirks & APPLE_HAS_FN) && !asc->fn_found) {
309 ++ hid_info(hdev, "Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n");
310 ++ asc->quirks = 0;
311 ++ }
312 ++
313 ++ return 0;
314 ++}
315 ++
316 + static int apple_probe(struct hid_device *hdev,
317 + const struct hid_device_id *id)
318 + {
319 +@@ -593,6 +610,7 @@ static struct hid_driver apple_driver = {
320 + .event = apple_event,
321 + .input_mapping = apple_input_mapping,
322 + .input_mapped = apple_input_mapped,
323 ++ .input_configured = apple_input_configured,
324 + };
325 + module_hid_driver(apple_driver);
326 +
327 +diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
328 +index 681ac9bc68b3..f98c1e1b1dbd 100644
329 +--- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
330 ++++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
331 +@@ -373,6 +373,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = {
332 + },
333 + .driver_data = (void *)&sipodev_desc
334 + },
335 ++ {
336 ++ .ident = "Mediacom FlexBook edge 13",
337 ++ .matches = {
338 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"),
339 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook_edge13-M-FBE13"),
340 ++ },
341 ++ .driver_data = (void *)&sipodev_desc
342 ++ },
343 + {
344 + .ident = "Odys Winbook 13",
345 + .matches = {
346 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
347 +index 3a352f76e633..427d4dbc9735 100644
348 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
349 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
350 +@@ -1023,8 +1023,11 @@ static int bnxt_set_pauseparam(struct net_device *dev,
351 + if (epause->tx_pause)
352 + link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
353 +
354 +- if (netif_running(dev))
355 ++ if (netif_running(dev)) {
356 ++ mutex_lock(&bp->link_lock);
357 + rc = bnxt_hwrm_set_pause(bp);
358 ++ mutex_unlock(&bp->link_lock);
359 ++ }
360 + return rc;
361 + }
362 +
363 +diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
364 +index 49f692907a30..c4197d0ec4d2 100644
365 +--- a/drivers/net/ethernet/marvell/sky2.c
366 ++++ b/drivers/net/ethernet/marvell/sky2.c
367 +@@ -215,7 +215,7 @@ io_error:
368 +
369 + static inline u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
370 + {
371 +- u16 v;
372 ++ u16 v = 0;
373 + __gm_phy_read(hw, port, reg, &v);
374 + return v;
375 + }
376 +diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
377 +index b0c72167bade..3c221ca2cc12 100644
378 +--- a/drivers/net/ethernet/smsc/smc91x.c
379 ++++ b/drivers/net/ethernet/smsc/smc91x.c
380 +@@ -2294,7 +2294,7 @@ static int smc_drv_probe(struct platform_device *pdev)
381 + ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio,
382 + "power", 0, 0, 100);
383 + if (ret)
384 +- return ret;
385 ++ goto out_free_netdev;
386 +
387 + /*
388 + * Optional reset GPIO configured? Minimum 100 ns reset needed
389 +@@ -2303,7 +2303,7 @@ static int smc_drv_probe(struct platform_device *pdev)
390 + ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio,
391 + "reset", 0, 0, 100);
392 + if (ret)
393 +- return ret;
394 ++ goto out_free_netdev;
395 +
396 + /*
397 + * Need to wait for optional EEPROM to load, max 750 us according
398 +diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
399 +index 313e006f74fe..6f3519123eb6 100644
400 +--- a/drivers/net/hippi/rrunner.c
401 ++++ b/drivers/net/hippi/rrunner.c
402 +@@ -1250,7 +1250,7 @@ static int rr_open(struct net_device *dev)
403 + rrpriv->info = NULL;
404 + }
405 + if (rrpriv->rx_ctrl) {
406 +- pci_free_consistent(pdev, sizeof(struct ring_ctrl),
407 ++ pci_free_consistent(pdev, 256 * sizeof(struct ring_ctrl),
408 + rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma);
409 + rrpriv->rx_ctrl = NULL;
410 + }
411 +diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
412 +index 7e94526de51c..5649cc075ccb 100644
413 +--- a/drivers/net/phy/dp83640.c
414 ++++ b/drivers/net/phy/dp83640.c
415 +@@ -1337,6 +1337,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
416 + dp83640->hwts_rx_en = 1;
417 + dp83640->layer = PTP_CLASS_L4;
418 + dp83640->version = PTP_CLASS_V1;
419 ++ cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
420 + break;
421 + case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
422 + case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
423 +@@ -1344,6 +1345,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
424 + dp83640->hwts_rx_en = 1;
425 + dp83640->layer = PTP_CLASS_L4;
426 + dp83640->version = PTP_CLASS_V2;
427 ++ cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
428 + break;
429 + case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
430 + case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
431 +@@ -1351,6 +1353,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
432 + dp83640->hwts_rx_en = 1;
433 + dp83640->layer = PTP_CLASS_L2;
434 + dp83640->version = PTP_CLASS_V2;
435 ++ cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
436 + break;
437 + case HWTSTAMP_FILTER_PTP_V2_EVENT:
438 + case HWTSTAMP_FILTER_PTP_V2_SYNC:
439 +@@ -1358,6 +1361,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
440 + dp83640->hwts_rx_en = 1;
441 + dp83640->layer = PTP_CLASS_L4 | PTP_CLASS_L2;
442 + dp83640->version = PTP_CLASS_V2;
443 ++ cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
444 + break;
445 + default:
446 + return -ERANGE;
447 +diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c
448 +index 2c50497cc4ed..7ec8992401fb 100644
449 +--- a/drivers/net/usb/ax88172a.c
450 ++++ b/drivers/net/usb/ax88172a.c
451 +@@ -217,6 +217,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf)
452 + ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);
453 + if (ret < ETH_ALEN) {
454 + netdev_err(dev->net, "Failed to read MAC address: %d\n", ret);
455 ++ ret = -EIO;
456 + goto free;
457 + }
458 + memcpy(dev->net->dev_addr, buf, ETH_ALEN);
459 +diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
460 +index 6676607164d6..f5657783fad4 100644
461 +--- a/drivers/net/wan/lapbether.c
462 ++++ b/drivers/net/wan/lapbether.c
463 +@@ -308,7 +308,6 @@ static void lapbeth_setup(struct net_device *dev)
464 + dev->netdev_ops = &lapbeth_netdev_ops;
465 + dev->destructor = free_netdev;
466 + dev->type = ARPHRD_X25;
467 +- dev->hard_header_len = 3;
468 + dev->mtu = 1000;
469 + dev->addr_len = 0;
470 + }
471 +@@ -329,6 +328,14 @@ static int lapbeth_new_device(struct net_device *dev)
472 + if (!ndev)
473 + goto out;
474 +
475 ++ /* When transmitting data:
476 ++ * first this driver removes a pseudo header of 1 byte,
477 ++ * then the lapb module prepends an LAPB header of at most 3 bytes,
478 ++ * then this driver prepends a length field of 2 bytes,
479 ++ * then the underlying Ethernet device prepends its own header.
480 ++ */
481 ++ ndev->hard_header_len = -1 + 3 + 2 + dev->hard_header_len;
482 ++
483 + lapbeth = netdev_priv(ndev);
484 + lapbeth->axdev = ndev;
485 +
486 +diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
487 +index eb56bb5916be..3b983f645726 100644
488 +--- a/drivers/net/wan/x25_asy.c
489 ++++ b/drivers/net/wan/x25_asy.c
490 +@@ -186,7 +186,7 @@ static inline void x25_asy_unlock(struct x25_asy *sl)
491 + netif_wake_queue(sl->dev);
492 + }
493 +
494 +-/* Send one completely decapsulated IP datagram to the IP layer. */
495 ++/* Send an LAPB frame to the LAPB module to process. */
496 +
497 + static void x25_asy_bump(struct x25_asy *sl)
498 + {
499 +@@ -198,13 +198,12 @@ static void x25_asy_bump(struct x25_asy *sl)
500 + count = sl->rcount;
501 + dev->stats.rx_bytes += count;
502 +
503 +- skb = dev_alloc_skb(count+1);
504 ++ skb = dev_alloc_skb(count);
505 + if (skb == NULL) {
506 + netdev_warn(sl->dev, "memory squeeze, dropping packet\n");
507 + dev->stats.rx_dropped++;
508 + return;
509 + }
510 +- skb_push(skb, 1); /* LAPB internal control */
511 + memcpy(skb_put(skb, count), sl->rbuff, count);
512 + skb->protocol = x25_type_trans(skb, sl->dev);
513 + err = lapb_data_received(skb->dev, skb);
514 +@@ -212,7 +211,6 @@ static void x25_asy_bump(struct x25_asy *sl)
515 + kfree_skb(skb);
516 + printk(KERN_DEBUG "x25_asy: data received err - %d\n", err);
517 + } else {
518 +- netif_rx(skb);
519 + dev->stats.rx_packets++;
520 + }
521 + }
522 +@@ -358,12 +356,21 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,
523 + */
524 +
525 + /*
526 +- * Called when I frame data arrives. We did the work above - throw it
527 +- * at the net layer.
528 ++ * Called when I frame data arrive. We add a pseudo header for upper
529 ++ * layers and pass it to upper layers.
530 + */
531 +
532 + static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb)
533 + {
534 ++ if (skb_cow(skb, 1)) {
535 ++ kfree_skb(skb);
536 ++ return NET_RX_DROP;
537 ++ }
538 ++ skb_push(skb, 1);
539 ++ skb->data[0] = X25_IFACE_DATA;
540 ++
541 ++ skb->protocol = x25_type_trans(skb, dev);
542 ++
543 + return netif_rx(skb);
544 + }
545 +
546 +@@ -659,7 +666,7 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s)
547 + switch (s) {
548 + case X25_END:
549 + if (!test_and_clear_bit(SLF_ERROR, &sl->flags) &&
550 +- sl->rcount > 2)
551 ++ sl->rcount >= 2)
552 + x25_asy_bump(sl);
553 + clear_bit(SLF_ESCAPE, &sl->flags);
554 + sl->rcount = 0;
555 +diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
556 +index 84b5f8a144ff..fb5b7ce3d2c3 100644
557 +--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
558 ++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
559 +@@ -641,9 +641,9 @@ err:
560 +
561 + static void ath9k_hif_usb_rx_cb(struct urb *urb)
562 + {
563 +- struct sk_buff *skb = (struct sk_buff *) urb->context;
564 +- struct hif_device_usb *hif_dev =
565 +- usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
566 ++ struct rx_buf *rx_buf = (struct rx_buf *)urb->context;
567 ++ struct hif_device_usb *hif_dev = rx_buf->hif_dev;
568 ++ struct sk_buff *skb = rx_buf->skb;
569 + int ret;
570 +
571 + if (!skb)
572 +@@ -683,14 +683,15 @@ resubmit:
573 + return;
574 + free:
575 + kfree_skb(skb);
576 ++ kfree(rx_buf);
577 + }
578 +
579 + static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
580 + {
581 +- struct sk_buff *skb = (struct sk_buff *) urb->context;
582 ++ struct rx_buf *rx_buf = (struct rx_buf *)urb->context;
583 ++ struct hif_device_usb *hif_dev = rx_buf->hif_dev;
584 ++ struct sk_buff *skb = rx_buf->skb;
585 + struct sk_buff *nskb;
586 +- struct hif_device_usb *hif_dev =
587 +- usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
588 + int ret;
589 +
590 + if (!skb)
591 +@@ -730,11 +731,13 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
592 + return;
593 + }
594 +
595 ++ rx_buf->skb = nskb;
596 ++
597 + usb_fill_int_urb(urb, hif_dev->udev,
598 + usb_rcvintpipe(hif_dev->udev,
599 + USB_REG_IN_PIPE),
600 + nskb->data, MAX_REG_IN_BUF_SIZE,
601 +- ath9k_hif_usb_reg_in_cb, nskb, 1);
602 ++ ath9k_hif_usb_reg_in_cb, rx_buf, 1);
603 + }
604 +
605 + resubmit:
606 +@@ -748,6 +751,7 @@ resubmit:
607 + return;
608 + free:
609 + kfree_skb(skb);
610 ++ kfree(rx_buf);
611 + urb->context = NULL;
612 + }
613 +
614 +@@ -793,7 +797,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
615 + init_usb_anchor(&hif_dev->mgmt_submitted);
616 +
617 + for (i = 0; i < MAX_TX_URB_NUM; i++) {
618 +- tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL);
619 ++ tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL);
620 + if (!tx_buf)
621 + goto err;
622 +
623 +@@ -830,8 +834,9 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev)
624 +
625 + static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
626 + {
627 +- struct urb *urb = NULL;
628 ++ struct rx_buf *rx_buf = NULL;
629 + struct sk_buff *skb = NULL;
630 ++ struct urb *urb = NULL;
631 + int i, ret;
632 +
633 + init_usb_anchor(&hif_dev->rx_submitted);
634 +@@ -839,6 +844,12 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
635 +
636 + for (i = 0; i < MAX_RX_URB_NUM; i++) {
637 +
638 ++ rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
639 ++ if (!rx_buf) {
640 ++ ret = -ENOMEM;
641 ++ goto err_rxb;
642 ++ }
643 ++
644 + /* Allocate URB */
645 + urb = usb_alloc_urb(0, GFP_KERNEL);
646 + if (urb == NULL) {
647 +@@ -853,11 +864,14 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
648 + goto err_skb;
649 + }
650 +
651 ++ rx_buf->hif_dev = hif_dev;
652 ++ rx_buf->skb = skb;
653 ++
654 + usb_fill_bulk_urb(urb, hif_dev->udev,
655 + usb_rcvbulkpipe(hif_dev->udev,
656 + USB_WLAN_RX_PIPE),
657 + skb->data, MAX_RX_BUF_SIZE,
658 +- ath9k_hif_usb_rx_cb, skb);
659 ++ ath9k_hif_usb_rx_cb, rx_buf);
660 +
661 + /* Anchor URB */
662 + usb_anchor_urb(urb, &hif_dev->rx_submitted);
663 +@@ -883,6 +897,8 @@ err_submit:
664 + err_skb:
665 + usb_free_urb(urb);
666 + err_urb:
667 ++ kfree(rx_buf);
668 ++err_rxb:
669 + ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
670 + return ret;
671 + }
672 +@@ -894,14 +910,21 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev)
673 +
674 + static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
675 + {
676 +- struct urb *urb = NULL;
677 ++ struct rx_buf *rx_buf = NULL;
678 + struct sk_buff *skb = NULL;
679 ++ struct urb *urb = NULL;
680 + int i, ret;
681 +
682 + init_usb_anchor(&hif_dev->reg_in_submitted);
683 +
684 + for (i = 0; i < MAX_REG_IN_URB_NUM; i++) {
685 +
686 ++ rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
687 ++ if (!rx_buf) {
688 ++ ret = -ENOMEM;
689 ++ goto err_rxb;
690 ++ }
691 ++
692 + /* Allocate URB */
693 + urb = usb_alloc_urb(0, GFP_KERNEL);
694 + if (urb == NULL) {
695 +@@ -916,11 +939,14 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
696 + goto err_skb;
697 + }
698 +
699 ++ rx_buf->hif_dev = hif_dev;
700 ++ rx_buf->skb = skb;
701 ++
702 + usb_fill_int_urb(urb, hif_dev->udev,
703 + usb_rcvintpipe(hif_dev->udev,
704 + USB_REG_IN_PIPE),
705 + skb->data, MAX_REG_IN_BUF_SIZE,
706 +- ath9k_hif_usb_reg_in_cb, skb, 1);
707 ++ ath9k_hif_usb_reg_in_cb, rx_buf, 1);
708 +
709 + /* Anchor URB */
710 + usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
711 +@@ -946,6 +972,8 @@ err_submit:
712 + err_skb:
713 + usb_free_urb(urb);
714 + err_urb:
715 ++ kfree(rx_buf);
716 ++err_rxb:
717 + ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev);
718 + return ret;
719 + }
720 +diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h
721 +index a95cdf562611..835264c36595 100644
722 +--- a/drivers/net/wireless/ath/ath9k/hif_usb.h
723 ++++ b/drivers/net/wireless/ath/ath9k/hif_usb.h
724 +@@ -84,6 +84,11 @@ struct tx_buf {
725 + struct list_head list;
726 + };
727 +
728 ++struct rx_buf {
729 ++ struct sk_buff *skb;
730 ++ struct hif_device_usb *hif_dev;
731 ++};
732 ++
733 + #define HIF_USB_TX_STOP BIT(0)
734 + #define HIF_USB_TX_FLUSH BIT(1)
735 +
736 +diff --git a/drivers/pinctrl/pinctrl-amd.h b/drivers/pinctrl/pinctrl-amd.h
737 +index e8bbb20779d0..83597e1d6dcd 100644
738 +--- a/drivers/pinctrl/pinctrl-amd.h
739 ++++ b/drivers/pinctrl/pinctrl-amd.h
740 +@@ -250,7 +250,7 @@ static const struct amd_pingroup kerncz_groups[] = {
741 + {
742 + .name = "uart0",
743 + .pins = uart0_pins,
744 +- .npins = 9,
745 ++ .npins = 5,
746 + },
747 + {
748 + .name = "uart1",
749 +diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
750 +index 319868f3f674..083cd11ce7d7 100644
751 +--- a/drivers/scsi/scsi_transport_spi.c
752 ++++ b/drivers/scsi/scsi_transport_spi.c
753 +@@ -353,7 +353,7 @@ store_spi_transport_##field(struct device *dev, \
754 + struct spi_transport_attrs *tp \
755 + = (struct spi_transport_attrs *)&starget->starget_data; \
756 + \
757 +- if (i->f->set_##field) \
758 ++ if (!i->f->set_##field) \
759 + return -EINVAL; \
760 + val = simple_strtoul(buf, NULL, 0); \
761 + if (val > tp->max_##field) \
762 +diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c
763 +index ccd1a91290bf..536a135cd00b 100644
764 +--- a/drivers/staging/comedi/drivers/addi_apci_1032.c
765 ++++ b/drivers/staging/comedi/drivers/addi_apci_1032.c
766 +@@ -115,14 +115,22 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
767 + unsigned int *data)
768 + {
769 + struct apci1032_private *devpriv = dev->private;
770 +- unsigned int shift, oldmask;
771 ++ unsigned int shift, oldmask, himask, lomask;
772 +
773 + switch (data[0]) {
774 + case INSN_CONFIG_DIGITAL_TRIG:
775 + if (data[1] != 0)
776 + return -EINVAL;
777 + shift = data[3];
778 +- oldmask = (1U << shift) - 1;
779 ++ if (shift < 32) {
780 ++ oldmask = (1U << shift) - 1;
781 ++ himask = data[4] << shift;
782 ++ lomask = data[5] << shift;
783 ++ } else {
784 ++ oldmask = 0xffffffffu;
785 ++ himask = 0;
786 ++ lomask = 0;
787 ++ }
788 + switch (data[2]) {
789 + case COMEDI_DIGITAL_TRIG_DISABLE:
790 + devpriv->ctrl = 0;
791 +@@ -145,8 +153,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
792 + devpriv->mode2 &= oldmask;
793 + }
794 + /* configure specified channels */
795 +- devpriv->mode1 |= data[4] << shift;
796 +- devpriv->mode2 |= data[5] << shift;
797 ++ devpriv->mode1 |= himask;
798 ++ devpriv->mode2 |= lomask;
799 + break;
800 + case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS:
801 + if (devpriv->ctrl != (APCI1032_CTRL_INT_ENA |
802 +@@ -163,8 +171,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
803 + devpriv->mode2 &= oldmask;
804 + }
805 + /* configure specified channels */
806 +- devpriv->mode1 |= data[4] << shift;
807 +- devpriv->mode2 |= data[5] << shift;
808 ++ devpriv->mode1 |= himask;
809 ++ devpriv->mode2 |= lomask;
810 + break;
811 + default:
812 + return -EINVAL;
813 +diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c
814 +index 79a8799b1262..c4e36fb6df9d 100644
815 +--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
816 ++++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
817 +@@ -461,13 +461,14 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,
818 + struct apci1500_private *devpriv = dev->private;
819 + unsigned int trig = data[1];
820 + unsigned int shift = data[3];
821 +- unsigned int hi_mask = data[4] << shift;
822 +- unsigned int lo_mask = data[5] << shift;
823 +- unsigned int chan_mask = hi_mask | lo_mask;
824 +- unsigned int old_mask = (1 << shift) - 1;
825 ++ unsigned int hi_mask;
826 ++ unsigned int lo_mask;
827 ++ unsigned int chan_mask;
828 ++ unsigned int old_mask;
829 + unsigned int pm;
830 + unsigned int pt;
831 + unsigned int pp;
832 ++ unsigned int invalid_chan;
833 +
834 + if (trig > 1) {
835 + dev_dbg(dev->class_dev,
836 +@@ -475,7 +476,20 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,
837 + return -EINVAL;
838 + }
839 +
840 +- if (chan_mask > 0xffff) {
841 ++ if (shift <= 16) {
842 ++ hi_mask = data[4] << shift;
843 ++ lo_mask = data[5] << shift;
844 ++ old_mask = (1U << shift) - 1;
845 ++ invalid_chan = (data[4] | data[5]) >> (16 - shift);
846 ++ } else {
847 ++ hi_mask = 0;
848 ++ lo_mask = 0;
849 ++ old_mask = 0xffff;
850 ++ invalid_chan = data[4] | data[5];
851 ++ }
852 ++ chan_mask = hi_mask | lo_mask;
853 ++
854 ++ if (invalid_chan) {
855 + dev_dbg(dev->class_dev, "invalid digital trigger channel\n");
856 + return -EINVAL;
857 + }
858 +diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
859 +index 9bfb79c2e5c8..1b4ba19d599e 100644
860 +--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
861 ++++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
862 +@@ -340,14 +340,22 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
863 + unsigned int *data)
864 + {
865 + struct apci1564_private *devpriv = dev->private;
866 +- unsigned int shift, oldmask;
867 ++ unsigned int shift, oldmask, himask, lomask;
868 +
869 + switch (data[0]) {
870 + case INSN_CONFIG_DIGITAL_TRIG:
871 + if (data[1] != 0)
872 + return -EINVAL;
873 + shift = data[3];
874 +- oldmask = (1U << shift) - 1;
875 ++ if (shift < 32) {
876 ++ oldmask = (1U << shift) - 1;
877 ++ himask = data[4] << shift;
878 ++ lomask = data[5] << shift;
879 ++ } else {
880 ++ oldmask = 0xffffffffu;
881 ++ himask = 0;
882 ++ lomask = 0;
883 ++ }
884 + switch (data[2]) {
885 + case COMEDI_DIGITAL_TRIG_DISABLE:
886 + devpriv->ctrl = 0;
887 +@@ -371,8 +379,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
888 + devpriv->mode2 &= oldmask;
889 + }
890 + /* configure specified channels */
891 +- devpriv->mode1 |= data[4] << shift;
892 +- devpriv->mode2 |= data[5] << shift;
893 ++ devpriv->mode1 |= himask;
894 ++ devpriv->mode2 |= lomask;
895 + break;
896 + case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS:
897 + if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA |
898 +@@ -389,8 +397,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
899 + devpriv->mode2 &= oldmask;
900 + }
901 + /* configure specified channels */
902 +- devpriv->mode1 |= data[4] << shift;
903 +- devpriv->mode2 |= data[5] << shift;
904 ++ devpriv->mode1 |= himask;
905 ++ devpriv->mode2 |= lomask;
906 + break;
907 + default:
908 + return -EINVAL;
909 +diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c
910 +index 84c62e256094..6e411b634015 100644
911 +--- a/drivers/staging/comedi/drivers/ni_6527.c
912 ++++ b/drivers/staging/comedi/drivers/ni_6527.c
913 +@@ -341,7 +341,7 @@ static int ni6527_intr_insn_config(struct comedi_device *dev,
914 + case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:
915 + /* check shift amount */
916 + shift = data[3];
917 +- if (shift >= s->n_chan) {
918 ++ if (shift >= 32) {
919 + mask = 0;
920 + rising = 0;
921 + falling = 0;
922 +diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
923 +index f7149bb23180..5297e7d1c663 100644
924 +--- a/drivers/staging/wlan-ng/prism2usb.c
925 ++++ b/drivers/staging/wlan-ng/prism2usb.c
926 +@@ -60,11 +60,25 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
927 + const struct usb_device_id *id)
928 + {
929 + struct usb_device *dev;
930 +-
931 ++ const struct usb_endpoint_descriptor *epd;
932 ++ const struct usb_host_interface *iface_desc = interface->cur_altsetting;
933 + struct wlandevice *wlandev = NULL;
934 + struct hfa384x *hw = NULL;
935 + int result = 0;
936 +
937 ++ if (iface_desc->desc.bNumEndpoints != 2) {
938 ++ result = -ENODEV;
939 ++ goto failed;
940 ++ }
941 ++
942 ++ result = -EINVAL;
943 ++ epd = &iface_desc->endpoint[1].desc;
944 ++ if (!usb_endpoint_is_bulk_in(epd))
945 ++ goto failed;
946 ++ epd = &iface_desc->endpoint[2].desc;
947 ++ if (!usb_endpoint_is_bulk_out(epd))
948 ++ goto failed;
949 ++
950 + dev = interface_to_usbdev(interface);
951 + wlandev = create_wlan();
952 + if (!wlandev) {
953 +diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
954 +index c4e9eba36023..6624cc07ac04 100644
955 +--- a/drivers/tty/serial/8250/8250_core.c
956 ++++ b/drivers/tty/serial/8250/8250_core.c
957 +@@ -529,6 +529,7 @@ static void __init serial8250_isa_init_ports(void)
958 + */
959 + up->mcr_mask = ~ALPHA_KLUDGE_MCR;
960 + up->mcr_force = ALPHA_KLUDGE_MCR;
961 ++ serial8250_set_defaults(up);
962 + }
963 +
964 + /* chain base port ops to support Remote Supervisor Adapter */
965 +@@ -552,7 +553,6 @@ static void __init serial8250_isa_init_ports(void)
966 + port->membase = old_serial_port[i].iomem_base;
967 + port->iotype = old_serial_port[i].io_type;
968 + port->regshift = old_serial_port[i].iomem_reg_shift;
969 +- serial8250_set_defaults(up);
970 +
971 + port->irqflags |= irqflag;
972 + if (serial8250_isa_config != NULL)
973 +diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
974 +index 91db9ca1c6c9..c54f57e4a7dd 100644
975 +--- a/drivers/tty/serial/8250/8250_mtk.c
976 ++++ b/drivers/tty/serial/8250/8250_mtk.c
977 +@@ -45,8 +45,21 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
978 + unsigned long flags;
979 + unsigned int baud, quot;
980 +
981 ++ /*
982 ++ * Store the requested baud rate before calling the generic 8250
983 ++ * set_termios method. Standard 8250 port expects bauds to be
984 ++ * no higher than (uartclk / 16) so the baud will be clamped if it
985 ++ * gets out of that bound. Mediatek 8250 port supports speed
986 ++ * higher than that, therefore we'll get original baud rate back
987 ++ * after calling the generic set_termios method and recalculate
988 ++ * the speed later in this method.
989 ++ */
990 ++ baud = tty_termios_baud_rate(termios);
991 ++
992 + serial8250_do_set_termios(port, termios, old);
993 +
994 ++ tty_termios_encode_baud_rate(termios, baud, baud);
995 ++
996 + /*
997 + * Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS)
998 + *
999 +@@ -85,6 +98,11 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
1000 + */
1001 + spin_lock_irqsave(&port->lock, flags);
1002 +
1003 ++ /*
1004 ++ * Update the per-port timeout.
1005 ++ */
1006 ++ uart_update_timeout(port, termios->c_cflag, baud);
1007 ++
1008 + /* set DLAB we have cval saved in up->lcr from the call to the core */
1009 + serial_port_out(port, UART_LCR, up->lcr | UART_LCR_DLAB);
1010 + serial_dl_write(up, quot);
1011 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
1012 +index 29fb08c8a2fd..3e5a3614fad0 100644
1013 +--- a/drivers/tty/vt/vt.c
1014 ++++ b/drivers/tty/vt/vt.c
1015 +@@ -765,10 +765,19 @@ static const struct tty_port_operations vc_port_ops = {
1016 + .destruct = vc_port_destruct,
1017 + };
1018 +
1019 ++/*
1020 ++ * Change # of rows and columns (0 means unchanged/the size of fg_console)
1021 ++ * [this is to be used together with some user program
1022 ++ * like resize that changes the hardware videomode]
1023 ++ */
1024 ++#define VC_MAXCOL (32767)
1025 ++#define VC_MAXROW (32767)
1026 ++
1027 + int vc_allocate(unsigned int currcons) /* return 0 on success */
1028 + {
1029 + struct vt_notifier_param param;
1030 + struct vc_data *vc;
1031 ++ int err;
1032 +
1033 + WARN_CONSOLE_UNLOCKED();
1034 +
1035 +@@ -798,6 +807,11 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
1036 + if (!*vc->vc_uni_pagedir_loc)
1037 + con_set_default_unimap(vc);
1038 +
1039 ++ err = -EINVAL;
1040 ++ if (vc->vc_cols > VC_MAXCOL || vc->vc_rows > VC_MAXROW ||
1041 ++ vc->vc_screenbuf_size > KMALLOC_MAX_SIZE || !vc->vc_screenbuf_size)
1042 ++ goto err_free;
1043 ++ err = -ENOMEM;
1044 + vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL);
1045 + if (!vc->vc_screenbuf)
1046 + goto err_free;
1047 +@@ -815,7 +829,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
1048 + err_free:
1049 + kfree(vc);
1050 + vc_cons[currcons].d = NULL;
1051 +- return -ENOMEM;
1052 ++ return err;
1053 + }
1054 +
1055 + static inline int resize_screen(struct vc_data *vc, int width, int height,
1056 +@@ -830,14 +844,6 @@ static inline int resize_screen(struct vc_data *vc, int width, int height,
1057 + return err;
1058 + }
1059 +
1060 +-/*
1061 +- * Change # of rows and columns (0 means unchanged/the size of fg_console)
1062 +- * [this is to be used together with some user program
1063 +- * like resize that changes the hardware videomode]
1064 +- */
1065 +-#define VC_RESIZE_MAXCOL (32767)
1066 +-#define VC_RESIZE_MAXROW (32767)
1067 +-
1068 + /**
1069 + * vc_do_resize - resizing method for the tty
1070 + * @tty: tty being resized
1071 +@@ -872,7 +878,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
1072 + user = vc->vc_resize_user;
1073 + vc->vc_resize_user = 0;
1074 +
1075 +- if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW)
1076 ++ if (cols > VC_MAXCOL || lines > VC_MAXROW)
1077 + return -EINVAL;
1078 +
1079 + new_cols = (cols ? cols : vc->vc_cols);
1080 +@@ -883,7 +889,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
1081 + if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
1082 + return 0;
1083 +
1084 +- if (new_screen_size > (4 << 20))
1085 ++ if (new_screen_size > (4 << 20) || !new_screen_size)
1086 + return -EINVAL;
1087 + newscreen = kzalloc(new_screen_size, GFP_USER);
1088 + if (!newscreen)
1089 +@@ -3033,6 +3039,7 @@ static int __init con_init(void)
1090 + INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
1091 + tty_port_init(&vc->port);
1092 + visual_init(vc, currcons, 1);
1093 ++ /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */
1094 + vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
1095 + vc_init(vc, vc->vc_rows, vc->vc_cols,
1096 + currcons || !vc->vc_sw->con_save_screen);
1097 +diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c
1098 +index 9e246d2e55ca..f2b165182b4b 100644
1099 +--- a/drivers/usb/gadget/udc/gr_udc.c
1100 ++++ b/drivers/usb/gadget/udc/gr_udc.c
1101 +@@ -2000,9 +2000,12 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit)
1102 +
1103 + if (num == 0) {
1104 + _req = gr_alloc_request(&ep->ep, GFP_ATOMIC);
1105 ++ if (!_req)
1106 ++ return -ENOMEM;
1107 ++
1108 + buf = devm_kzalloc(dev->dev, PAGE_SIZE, GFP_DMA | GFP_ATOMIC);
1109 +- if (!_req || !buf) {
1110 +- /* possible _req freed by gr_probe via gr_remove */
1111 ++ if (!buf) {
1112 ++ gr_free_request(&ep->ep, _req);
1113 + return -ENOMEM;
1114 + }
1115 +
1116 +diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
1117 +index 144674913c78..3929ac8c6a73 100644
1118 +--- a/drivers/usb/host/xhci-mtk-sch.c
1119 ++++ b/drivers/usb/host/xhci-mtk-sch.c
1120 +@@ -284,6 +284,10 @@ static bool need_bw_sch(struct usb_host_endpoint *ep,
1121 + if (is_fs_or_ls(speed) && !has_tt)
1122 + return false;
1123 +
1124 ++ /* skip endpoint with zero maxpkt */
1125 ++ if (usb_endpoint_maxp(&ep->desc) == 0)
1126 ++ return false;
1127 ++
1128 + return true;
1129 + }
1130 +
1131 +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1132 +index 4355fbc36fce..bb63cc5cbca0 100644
1133 +--- a/drivers/usb/host/xhci-pci.c
1134 ++++ b/drivers/usb/host/xhci-pci.c
1135 +@@ -213,6 +213,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1136 + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
1137 + pdev->device == 0x1142)
1138 + xhci->quirks |= XHCI_TRUST_TX_LENGTH;
1139 ++ if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
1140 ++ pdev->device == 0x2142)
1141 ++ xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
1142 +
1143 + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
1144 + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
1145 +diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
1146 +index 2973d256bb44..bb008ac507fe 100644
1147 +--- a/fs/btrfs/backref.c
1148 ++++ b/fs/btrfs/backref.c
1149 +@@ -1550,6 +1550,7 @@ static int __btrfs_find_all_roots(struct btrfs_trans_handle *trans,
1150 + if (ret < 0 && ret != -ENOENT) {
1151 + ulist_free(tmp);
1152 + ulist_free(*roots);
1153 ++ *roots = NULL;
1154 + return ret;
1155 + }
1156 + node = ulist_next(tmp, &uiter);
1157 +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
1158 +index 70aa22a8a9cc..bace03a546b2 100644
1159 +--- a/fs/btrfs/volumes.c
1160 ++++ b/fs/btrfs/volumes.c
1161 +@@ -6854,6 +6854,14 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
1162 + mutex_lock(&uuid_mutex);
1163 + lock_chunks(root);
1164 +
1165 ++ /*
1166 ++ * It is possible for mount and umount to race in such a way that
1167 ++ * we execute this code path, but open_fs_devices failed to clear
1168 ++ * total_rw_bytes. We certainly want it cleared before reading the
1169 ++ * device items, so clear it here.
1170 ++ */
1171 ++ root->fs_info->fs_devices->total_rw_bytes = 0;
1172 ++
1173 + /*
1174 + * Read all device items, and then all the chunk items. All
1175 + * device items are found before any chunk item (their object id
1176 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
1177 +index acd8e0dccab4..5478902a0100 100644
1178 +--- a/fs/cifs/inode.c
1179 ++++ b/fs/cifs/inode.c
1180 +@@ -1770,7 +1770,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
1181 + FILE_UNIX_BASIC_INFO *info_buf_target;
1182 + unsigned int xid;
1183 + int rc, tmprc;
1184 +- bool new_target = d_really_is_negative(target_dentry);
1185 +
1186 + if (flags & ~RENAME_NOREPLACE)
1187 + return -EINVAL;
1188 +@@ -1847,13 +1846,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
1189 + */
1190 +
1191 + unlink_target:
1192 +- /*
1193 +- * If the target dentry was created during the rename, try
1194 +- * unlinking it if it's not negative
1195 +- */
1196 +- if (new_target &&
1197 +- d_really_is_positive(target_dentry) &&
1198 +- (rc == -EACCES || rc == -EEXIST)) {
1199 ++ /* Try unlinking the target dentry if it's not negative */
1200 ++ if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
1201 + if (d_is_dir(target_dentry))
1202 + tmprc = cifs_rmdir(target_dir, target_dentry);
1203 + else
1204 +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
1205 +index 1affdec23729..de135d2591ff 100644
1206 +--- a/fs/nfs/direct.c
1207 ++++ b/fs/nfs/direct.c
1208 +@@ -379,6 +379,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)
1209 + {
1210 + struct inode *inode = dreq->inode;
1211 +
1212 ++ inode_dio_end(inode);
1213 ++
1214 + if (dreq->iocb) {
1215 + long res = (long) dreq->error;
1216 + if (dreq->count != 0) {
1217 +@@ -390,10 +392,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq)
1218 +
1219 + complete(&dreq->completion);
1220 +
1221 +- igrab(inode);
1222 + nfs_direct_req_release(dreq);
1223 +- inode_dio_end(inode);
1224 +- iput(inode);
1225 + }
1226 +
1227 + static void nfs_direct_readpage_release(struct nfs_page *req)
1228 +@@ -535,10 +534,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
1229 + * generic layer handle the completion.
1230 + */
1231 + if (requested_bytes == 0) {
1232 +- igrab(inode);
1233 +- nfs_direct_req_release(dreq);
1234 + inode_dio_end(inode);
1235 +- iput(inode);
1236 ++ nfs_direct_req_release(dreq);
1237 + return result < 0 ? result : -EIO;
1238 + }
1239 +
1240 +@@ -956,10 +953,8 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
1241 + * generic layer handle the completion.
1242 + */
1243 + if (requested_bytes == 0) {
1244 +- igrab(inode);
1245 +- nfs_direct_req_release(dreq);
1246 + inode_dio_end(inode);
1247 +- iput(inode);
1248 ++ nfs_direct_req_release(dreq);
1249 + return result < 0 ? result : -EIO;
1250 + }
1251 +
1252 +diff --git a/fs/nfs/file.c b/fs/nfs/file.c
1253 +index a89d2f793c1b..1eec947c562d 100644
1254 +--- a/fs/nfs/file.c
1255 ++++ b/fs/nfs/file.c
1256 +@@ -82,7 +82,6 @@ nfs_file_release(struct inode *inode, struct file *filp)
1257 + dprintk("NFS: release(%pD2)\n", filp);
1258 +
1259 + nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
1260 +- inode_dio_wait(inode);
1261 + nfs_file_clear_open_context(filp);
1262 + return 0;
1263 + }
1264 +diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
1265 +index 9ca8809ee3d0..e390a7882933 100644
1266 +--- a/fs/xfs/libxfs/xfs_bmap.c
1267 ++++ b/fs/xfs/libxfs/xfs_bmap.c
1268 +@@ -781,6 +781,8 @@ try_another_ag:
1269 + *logflagsp = 0;
1270 + if ((error = xfs_alloc_vextent(&args))) {
1271 + xfs_iroot_realloc(ip, -1, whichfork);
1272 ++ ASSERT(ifp->if_broot == NULL);
1273 ++ XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
1274 + xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
1275 + return error;
1276 + }
1277 +@@ -801,6 +803,8 @@ try_another_ag:
1278 + }
1279 + if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {
1280 + xfs_iroot_realloc(ip, -1, whichfork);
1281 ++ ASSERT(ifp->if_broot == NULL);
1282 ++ XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
1283 + xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
1284 + return -ENOSPC;
1285 + }
1286 +diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
1287 +index 58df02bd93c9..fa46183b163b 100644
1288 +--- a/include/linux/io-mapping.h
1289 ++++ b/include/linux/io-mapping.h
1290 +@@ -120,9 +120,12 @@ io_mapping_init_wc(struct io_mapping *iomap,
1291 + resource_size_t base,
1292 + unsigned long size)
1293 + {
1294 ++ iomap->iomem = ioremap_wc(base, size);
1295 ++ if (!iomap->iomem)
1296 ++ return NULL;
1297 ++
1298 + iomap->base = base;
1299 + iomap->size = size;
1300 +- iomap->iomem = ioremap_wc(base, size);
1301 + #if defined(pgprot_noncached_wc) /* archs can't agree on a name ... */
1302 + iomap->prot = pgprot_noncached_wc(PAGE_KERNEL);
1303 + #elif defined(pgprot_writecombine)
1304 +diff --git a/include/linux/tcp.h b/include/linux/tcp.h
1305 +index 7f517458c64f..53eb9fecd263 100644
1306 +--- a/include/linux/tcp.h
1307 ++++ b/include/linux/tcp.h
1308 +@@ -218,6 +218,8 @@ struct tcp_sock {
1309 + u8 reord; /* reordering detected */
1310 + } rack;
1311 + u16 advmss; /* Advertised MSS */
1312 ++ u8 tlp_retrans:1, /* TLP is a retransmission */
1313 ++ unused_1:7;
1314 + u8 rate_app_limited:1, /* rate_{delivered,interval_us} limited? */
1315 + is_sack_reneg:1, /* in recovery from loss with SACK reneg? */
1316 + unused:6;
1317 +@@ -234,7 +236,7 @@ struct tcp_sock {
1318 + syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
1319 + save_syn:1, /* Save headers of SYN packet */
1320 + is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
1321 +- u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
1322 ++ u32 tlp_high_seq; /* snd_nxt at the time of TLP */
1323 +
1324 + /* RTT measurement */
1325 + u32 srtt_us; /* smoothed round trip time << 3 in usecs */
1326 +diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
1327 +index 1fcaa174ed32..3f1d008a7c28 100644
1328 +--- a/kernel/events/uprobes.c
1329 ++++ b/kernel/events/uprobes.c
1330 +@@ -1885,7 +1885,7 @@ static void handle_swbp(struct pt_regs *regs)
1331 + if (!uprobe) {
1332 + if (is_swbp > 0) {
1333 + /* No matching uprobe; signal SIGTRAP. */
1334 +- send_sig(SIGTRAP, current, 0);
1335 ++ force_sig(SIGTRAP, current);
1336 + } else {
1337 + /*
1338 + * Either we raced with uprobe_unregister() or we can't
1339 +diff --git a/mm/memcontrol.c b/mm/memcontrol.c
1340 +index 2f7f934bf435..d4232744c59f 100644
1341 +--- a/mm/memcontrol.c
1342 ++++ b/mm/memcontrol.c
1343 +@@ -4794,7 +4794,6 @@ static void __mem_cgroup_clear_mc(void)
1344 + if (!mem_cgroup_is_root(mc.to))
1345 + page_counter_uncharge(&mc.to->memory, mc.moved_swap);
1346 +
1347 +- mem_cgroup_id_get_many(mc.to, mc.moved_swap);
1348 + css_put_many(&mc.to->css, mc.moved_swap);
1349 +
1350 + mc.moved_swap = 0;
1351 +@@ -4972,7 +4971,8 @@ put: /* get_mctgt_type() gets the page */
1352 + ent = target.ent;
1353 + if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) {
1354 + mc.precharge--;
1355 +- /* we fixup refcnts and charges later. */
1356 ++ mem_cgroup_id_get_many(mc.to, 1);
1357 ++ /* we fixup other refcnts and charges later. */
1358 + mc.moved_swap++;
1359 + }
1360 + break;
1361 +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
1362 +index 02be8ee23271..64fede18aa33 100644
1363 +--- a/net/ax25/af_ax25.c
1364 ++++ b/net/ax25/af_ax25.c
1365 +@@ -1191,7 +1191,10 @@ static int __must_check ax25_connect(struct socket *sock,
1366 + if (addr_len > sizeof(struct sockaddr_ax25) &&
1367 + fsa->fsa_ax25.sax25_ndigis != 0) {
1368 + /* Valid number of digipeaters ? */
1369 +- if (fsa->fsa_ax25.sax25_ndigis < 1 || fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS) {
1370 ++ if (fsa->fsa_ax25.sax25_ndigis < 1 ||
1371 ++ fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS ||
1372 ++ addr_len < sizeof(struct sockaddr_ax25) +
1373 ++ sizeof(ax25_address) * fsa->fsa_ax25.sax25_ndigis) {
1374 + err = -EINVAL;
1375 + goto out_release;
1376 + }
1377 +@@ -1510,7 +1513,10 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
1378 + struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)usax;
1379 +
1380 + /* Valid number of digipeaters ? */
1381 +- if (usax->sax25_ndigis < 1 || usax->sax25_ndigis > AX25_MAX_DIGIS) {
1382 ++ if (usax->sax25_ndigis < 1 ||
1383 ++ usax->sax25_ndigis > AX25_MAX_DIGIS ||
1384 ++ addr_len < sizeof(struct sockaddr_ax25) +
1385 ++ sizeof(ax25_address) * usax->sax25_ndigis) {
1386 + err = -EINVAL;
1387 + goto out;
1388 + }
1389 +diff --git a/net/core/dev.c b/net/core/dev.c
1390 +index 267b648a0645..dd8d36feb69f 100644
1391 +--- a/net/core/dev.c
1392 ++++ b/net/core/dev.c
1393 +@@ -4392,7 +4392,7 @@ static void flush_backlog(struct work_struct *work)
1394 + skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) {
1395 + if (skb->dev->reg_state == NETREG_UNREGISTERING) {
1396 + __skb_unlink(skb, &sd->input_pkt_queue);
1397 +- kfree_skb(skb);
1398 ++ dev_kfree_skb_irq(skb);
1399 + input_queue_head_incr(sd);
1400 + }
1401 + }
1402 +diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
1403 +index 3333693d8052..3fb5d8ecc849 100644
1404 +--- a/net/core/net-sysfs.c
1405 ++++ b/net/core/net-sysfs.c
1406 +@@ -1018,7 +1018,7 @@ static ssize_t show_trans_timeout(struct netdev_queue *queue,
1407 + trans_timeout = queue->trans_timeout;
1408 + spin_unlock_irq(&queue->_xmit_lock);
1409 +
1410 +- return sprintf(buf, "%lu", trans_timeout);
1411 ++ return sprintf(buf, fmt_ulong, trans_timeout);
1412 + }
1413 +
1414 + #ifdef CONFIG_XPS
1415 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
1416 +index b3953f789891..23246d8a3eae 100644
1417 +--- a/net/ipv4/tcp_input.c
1418 ++++ b/net/ipv4/tcp_input.c
1419 +@@ -3566,10 +3566,8 @@ static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
1420 + }
1421 + }
1422 +
1423 +-/* This routine deals with acks during a TLP episode.
1424 +- * We mark the end of a TLP episode on receiving TLP dupack or when
1425 +- * ack is after tlp_high_seq.
1426 +- * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe.
1427 ++/* This routine deals with acks during a TLP episode and ends an episode by
1428 ++ * resetting tlp_high_seq. Ref: TLP algorithm in draft-ietf-tcpm-rack
1429 + */
1430 + static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
1431 + {
1432 +@@ -3578,7 +3576,10 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
1433 + if (before(ack, tp->tlp_high_seq))
1434 + return;
1435 +
1436 +- if (flag & FLAG_DSACKING_ACK) {
1437 ++ if (!tp->tlp_retrans) {
1438 ++ /* TLP of new data has been acknowledged */
1439 ++ tp->tlp_high_seq = 0;
1440 ++ } else if (flag & FLAG_DSACKING_ACK) {
1441 + /* This DSACK means original and TLP probe arrived; no loss */
1442 + tp->tlp_high_seq = 0;
1443 + } else if (after(ack, tp->tlp_high_seq)) {
1444 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
1445 +index 84d74c431f83..b730b994b1c7 100644
1446 +--- a/net/ipv4/tcp_output.c
1447 ++++ b/net/ipv4/tcp_output.c
1448 +@@ -2357,6 +2357,11 @@ void tcp_send_loss_probe(struct sock *sk)
1449 + int pcount;
1450 + int mss = tcp_current_mss(sk);
1451 +
1452 ++ /* At most one outstanding TLP */
1453 ++ if (tp->tlp_high_seq)
1454 ++ goto rearm_timer;
1455 ++
1456 ++ tp->tlp_retrans = 0;
1457 + skb = tcp_send_head(sk);
1458 + if (skb) {
1459 + if (tcp_snd_wnd_test(tp, skb, mss)) {
1460 +@@ -2379,10 +2384,6 @@ void tcp_send_loss_probe(struct sock *sk)
1461 + return;
1462 + }
1463 +
1464 +- /* At most one outstanding TLP retransmission. */
1465 +- if (tp->tlp_high_seq)
1466 +- goto rearm_timer;
1467 +-
1468 + if (skb_still_in_host_queue(sk, skb))
1469 + goto rearm_timer;
1470 +
1471 +@@ -2403,10 +2404,12 @@ void tcp_send_loss_probe(struct sock *sk)
1472 + if (__tcp_retransmit_skb(sk, skb, 1))
1473 + goto rearm_timer;
1474 +
1475 ++ tp->tlp_retrans = 1;
1476 ++
1477 ++probe_sent:
1478 + /* Record snd_nxt for loss detection. */
1479 + tp->tlp_high_seq = tp->snd_nxt;
1480 +
1481 +-probe_sent:
1482 + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);
1483 + /* Reset s.t. tcp_rearm_rto will restart timer from now */
1484 + inet_csk(sk)->icsk_pending = 0;
1485 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
1486 +index 1bb1e27d3d13..18a1a4890c5f 100644
1487 +--- a/net/ipv4/udp.c
1488 ++++ b/net/ipv4/udp.c
1489 +@@ -1554,7 +1554,7 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1490 + /*
1491 + * UDP-Lite specific tests, ignored on UDP sockets
1492 + */
1493 +- if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
1494 ++ if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
1495 +
1496 + /*
1497 + * MIB statistics other than incrementing the error count are
1498 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
1499 +index ca001ecb7197..e0a2a3d6772d 100644
1500 +--- a/net/ipv6/ip6_gre.c
1501 ++++ b/net/ipv6/ip6_gre.c
1502 +@@ -1130,15 +1130,16 @@ static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head)
1503 + static int __net_init ip6gre_init_net(struct net *net)
1504 + {
1505 + struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);
1506 ++ struct net_device *ndev;
1507 + int err;
1508 +
1509 +- ign->fb_tunnel_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0",
1510 +- NET_NAME_UNKNOWN,
1511 +- ip6gre_tunnel_setup);
1512 +- if (!ign->fb_tunnel_dev) {
1513 ++ ndev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0",
1514 ++ NET_NAME_UNKNOWN, ip6gre_tunnel_setup);
1515 ++ if (!ndev) {
1516 + err = -ENOMEM;
1517 + goto err_alloc_dev;
1518 + }
1519 ++ ign->fb_tunnel_dev = ndev;
1520 + dev_net_set(ign->fb_tunnel_dev, net);
1521 + /* FB netdevice is special: we have one, and only one per netns.
1522 + * Allowing to move it to another netns is clearly unsafe.
1523 +@@ -1158,7 +1159,7 @@ static int __net_init ip6gre_init_net(struct net *net)
1524 + return 0;
1525 +
1526 + err_reg_dev:
1527 +- ip6gre_dev_free(ign->fb_tunnel_dev);
1528 ++ ip6gre_dev_free(ndev);
1529 + err_alloc_dev:
1530 + return err;
1531 + }
1532 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
1533 +index 6a397e110b46..1ad84e18c03b 100644
1534 +--- a/net/ipv6/udp.c
1535 ++++ b/net/ipv6/udp.c
1536 +@@ -601,7 +601,7 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1537 + /*
1538 + * UDP-Lite specific tests, ignored on UDP sockets (see net/ipv4/udp.c).
1539 + */
1540 +- if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
1541 ++ if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
1542 +
1543 + if (up->pcrlen == 0) { /* full coverage was set */
1544 + net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n",
1545 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
1546 +index d3334fd84ca2..9be82ed02e0e 100644
1547 +--- a/net/mac80211/rx.c
1548 ++++ b/net/mac80211/rx.c
1549 +@@ -2098,6 +2098,7 @@ static int ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
1550 +
1551 + static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
1552 + {
1553 ++ struct ieee80211_hdr *hdr = (void *)rx->skb->data;
1554 + struct sk_buff *skb = rx->skb;
1555 + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
1556 +
1557 +@@ -2108,6 +2109,31 @@ static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
1558 + if (status->flag & RX_FLAG_DECRYPTED)
1559 + return 0;
1560 +
1561 ++ /* check mesh EAPOL frames first */
1562 ++ if (unlikely(rx->sta && ieee80211_vif_is_mesh(&rx->sdata->vif) &&
1563 ++ ieee80211_is_data(fc))) {
1564 ++ struct ieee80211s_hdr *mesh_hdr;
1565 ++ u16 hdr_len = ieee80211_hdrlen(fc);
1566 ++ u16 ethertype_offset;
1567 ++ __be16 ethertype;
1568 ++
1569 ++ if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr))
1570 ++ goto drop_check;
1571 ++
1572 ++ /* make sure fixed part of mesh header is there, also checks skb len */
1573 ++ if (!pskb_may_pull(rx->skb, hdr_len + 6))
1574 ++ goto drop_check;
1575 ++
1576 ++ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len);
1577 ++ ethertype_offset = hdr_len + ieee80211_get_mesh_hdrlen(mesh_hdr) +
1578 ++ sizeof(rfc1042_header);
1579 ++
1580 ++ if (skb_copy_bits(rx->skb, ethertype_offset, &ethertype, 2) == 0 &&
1581 ++ ethertype == rx->sdata->control_port_protocol)
1582 ++ return 0;
1583 ++ }
1584 ++
1585 ++drop_check:
1586 + /* Drop unencrypted frames if key is set. */
1587 + if (unlikely(!ieee80211_has_protected(fc) &&
1588 + !ieee80211_is_any_nullfunc(fc) &&
1589 +diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
1590 +index 72de69175476..702ebcfa18dc 100644
1591 +--- a/net/rxrpc/recvmsg.c
1592 ++++ b/net/rxrpc/recvmsg.c
1593 +@@ -439,7 +439,7 @@ try_again:
1594 + list_empty(&rx->recvmsg_q) &&
1595 + rx->sk.sk_state != RXRPC_SERVER_LISTENING) {
1596 + release_sock(&rx->sk);
1597 +- return -ENODATA;
1598 ++ return -EAGAIN;
1599 + }
1600 +
1601 + if (list_empty(&rx->recvmsg_q)) {
1602 +diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
1603 +index 1de27c39564b..2ec1c29eeba4 100644
1604 +--- a/net/rxrpc/sendmsg.c
1605 ++++ b/net/rxrpc/sendmsg.c
1606 +@@ -191,7 +191,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
1607 + /* this should be in poll */
1608 + sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
1609 +
1610 +- if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
1611 ++ if (sk->sk_shutdown & SEND_SHUTDOWN)
1612 + return -EPIPE;
1613 +
1614 + more = msg->msg_flags & MSG_MORE;
1615 +diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
1616 +index 98cf6343afcd..61564e56e3aa 100755
1617 +--- a/scripts/decode_stacktrace.sh
1618 ++++ b/scripts/decode_stacktrace.sh
1619 +@@ -76,8 +76,8 @@ parse_symbol() {
1620 + return
1621 + fi
1622 +
1623 +- # Strip out the base of the path
1624 +- code=${code#$basepath/}
1625 ++ # Strip out the base of the path on each line
1626 ++ code=$(while read -r line; do echo "${line#$basepath/}"; done <<< "$code")
1627 +
1628 + # In the case of inlines, move everything to same line
1629 + code=${code//$'\n'/' '}
1630 +diff --git a/sound/core/info.c b/sound/core/info.c
1631 +index 358a6947342d..8a6fa8fd0aab 100644
1632 +--- a/sound/core/info.c
1633 ++++ b/sound/core/info.c
1634 +@@ -634,7 +634,9 @@ int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len)
1635 + {
1636 + int c = -1;
1637 +
1638 +- if (snd_BUG_ON(!buffer || !buffer->buffer))
1639 ++ if (snd_BUG_ON(!buffer))
1640 ++ return 1;
1641 ++ if (!buffer->buffer)
1642 + return 1;
1643 + if (len <= 0 || buffer->stop || buffer->error)
1644 + return 1;
1645 +diff --git a/sound/soc/codecs/rt5670.h b/sound/soc/codecs/rt5670.h
1646 +index 3f1b0f1df809..e4e31e82311d 100644
1647 +--- a/sound/soc/codecs/rt5670.h
1648 ++++ b/sound/soc/codecs/rt5670.h
1649 +@@ -760,7 +760,7 @@
1650 + #define RT5670_PWR_VREF2_BIT 4
1651 + #define RT5670_PWR_FV2 (0x1 << 3)
1652 + #define RT5670_PWR_FV2_BIT 3
1653 +-#define RT5670_LDO_SEL_MASK (0x3)
1654 ++#define RT5670_LDO_SEL_MASK (0x7)
1655 + #define RT5670_LDO_SEL_SFT 0
1656 +
1657 + /* Power Management for Analog 2 (0x64) */
1658 +diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
1659 +index 7228d141a789..676568286eef 100644
1660 +--- a/tools/perf/builtin-script.c
1661 ++++ b/tools/perf/builtin-script.c
1662 +@@ -1516,7 +1516,7 @@ static int is_directory(const char *base_path, const struct dirent *dent)
1663 + char path[PATH_MAX];
1664 + struct stat st;
1665 +
1666 +- sprintf(path, "%s/%s", base_path, dent->d_name);
1667 ++ scnprintf(path, PATH_MAX, "%s/%s", base_path, dent->d_name);
1668 + if (stat(path, &st))
1669 + return 0;
1670 +
1671 +@@ -1702,8 +1702,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused,
1672 + }
1673 +
1674 + for_each_lang(scripts_path, scripts_dir, lang_dirent) {
1675 +- snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
1676 +- lang_dirent->d_name);
1677 ++ scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
1678 ++ lang_dirent->d_name);
1679 + lang_dir = opendir(lang_path);
1680 + if (!lang_dir)
1681 + continue;
1682 +@@ -1712,8 +1712,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused,
1683 + script_root = get_script_root(script_dirent, REPORT_SUFFIX);
1684 + if (script_root) {
1685 + desc = script_desc__findnew(script_root);
1686 +- snprintf(script_path, MAXPATHLEN, "%s/%s",
1687 +- lang_path, script_dirent->d_name);
1688 ++ scnprintf(script_path, MAXPATHLEN, "%s/%s",
1689 ++ lang_path, script_dirent->d_name);
1690 + read_script_info(desc, script_path);
1691 + free(script_root);
1692 + }
1693 +@@ -1749,7 +1749,7 @@ static int check_ev_match(char *dir_name, char *scriptname,
1694 + int match, len;
1695 + FILE *fp;
1696 +
1697 +- sprintf(filename, "%s/bin/%s-record", dir_name, scriptname);
1698 ++ scnprintf(filename, MAXPATHLEN, "%s/bin/%s-record", dir_name, scriptname);
1699 +
1700 + fp = fopen(filename, "r");
1701 + if (!fp)
1702 +@@ -1825,8 +1825,8 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
1703 + }
1704 +
1705 + for_each_lang(scripts_path, scripts_dir, lang_dirent) {
1706 +- snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
1707 +- lang_dirent->d_name);
1708 ++ scnprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
1709 ++ lang_dirent->d_name);
1710 + #ifdef NO_LIBPERL
1711 + if (strstr(lang_path, "perl"))
1712 + continue;
1713 +@@ -1881,8 +1881,8 @@ static char *get_script_path(const char *script_root, const char *suffix)
1714 + return NULL;
1715 +
1716 + for_each_lang(scripts_path, scripts_dir, lang_dirent) {
1717 +- snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
1718 +- lang_dirent->d_name);
1719 ++ scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
1720 ++ lang_dirent->d_name);
1721 + lang_dir = opendir(lang_path);
1722 + if (!lang_dir)
1723 + continue;
1724 +@@ -1893,8 +1893,8 @@ static char *get_script_path(const char *script_root, const char *suffix)
1725 + free(__script_root);
1726 + closedir(lang_dir);
1727 + closedir(scripts_dir);
1728 +- snprintf(script_path, MAXPATHLEN, "%s/%s",
1729 +- lang_path, script_dirent->d_name);
1730 ++ scnprintf(script_path, MAXPATHLEN, "%s/%s",
1731 ++ lang_path, script_dirent->d_name);
1732 + return strdup(script_path);
1733 + }
1734 + free(__script_root);
1735 +diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
1736 +index b60a6fd66517..a607d2a851ef 100644
1737 +--- a/tools/perf/tests/attr.c
1738 ++++ b/tools/perf/tests/attr.c
1739 +@@ -147,8 +147,8 @@ static int run_dir(const char *d, const char *perf)
1740 + if (verbose)
1741 + vcnt++;
1742 +
1743 +- snprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s",
1744 +- d, d, perf, vcnt, v);
1745 ++ scnprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s",
1746 ++ d, d, perf, vcnt, v);
1747 +
1748 + return system(cmd) ? TEST_FAIL : TEST_OK;
1749 + }
1750 +diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c
1751 +index 1e2ba2602930..1802ad3f45b6 100644
1752 +--- a/tools/perf/tests/pmu.c
1753 ++++ b/tools/perf/tests/pmu.c
1754 +@@ -95,7 +95,7 @@ static char *test_format_dir_get(void)
1755 + struct test_format *format = &test_formats[i];
1756 + FILE *file;
1757 +
1758 +- snprintf(name, PATH_MAX, "%s/%s", dir, format->name);
1759 ++ scnprintf(name, PATH_MAX, "%s/%s", dir, format->name);
1760 +
1761 + file = fopen(name, "w");
1762 + if (!file)
1763 +diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
1764 +index 3336cbc6ec48..1d4807c46efd 100644
1765 +--- a/tools/perf/util/annotate.c
1766 ++++ b/tools/perf/util/annotate.c
1767 +@@ -1302,7 +1302,7 @@ fallback:
1768 + int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
1769 + {
1770 + struct dso *dso = map->dso;
1771 +- char command[PATH_MAX * 2];
1772 ++ char *command;
1773 + FILE *file;
1774 + char symfs_filename[PATH_MAX];
1775 + struct kcore_extract kce;
1776 +@@ -1364,7 +1364,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
1777 + strcpy(symfs_filename, tmp);
1778 + }
1779 +
1780 +- snprintf(command, sizeof(command),
1781 ++ err = asprintf(&command,
1782 + "%s %s%s --start-address=0x%016" PRIx64
1783 + " --stop-address=0x%016" PRIx64
1784 + " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
1785 +@@ -1377,12 +1377,17 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
1786 + symbol_conf.annotate_src ? "-S" : "",
1787 + symfs_filename, symfs_filename);
1788 +
1789 ++ if (err < 0) {
1790 ++ pr_err("Failure allocating memory for the command to run\n");
1791 ++ goto out_remove_tmp;
1792 ++ }
1793 ++
1794 + pr_debug("Executing: %s\n", command);
1795 +
1796 + err = -1;
1797 + if (pipe(stdout_fd) < 0) {
1798 + pr_err("Failure creating the pipe to run %s\n", command);
1799 +- goto out_remove_tmp;
1800 ++ goto out_free_command;
1801 + }
1802 +
1803 + pid = fork();
1804 +@@ -1409,7 +1414,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
1805 + * If we were using debug info should retry with
1806 + * original binary.
1807 + */
1808 +- goto out_remove_tmp;
1809 ++ goto out_free_command;
1810 + }
1811 +
1812 + nline = 0;
1813 +@@ -1432,6 +1437,8 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
1814 +
1815 + fclose(file);
1816 + err = 0;
1817 ++out_free_command:
1818 ++ free(command);
1819 + out_remove_tmp:
1820 + close(stdout_fd[0]);
1821 +
1822 +@@ -1445,7 +1452,7 @@ out:
1823 +
1824 + out_close_stdout:
1825 + close(stdout_fd[1]);
1826 +- goto out_remove_tmp;
1827 ++ goto out_free_command;
1828 + }
1829 +
1830 + static void insert_source_line(struct rb_root *root, struct source_line *src_line)
1831 +diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c
1832 +index 8fdee24725a7..5bc2b92ace6d 100644
1833 +--- a/tools/perf/util/cgroup.c
1834 ++++ b/tools/perf/util/cgroup.c
1835 +@@ -64,7 +64,7 @@ static int open_cgroup(char *name)
1836 + if (cgroupfs_find_mountpoint(mnt, PATH_MAX + 1))
1837 + return -1;
1838 +
1839 +- snprintf(path, PATH_MAX, "%s/%s", mnt, name);
1840 ++ scnprintf(path, PATH_MAX, "%s/%s", mnt, name);
1841 +
1842 + fd = open(path, O_RDONLY);
1843 + if (fd == -1)
1844 +diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
1845 +index 6193be6d7639..f9f7e35f47a7 100644
1846 +--- a/tools/perf/util/parse-events.c
1847 ++++ b/tools/perf/util/parse-events.c
1848 +@@ -195,8 +195,8 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
1849 +
1850 + for_each_event(sys_dirent, evt_dir, evt_dirent) {
1851 +
1852 +- snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path,
1853 +- evt_dirent->d_name);
1854 ++ scnprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path,
1855 ++ evt_dirent->d_name);
1856 + fd = open(evt_path, O_RDONLY);
1857 + if (fd < 0)
1858 + continue;
1859 +diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
1860 +index c86c1d5ea65c..39abbf827646 100644
1861 +--- a/tools/perf/util/pmu.c
1862 ++++ b/tools/perf/util/pmu.c
1863 +@@ -325,7 +325,7 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
1864 + if (pmu_alias_info_file(name))
1865 + continue;
1866 +
1867 +- snprintf(path, PATH_MAX, "%s/%s", dir, name);
1868 ++ scnprintf(path, PATH_MAX, "%s/%s", dir, name);
1869 +
1870 + file = fopen(path, "r");
1871 + if (!file) {
1872 +diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
1873 +index a7452fd3b6ee..0551a02ee17c 100644
1874 +--- a/tools/perf/util/probe-event.c
1875 ++++ b/tools/perf/util/probe-event.c
1876 +@@ -118,7 +118,7 @@ static struct symbol *__find_kernel_function(u64 addr, struct map **mapp)
1877 + return machine__find_kernel_function(host_machine, addr, mapp);
1878 + }
1879 +
1880 +-static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void)
1881 ++static struct ref_reloc_sym *kernel_get_ref_reloc_sym(struct map **pmap)
1882 + {
1883 + /* kmap->ref_reloc_sym should be set if host_machine is initialized */
1884 + struct kmap *kmap;
1885 +@@ -130,6 +130,10 @@ static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void)
1886 + kmap = map__kmap(map);
1887 + if (!kmap)
1888 + return NULL;
1889 ++
1890 ++ if (pmap)
1891 ++ *pmap = map;
1892 ++
1893 + return kmap->ref_reloc_sym;
1894 + }
1895 +
1896 +@@ -141,7 +145,7 @@ static int kernel_get_symbol_address_by_name(const char *name, u64 *addr,
1897 + struct map *map;
1898 +
1899 + /* ref_reloc_sym is just a label. Need a special fix*/
1900 +- reloc_sym = kernel_get_ref_reloc_sym();
1901 ++ reloc_sym = kernel_get_ref_reloc_sym(NULL);
1902 + if (reloc_sym && strcmp(name, reloc_sym->name) == 0)
1903 + *addr = (reloc) ? reloc_sym->addr : reloc_sym->unrelocated_addr;
1904 + else {
1905 +@@ -742,6 +746,7 @@ post_process_kernel_probe_trace_events(struct probe_trace_event *tevs,
1906 + int ntevs)
1907 + {
1908 + struct ref_reloc_sym *reloc_sym;
1909 ++ struct map *map;
1910 + char *tmp;
1911 + int i, skipped = 0;
1912 +
1913 +@@ -750,7 +755,7 @@ post_process_kernel_probe_trace_events(struct probe_trace_event *tevs,
1914 + return post_process_offline_probe_trace_events(tevs, ntevs,
1915 + symbol_conf.vmlinux_name);
1916 +
1917 +- reloc_sym = kernel_get_ref_reloc_sym();
1918 ++ reloc_sym = kernel_get_ref_reloc_sym(&map);
1919 + if (!reloc_sym) {
1920 + pr_warning("Relocated base symbol is not found!\n");
1921 + return -EINVAL;
1922 +@@ -759,9 +764,13 @@ post_process_kernel_probe_trace_events(struct probe_trace_event *tevs,
1923 + for (i = 0; i < ntevs; i++) {
1924 + if (!tevs[i].point.address || tevs[i].point.retprobe)
1925 + continue;
1926 +- /* If we found a wrong one, mark it by NULL symbol */
1927 ++ /*
1928 ++ * If we found a wrong one, mark it by NULL symbol.
1929 ++ * Since addresses in debuginfo is same as objdump, we need
1930 ++ * to convert it to addresses on memory.
1931 ++ */
1932 + if (kprobe_warn_out_range(tevs[i].point.symbol,
1933 +- tevs[i].point.address)) {
1934 ++ map__objdump_2mem(map, tevs[i].point.address))) {
1935 + tmp = NULL;
1936 + skipped++;
1937 + } else {
1938 +@@ -2850,7 +2859,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
1939 +
1940 + /* Note that the symbols in the kmodule are not relocated */
1941 + if (!pev->uprobes && !pp->retprobe && !pev->target) {
1942 +- reloc_sym = kernel_get_ref_reloc_sym();
1943 ++ reloc_sym = kernel_get_ref_reloc_sym(NULL);
1944 + if (!reloc_sym) {
1945 + pr_warning("Relocated base symbol is not found!\n");
1946 + ret = -EINVAL;
1947 +diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
1948 +index b4db3f48e3b0..2853d4728ab9 100644
1949 +--- a/tools/perf/util/srcline.c
1950 ++++ b/tools/perf/util/srcline.c
1951 +@@ -86,16 +86,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
1952 + bfd_vma pc, vma;
1953 + bfd_size_type size;
1954 + struct a2l_data *a2l = data;
1955 ++ flagword flags;
1956 +
1957 + if (a2l->found)
1958 + return;
1959 +
1960 +- if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
1961 ++#ifdef bfd_get_section_flags
1962 ++ flags = bfd_get_section_flags(abfd, section);
1963 ++#else
1964 ++ flags = bfd_section_flags(section);
1965 ++#endif
1966 ++ if ((flags & SEC_ALLOC) == 0)
1967 + return;
1968 +
1969 + pc = a2l->addr;
1970 ++#ifdef bfd_get_section_vma
1971 + vma = bfd_get_section_vma(abfd, section);
1972 ++#else
1973 ++ vma = bfd_section_vma(section);
1974 ++#endif
1975 ++#ifdef bfd_get_section_size
1976 + size = bfd_get_section_size(section);
1977 ++#else
1978 ++ size = bfd_section_size(section);
1979 ++#endif
1980 +
1981 + if (pc < vma || pc >= vma + size)
1982 + return;