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: Wed, 26 Aug 2020 11:13:51
Message-Id: 1598440412.052bcc95045cdf9da9d03933af84f5396d54c122.mpagano@gentoo
1 commit: 052bcc95045cdf9da9d03933af84f5396d54c122
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 26 11:13:32 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 26 11:13:32 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=052bcc95
7
8 Linux patch 4.9.234
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1233_linux-4.9.234.patch | 1252 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1256 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 3bd6ed4..595b0b0 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -975,6 +975,10 @@ Patch: 1232_linux-4.9.233.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.233
23
24 +Patch: 1233_linux-4.9.234.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.234
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/1233_linux-4.9.234.patch b/1233_linux-4.9.234.patch
33 new file mode 100644
34 index 0000000..07fd372
35 --- /dev/null
36 +++ b/1233_linux-4.9.234.patch
37 @@ -0,0 +1,1252 @@
38 +diff --git a/Makefile b/Makefile
39 +index af68e8c3fb962..e5a6f33e95de6 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 233
46 ++SUBLEVEL = 234
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
51 +index ff4049155c840..355aec0867f4d 100644
52 +--- a/arch/alpha/include/asm/io.h
53 ++++ b/arch/alpha/include/asm/io.h
54 +@@ -491,10 +491,10 @@ extern inline void writeq(u64 b, volatile void __iomem *addr)
55 + }
56 + #endif
57 +
58 +-#define ioread16be(p) be16_to_cpu(ioread16(p))
59 +-#define ioread32be(p) be32_to_cpu(ioread32(p))
60 +-#define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
61 +-#define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
62 ++#define ioread16be(p) swab16(ioread16(p))
63 ++#define ioread32be(p) swab32(ioread32(p))
64 ++#define iowrite16be(v,p) iowrite16(swab16(v), (p))
65 ++#define iowrite32be(v,p) iowrite32(swab32(v), (p))
66 +
67 + #define inb_p inb
68 + #define inw_p inw
69 +diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
70 +index bb0d5e21d60bd..b5ce1e81f945a 100644
71 +--- a/arch/arm/kvm/mmu.c
72 ++++ b/arch/arm/kvm/mmu.c
73 +@@ -298,12 +298,6 @@ static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
74 + next = stage2_pgd_addr_end(addr, end);
75 + if (!stage2_pgd_none(*pgd))
76 + unmap_stage2_puds(kvm, pgd, addr, next);
77 +- /*
78 +- * If the range is too large, release the kvm->mmu_lock
79 +- * to prevent starvation and lockup detector warnings.
80 +- */
81 +- if (next != end)
82 +- cond_resched_lock(&kvm->mmu_lock);
83 + } while (pgd++, addr = next, addr != end);
84 + }
85 +
86 +diff --git a/arch/m68k/include/asm/m53xxacr.h b/arch/m68k/include/asm/m53xxacr.h
87 +index 3177ce8331d69..baee0c77b9818 100644
88 +--- a/arch/m68k/include/asm/m53xxacr.h
89 ++++ b/arch/m68k/include/asm/m53xxacr.h
90 +@@ -88,9 +88,9 @@
91 + * coherency though in all cases. And for copyback caches we will need
92 + * to push cached data as well.
93 + */
94 +-#define CACHE_INIT CACR_CINVA
95 +-#define CACHE_INVALIDATE CACR_CINVA
96 +-#define CACHE_INVALIDATED CACR_CINVA
97 ++#define CACHE_INIT (CACHE_MODE + CACR_CINVA - CACR_EC)
98 ++#define CACHE_INVALIDATE (CACHE_MODE + CACR_CINVA)
99 ++#define CACHE_INVALIDATED (CACHE_MODE + CACR_CINVA)
100 +
101 + #define ACR0_MODE ((CONFIG_RAMBASE & 0xff000000) + \
102 + (0x000f0000) + \
103 +diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
104 +index 2791f568bdb25..3e4fb430ae457 100644
105 +--- a/arch/powerpc/mm/fault.c
106 ++++ b/arch/powerpc/mm/fault.c
107 +@@ -192,6 +192,9 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
108 + return MM_FAULT_CONTINUE;
109 + }
110 +
111 ++// This comes from 64-bit struct rt_sigframe + __SIGNAL_FRAMESIZE
112 ++#define SIGFRAME_MAX_SIZE (4096 + 128)
113 ++
114 + /*
115 + * For 600- and 800-family processors, the error_code parameter is DSISR
116 + * for a data fault, SRR1 for an instruction fault. For 400-family processors
117 +@@ -341,7 +344,7 @@ retry:
118 + /*
119 + * N.B. The POWER/Open ABI allows programs to access up to
120 + * 288 bytes below the stack pointer.
121 +- * The kernel signal delivery code writes up to about 1.5kB
122 ++ * The kernel signal delivery code writes up to about 4kB
123 + * below the stack pointer (r1) before decrementing it.
124 + * The exec code can write slightly over 640kB to the stack
125 + * before setting the user r1. Thus we allow the stack to
126 +@@ -365,7 +368,7 @@ retry:
127 + * between the last mapped region and the stack will
128 + * expand the stack rather than segfaulting.
129 + */
130 +- if (address + 2048 < uregs->gpr[1] && !store_update_sp)
131 ++ if (address + SIGFRAME_MAX_SIZE < uregs->gpr[1] && !store_update_sp)
132 + goto bad_area;
133 + }
134 + if (expand_stack(vma, address))
135 +diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
136 +index 0af19aa1df57d..3d6b372fab3f6 100644
137 +--- a/arch/powerpc/platforms/pseries/ras.c
138 ++++ b/arch/powerpc/platforms/pseries/ras.c
139 +@@ -101,7 +101,6 @@ static void handle_system_shutdown(char event_modifier)
140 + case EPOW_SHUTDOWN_ON_UPS:
141 + pr_emerg("Loss of system power detected. System is running on"
142 + " UPS/battery. Check RTAS error log for details\n");
143 +- orderly_poweroff(true);
144 + break;
145 +
146 + case EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS:
147 +diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h
148 +index 5b0579abb3982..3ac991d81e74d 100644
149 +--- a/arch/x86/include/asm/archrandom.h
150 ++++ b/arch/x86/include/asm/archrandom.h
151 +@@ -45,7 +45,7 @@ static inline bool rdrand_long(unsigned long *v)
152 + bool ok;
153 + unsigned int retry = RDRAND_RETRY_LOOPS;
154 + do {
155 +- asm volatile(RDRAND_LONG "\n\t"
156 ++ asm volatile(RDRAND_LONG
157 + CC_SET(c)
158 + : CC_OUT(c) (ok), "=a" (*v));
159 + if (ok)
160 +@@ -59,7 +59,7 @@ static inline bool rdrand_int(unsigned int *v)
161 + bool ok;
162 + unsigned int retry = RDRAND_RETRY_LOOPS;
163 + do {
164 +- asm volatile(RDRAND_INT "\n\t"
165 ++ asm volatile(RDRAND_INT
166 + CC_SET(c)
167 + : CC_OUT(c) (ok), "=a" (*v));
168 + if (ok)
169 +@@ -71,7 +71,7 @@ static inline bool rdrand_int(unsigned int *v)
170 + static inline bool rdseed_long(unsigned long *v)
171 + {
172 + bool ok;
173 +- asm volatile(RDSEED_LONG "\n\t"
174 ++ asm volatile(RDSEED_LONG
175 + CC_SET(c)
176 + : CC_OUT(c) (ok), "=a" (*v));
177 + return ok;
178 +@@ -80,7 +80,7 @@ static inline bool rdseed_long(unsigned long *v)
179 + static inline bool rdseed_int(unsigned int *v)
180 + {
181 + bool ok;
182 +- asm volatile(RDSEED_INT "\n\t"
183 ++ asm volatile(RDSEED_INT
184 + CC_SET(c)
185 + : CC_OUT(c) (ok), "=a" (*v));
186 + return ok;
187 +diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
188 +index 68557f52b9619..fb402d4c45082 100644
189 +--- a/arch/x86/include/asm/bitops.h
190 ++++ b/arch/x86/include/asm/bitops.h
191 +@@ -77,7 +77,7 @@ set_bit(long nr, volatile unsigned long *addr)
192 + : "iq" ((u8)CONST_MASK(nr))
193 + : "memory");
194 + } else {
195 +- asm volatile(LOCK_PREFIX "bts %1,%0"
196 ++ asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
197 + : BITOP_ADDR(addr) : "Ir" (nr) : "memory");
198 + }
199 + }
200 +@@ -93,7 +93,7 @@ set_bit(long nr, volatile unsigned long *addr)
201 + */
202 + static __always_inline void __set_bit(long nr, volatile unsigned long *addr)
203 + {
204 +- asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
205 ++ asm volatile(__ASM_SIZE(bts) " %1,%0" : ADDR : "Ir" (nr) : "memory");
206 + }
207 +
208 + /**
209 +@@ -114,7 +114,7 @@ clear_bit(long nr, volatile unsigned long *addr)
210 + : CONST_MASK_ADDR(nr, addr)
211 + : "iq" ((u8)~CONST_MASK(nr)));
212 + } else {
213 +- asm volatile(LOCK_PREFIX "btr %1,%0"
214 ++ asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
215 + : BITOP_ADDR(addr)
216 + : "Ir" (nr));
217 + }
218 +@@ -136,7 +136,7 @@ static __always_inline void clear_bit_unlock(long nr, volatile unsigned long *ad
219 +
220 + static __always_inline void __clear_bit(long nr, volatile unsigned long *addr)
221 + {
222 +- asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
223 ++ asm volatile(__ASM_SIZE(btr) " %1,%0" : ADDR : "Ir" (nr));
224 + }
225 +
226 + /*
227 +@@ -168,7 +168,7 @@ static __always_inline void __clear_bit_unlock(long nr, volatile unsigned long *
228 + */
229 + static __always_inline void __change_bit(long nr, volatile unsigned long *addr)
230 + {
231 +- asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
232 ++ asm volatile(__ASM_SIZE(btc) " %1,%0" : ADDR : "Ir" (nr));
233 + }
234 +
235 + /**
236 +@@ -187,7 +187,7 @@ static __always_inline void change_bit(long nr, volatile unsigned long *addr)
237 + : CONST_MASK_ADDR(nr, addr)
238 + : "iq" ((u8)CONST_MASK(nr)));
239 + } else {
240 +- asm volatile(LOCK_PREFIX "btc %1,%0"
241 ++ asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
242 + : BITOP_ADDR(addr)
243 + : "Ir" (nr));
244 + }
245 +@@ -203,7 +203,8 @@ static __always_inline void change_bit(long nr, volatile unsigned long *addr)
246 + */
247 + static __always_inline bool test_and_set_bit(long nr, volatile unsigned long *addr)
248 + {
249 +- GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, "Ir", nr, "%0", c);
250 ++ GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(bts),
251 ++ *addr, "Ir", nr, "%0", c);
252 + }
253 +
254 + /**
255 +@@ -232,7 +233,7 @@ static __always_inline bool __test_and_set_bit(long nr, volatile unsigned long *
256 + {
257 + bool oldbit;
258 +
259 +- asm("bts %2,%1\n\t"
260 ++ asm(__ASM_SIZE(bts) " %2,%1"
261 + CC_SET(c)
262 + : CC_OUT(c) (oldbit), ADDR
263 + : "Ir" (nr));
264 +@@ -249,7 +250,8 @@ static __always_inline bool __test_and_set_bit(long nr, volatile unsigned long *
265 + */
266 + static __always_inline bool test_and_clear_bit(long nr, volatile unsigned long *addr)
267 + {
268 +- GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, "Ir", nr, "%0", c);
269 ++ GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(btr),
270 ++ *addr, "Ir", nr, "%0", c);
271 + }
272 +
273 + /**
274 +@@ -272,7 +274,7 @@ static __always_inline bool __test_and_clear_bit(long nr, volatile unsigned long
275 + {
276 + bool oldbit;
277 +
278 +- asm volatile("btr %2,%1\n\t"
279 ++ asm volatile(__ASM_SIZE(btr) " %2,%1"
280 + CC_SET(c)
281 + : CC_OUT(c) (oldbit), ADDR
282 + : "Ir" (nr));
283 +@@ -284,7 +286,7 @@ static __always_inline bool __test_and_change_bit(long nr, volatile unsigned lon
284 + {
285 + bool oldbit;
286 +
287 +- asm volatile("btc %2,%1\n\t"
288 ++ asm volatile(__ASM_SIZE(btc) " %2,%1"
289 + CC_SET(c)
290 + : CC_OUT(c) (oldbit), ADDR
291 + : "Ir" (nr) : "memory");
292 +@@ -302,7 +304,8 @@ static __always_inline bool __test_and_change_bit(long nr, volatile unsigned lon
293 + */
294 + static __always_inline bool test_and_change_bit(long nr, volatile unsigned long *addr)
295 + {
296 +- GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, "Ir", nr, "%0", c);
297 ++ GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(btc),
298 ++ *addr, "Ir", nr, "%0", c);
299 + }
300 +
301 + static __always_inline bool constant_test_bit(long nr, const volatile unsigned long *addr)
302 +@@ -315,7 +318,7 @@ static __always_inline bool variable_test_bit(long nr, volatile const unsigned l
303 + {
304 + bool oldbit;
305 +
306 +- asm volatile("bt %2,%1\n\t"
307 ++ asm volatile(__ASM_SIZE(bt) " %2,%1"
308 + CC_SET(c)
309 + : CC_OUT(c) (oldbit)
310 + : "m" (*(unsigned long *)addr), "Ir" (nr));
311 +diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
312 +index 2cb5d0f13641a..f7745ef149c08 100644
313 +--- a/arch/x86/include/asm/percpu.h
314 ++++ b/arch/x86/include/asm/percpu.h
315 +@@ -536,7 +536,7 @@ static inline bool x86_this_cpu_variable_test_bit(int nr,
316 + {
317 + bool oldbit;
318 +
319 +- asm volatile("bt "__percpu_arg(2)",%1\n\t"
320 ++ asm volatile("btl "__percpu_arg(2)",%1"
321 + CC_SET(c)
322 + : CC_OUT(c) (oldbit)
323 + : "m" (*(unsigned long __percpu *)addr), "Ir" (nr));
324 +diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
325 +index 67881e5517fbf..2df407b2b0da7 100644
326 +--- a/drivers/gpu/drm/imx/imx-ldb.c
327 ++++ b/drivers/gpu/drm/imx/imx-ldb.c
328 +@@ -317,6 +317,7 @@ static void imx_ldb_encoder_disable(struct drm_encoder *encoder)
329 + {
330 + struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
331 + struct imx_ldb *ldb = imx_ldb_ch->ldb;
332 ++ int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
333 + int mux, ret;
334 +
335 + /*
336 +@@ -333,14 +334,14 @@ static void imx_ldb_encoder_disable(struct drm_encoder *encoder)
337 +
338 + drm_panel_disable(imx_ldb_ch->panel);
339 +
340 +- if (imx_ldb_ch == &ldb->channel[0])
341 ++ if (imx_ldb_ch == &ldb->channel[0] || dual)
342 + ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK;
343 +- else if (imx_ldb_ch == &ldb->channel[1])
344 ++ if (imx_ldb_ch == &ldb->channel[1] || dual)
345 + ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK;
346 +
347 + regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl);
348 +
349 +- if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) {
350 ++ if (dual) {
351 + clk_disable_unprepare(ldb->clk[0]);
352 + clk_disable_unprepare(ldb->clk[1]);
353 + }
354 +diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
355 +index 5cbf17aa84439..597ecae02c405 100644
356 +--- a/drivers/input/mouse/psmouse-base.c
357 ++++ b/drivers/input/mouse/psmouse-base.c
358 +@@ -1909,7 +1909,7 @@ static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp)
359 + {
360 + int type = *((unsigned int *)kp->arg);
361 +
362 +- return sprintf(buffer, "%s", psmouse_protocol_by_type(type)->name);
363 ++ return sprintf(buffer, "%s\n", psmouse_protocol_by_type(type)->name);
364 + }
365 +
366 + static int __init psmouse_init(void)
367 +diff --git a/drivers/media/pci/ttpci/budget-core.c b/drivers/media/pci/ttpci/budget-core.c
368 +index 6d42dcfd4825b..e7bdfc4e4aa83 100644
369 +--- a/drivers/media/pci/ttpci/budget-core.c
370 ++++ b/drivers/media/pci/ttpci/budget-core.c
371 +@@ -386,20 +386,25 @@ static int budget_register(struct budget *budget)
372 + ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->hw_frontend);
373 +
374 + if (ret < 0)
375 +- return ret;
376 ++ goto err_release_dmx;
377 +
378 + budget->mem_frontend.source = DMX_MEMORY_FE;
379 + ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->mem_frontend);
380 + if (ret < 0)
381 +- return ret;
382 ++ goto err_release_dmx;
383 +
384 + ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, &budget->hw_frontend);
385 + if (ret < 0)
386 +- return ret;
387 ++ goto err_release_dmx;
388 +
389 + dvb_net_init(&budget->dvb_adapter, &budget->dvb_net, &dvbdemux->dmx);
390 +
391 + return 0;
392 ++
393 ++err_release_dmx:
394 ++ dvb_dmxdev_release(&budget->dmxdev);
395 ++ dvb_dmx_release(&budget->demux);
396 ++ return ret;
397 + }
398 +
399 + static void budget_unregister(struct budget *budget)
400 +diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
401 +index c2c68988e38ac..9884b34d6f406 100644
402 +--- a/drivers/media/platform/davinci/vpss.c
403 ++++ b/drivers/media/platform/davinci/vpss.c
404 +@@ -519,19 +519,31 @@ static void vpss_exit(void)
405 +
406 + static int __init vpss_init(void)
407 + {
408 ++ int ret;
409 ++
410 + if (!request_mem_region(VPSS_CLK_CTRL, 4, "vpss_clock_control"))
411 + return -EBUSY;
412 +
413 + oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
414 + if (unlikely(!oper_cfg.vpss_regs_base2)) {
415 +- release_mem_region(VPSS_CLK_CTRL, 4);
416 +- return -ENOMEM;
417 ++ ret = -ENOMEM;
418 ++ goto err_ioremap;
419 + }
420 +
421 + writel(VPSS_CLK_CTRL_VENCCLKEN |
422 +- VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
423 ++ VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
424 ++
425 ++ ret = platform_driver_register(&vpss_driver);
426 ++ if (ret)
427 ++ goto err_pd_register;
428 ++
429 ++ return 0;
430 +
431 +- return platform_driver_register(&vpss_driver);
432 ++err_pd_register:
433 ++ iounmap(oper_cfg.vpss_regs_base2);
434 ++err_ioremap:
435 ++ release_mem_region(VPSS_CLK_CTRL, 4);
436 ++ return ret;
437 + }
438 + subsys_initcall(vpss_init);
439 + module_exit(vpss_exit);
440 +diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
441 +index 060f9b1769298..c387be5c926b7 100644
442 +--- a/drivers/net/dsa/b53/b53_common.c
443 ++++ b/drivers/net/dsa/b53/b53_common.c
444 +@@ -1175,6 +1175,8 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
445 + return ret;
446 +
447 + switch (ret) {
448 ++ case -ETIMEDOUT:
449 ++ return ret;
450 + case -ENOSPC:
451 + dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n",
452 + addr, vid);
453 +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
454 +index 8df32398d3435..9b3ea0406e0d5 100644
455 +--- a/drivers/net/ethernet/freescale/fec_main.c
456 ++++ b/drivers/net/ethernet/freescale/fec_main.c
457 +@@ -3505,11 +3505,11 @@ failed_mii_init:
458 + failed_irq:
459 + failed_init:
460 + fec_ptp_stop(pdev);
461 +- if (fep->reg_phy)
462 +- regulator_disable(fep->reg_phy);
463 + failed_reset:
464 + pm_runtime_put_noidle(&pdev->dev);
465 + pm_runtime_disable(&pdev->dev);
466 ++ if (fep->reg_phy)
467 ++ regulator_disable(fep->reg_phy);
468 + failed_regulator:
469 + failed_clk_ipg:
470 + fec_enet_clk_enable(ndev, false);
471 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
472 +index 67e396b2b3472..0e75c3a34fe7c 100644
473 +--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
474 ++++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
475 +@@ -1107,7 +1107,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
476 + #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04
477 + #define I40E_AQC_SET_VSI_DEFAULT 0x08
478 + #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10
479 +-#define I40E_AQC_SET_VSI_PROMISC_TX 0x8000
480 ++#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY 0x8000
481 + __le16 seid;
482 + #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF
483 + __le16 vlan_tag;
484 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
485 +index 2154a34c1dd80..09b47088dcc2b 100644
486 +--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
487 ++++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
488 +@@ -1922,6 +1922,21 @@ i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
489 + return status;
490 + }
491 +
492 ++/**
493 ++ * i40e_is_aq_api_ver_ge
494 ++ * @aq: pointer to AdminQ info containing HW API version to compare
495 ++ * @maj: API major value
496 ++ * @min: API minor value
497 ++ *
498 ++ * Assert whether current HW API version is greater/equal than provided.
499 ++ **/
500 ++static bool i40e_is_aq_api_ver_ge(struct i40e_adminq_info *aq, u16 maj,
501 ++ u16 min)
502 ++{
503 ++ return (aq->api_maj_ver > maj ||
504 ++ (aq->api_maj_ver == maj && aq->api_min_ver >= min));
505 ++}
506 ++
507 + /**
508 + * i40e_aq_add_vsi
509 + * @hw: pointer to the hw struct
510 +@@ -2047,18 +2062,16 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
511 +
512 + if (set) {
513 + flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
514 +- if (rx_only_promisc &&
515 +- (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
516 +- (hw->aq.api_maj_ver > 1)))
517 +- flags |= I40E_AQC_SET_VSI_PROMISC_TX;
518 ++ if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
519 ++ flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
520 + }
521 +
522 + cmd->promiscuous_flags = cpu_to_le16(flags);
523 +
524 + cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
525 +- if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) ||
526 +- (hw->aq.api_maj_ver > 1))
527 +- cmd->valid_flags |= cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_TX);
528 ++ if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
529 ++ cmd->valid_flags |=
530 ++ cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
531 +
532 + cmd->seid = cpu_to_le16(seid);
533 + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
534 +@@ -2155,11 +2168,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,
535 + i40e_fill_default_direct_cmd_desc(&desc,
536 + i40e_aqc_opc_set_vsi_promiscuous_modes);
537 +
538 +- if (enable)
539 ++ if (enable) {
540 + flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
541 ++ if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
542 ++ flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
543 ++ }
544 +
545 + cmd->promiscuous_flags = cpu_to_le16(flags);
546 + cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
547 ++ if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
548 ++ cmd->valid_flags |=
549 ++ cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
550 + cmd->seid = cpu_to_le16(seid);
551 + cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID);
552 +
553 +diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
554 +index 880a9068ca126..ef06af4e3611d 100644
555 +--- a/drivers/scsi/libfc/fc_disc.c
556 ++++ b/drivers/scsi/libfc/fc_disc.c
557 +@@ -595,8 +595,12 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
558 + mutex_lock(&disc->disc_mutex);
559 + if (PTR_ERR(fp) == -FC_EX_CLOSED)
560 + goto out;
561 +- if (IS_ERR(fp))
562 +- goto redisc;
563 ++ if (IS_ERR(fp)) {
564 ++ mutex_lock(&disc->disc_mutex);
565 ++ fc_disc_restart(disc);
566 ++ mutex_unlock(&disc->disc_mutex);
567 ++ goto out;
568 ++ }
569 +
570 + cp = fc_frame_payload_get(fp, sizeof(*cp));
571 + if (!cp)
572 +@@ -621,7 +625,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
573 + new_rdata->disc_id = disc->disc_id;
574 + lport->tt.rport_login(new_rdata);
575 + }
576 +- goto out;
577 ++ goto free_fp;
578 + }
579 + rdata->disc_id = disc->disc_id;
580 + lport->tt.rport_login(rdata);
581 +@@ -635,6 +639,8 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
582 + redisc:
583 + fc_disc_restart(disc);
584 + }
585 ++free_fp:
586 ++ fc_frame_free(fp);
587 + out:
588 + mutex_unlock(&disc->disc_mutex);
589 + kref_put(&rdata->kref, lport->tt.rport_destroy);
590 +diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h
591 +index 71f73d1d1ad1f..6c944fbefd40a 100644
592 +--- a/drivers/scsi/ufs/ufs_quirks.h
593 ++++ b/drivers/scsi/ufs/ufs_quirks.h
594 +@@ -21,6 +21,7 @@
595 + #define UFS_ANY_VENDOR 0xFFFF
596 + #define UFS_ANY_MODEL "ANY_MODEL"
597 +
598 ++#define UFS_VENDOR_MICRON 0x12C
599 + #define UFS_VENDOR_TOSHIBA 0x198
600 + #define UFS_VENDOR_SAMSUNG 0x1CE
601 + #define UFS_VENDOR_SKHYNIX 0x1AD
602 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
603 +index af4b0a2021d6c..a7f520581cb0f 100644
604 +--- a/drivers/scsi/ufs/ufshcd.c
605 ++++ b/drivers/scsi/ufs/ufshcd.c
606 +@@ -178,6 +178,8 @@ ufs_get_pm_lvl_to_link_pwr_state(enum ufs_pm_level lvl)
607 +
608 + static struct ufs_dev_fix ufs_fixups[] = {
609 + /* UFS cards deviations table */
610 ++ UFS_FIX(UFS_VENDOR_MICRON, UFS_ANY_MODEL,
611 ++ UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
612 + UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
613 + UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
614 + UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
615 +diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
616 +index e459cd7302e27..5cad9f41c238b 100644
617 +--- a/drivers/virtio/virtio_ring.c
618 ++++ b/drivers/virtio/virtio_ring.c
619 +@@ -785,6 +785,9 @@ bool virtqueue_poll(struct virtqueue *_vq, unsigned last_used_idx)
620 + {
621 + struct vring_virtqueue *vq = to_vvq(_vq);
622 +
623 ++ if (unlikely(vq->broken))
624 ++ return false;
625 ++
626 + virtio_mb(vq->weak_barriers);
627 + return (u16)last_used_idx != virtio16_to_cpu(_vq->vdev, vq->vring.used->idx);
628 + }
629 +diff --git a/drivers/xen/preempt.c b/drivers/xen/preempt.c
630 +index 5f6b77ea34fb5..128375ff80b8c 100644
631 +--- a/drivers/xen/preempt.c
632 ++++ b/drivers/xen/preempt.c
633 +@@ -31,7 +31,7 @@ EXPORT_SYMBOL_GPL(xen_in_preemptible_hcall);
634 + asmlinkage __visible void xen_maybe_preempt_hcall(void)
635 + {
636 + if (unlikely(__this_cpu_read(xen_in_preemptible_hcall)
637 +- && need_resched())) {
638 ++ && need_resched() && !preempt_count())) {
639 + /*
640 + * Clear flag as we may be rescheduled on a different
641 + * cpu.
642 +diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
643 +index 2bc37d03d4075..abfc090510480 100644
644 +--- a/fs/btrfs/ctree.h
645 ++++ b/fs/btrfs/ctree.h
646 +@@ -3261,6 +3261,8 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
647 + int btrfs_parse_options(struct btrfs_root *root, char *options,
648 + unsigned long new_flags);
649 + int btrfs_sync_fs(struct super_block *sb, int wait);
650 ++char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
651 ++ u64 subvol_objectid);
652 +
653 + static inline __printf(2, 3)
654 + void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
655 +diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
656 +index 2513a7f533342..92f80ed642194 100644
657 +--- a/fs/btrfs/export.c
658 ++++ b/fs/btrfs/export.c
659 +@@ -55,9 +55,9 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len,
660 + return type;
661 + }
662 +
663 +-static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
664 +- u64 root_objectid, u32 generation,
665 +- int check_generation)
666 ++struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
667 ++ u64 root_objectid, u32 generation,
668 ++ int check_generation)
669 + {
670 + struct btrfs_fs_info *fs_info = btrfs_sb(sb);
671 + struct btrfs_root *root;
672 +@@ -150,7 +150,7 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
673 + return btrfs_get_dentry(sb, objectid, root_objectid, generation, 1);
674 + }
675 +
676 +-static struct dentry *btrfs_get_parent(struct dentry *child)
677 ++struct dentry *btrfs_get_parent(struct dentry *child)
678 + {
679 + struct inode *dir = d_inode(child);
680 + struct btrfs_root *root = BTRFS_I(dir)->root;
681 +diff --git a/fs/btrfs/export.h b/fs/btrfs/export.h
682 +index 074348a95841f..7a305e5549991 100644
683 +--- a/fs/btrfs/export.h
684 ++++ b/fs/btrfs/export.h
685 +@@ -16,4 +16,9 @@ struct btrfs_fid {
686 + u64 parent_root_objectid;
687 + } __attribute__ ((packed));
688 +
689 ++struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
690 ++ u64 root_objectid, u32 generation,
691 ++ int check_generation);
692 ++struct dentry *btrfs_get_parent(struct dentry *child);
693 ++
694 + #endif
695 +diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
696 +index 9286603a6a98b..3a0cb745164f8 100644
697 +--- a/fs/btrfs/super.c
698 ++++ b/fs/btrfs/super.c
699 +@@ -948,8 +948,8 @@ out:
700 + return error;
701 + }
702 +
703 +-static char *get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
704 +- u64 subvol_objectid)
705 ++char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
706 ++ u64 subvol_objectid)
707 + {
708 + struct btrfs_root *root = fs_info->tree_root;
709 + struct btrfs_root *fs_root;
710 +@@ -1225,6 +1225,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
711 + struct btrfs_fs_info *info = btrfs_sb(dentry->d_sb);
712 + struct btrfs_root *root = info->tree_root;
713 + char *compress_type;
714 ++ const char *subvol_name;
715 +
716 + if (btrfs_test_opt(info, DEGRADED))
717 + seq_puts(seq, ",degraded");
718 +@@ -1311,8 +1312,13 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
719 + #endif
720 + seq_printf(seq, ",subvolid=%llu",
721 + BTRFS_I(d_inode(dentry))->root->root_key.objectid);
722 +- seq_puts(seq, ",subvol=");
723 +- seq_dentry(seq, dentry, " \t\n\\");
724 ++ subvol_name = btrfs_get_subvol_name_from_objectid(info,
725 ++ BTRFS_I(d_inode(dentry))->root->root_key.objectid);
726 ++ if (!IS_ERR(subvol_name)) {
727 ++ seq_puts(seq, ",subvol=");
728 ++ seq_escape(seq, subvol_name, " \t\n\\");
729 ++ kfree(subvol_name);
730 ++ }
731 + return 0;
732 + }
733 +
734 +@@ -1430,8 +1436,8 @@ static struct dentry *mount_subvol(const char *subvol_name, u64 subvol_objectid,
735 + goto out;
736 + }
737 + }
738 +- subvol_name = get_subvol_name_from_objectid(btrfs_sb(mnt->mnt_sb),
739 +- subvol_objectid);
740 ++ subvol_name = btrfs_get_subvol_name_from_objectid(
741 ++ btrfs_sb(mnt->mnt_sb), subvol_objectid);
742 + if (IS_ERR(subvol_name)) {
743 + root = ERR_CAST(subvol_name);
744 + subvol_name = NULL;
745 +diff --git a/fs/eventpoll.c b/fs/eventpoll.c
746 +index a9c0bf8782f53..aad52e1858363 100644
747 +--- a/fs/eventpoll.c
748 ++++ b/fs/eventpoll.c
749 +@@ -1747,9 +1747,11 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
750 + * not already there, and calling reverse_path_check()
751 + * during ep_insert().
752 + */
753 +- if (list_empty(&epi->ffd.file->f_tfile_llink))
754 ++ if (list_empty(&epi->ffd.file->f_tfile_llink)) {
755 ++ get_file(epi->ffd.file);
756 + list_add(&epi->ffd.file->f_tfile_llink,
757 + &tfile_check_list);
758 ++ }
759 + }
760 + }
761 + mutex_unlock(&ep->mtx);
762 +@@ -1793,6 +1795,7 @@ static void clear_tfile_check_list(void)
763 + file = list_first_entry(&tfile_check_list, struct file,
764 + f_tfile_llink);
765 + list_del_init(&file->f_tfile_llink);
766 ++ fput(file);
767 + }
768 + INIT_LIST_HEAD(&tfile_check_list);
769 + }
770 +@@ -1943,13 +1946,13 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
771 + mutex_lock(&epmutex);
772 + if (is_file_epoll(tf.file)) {
773 + error = -ELOOP;
774 +- if (ep_loop_check(ep, tf.file) != 0) {
775 +- clear_tfile_check_list();
776 ++ if (ep_loop_check(ep, tf.file) != 0)
777 + goto error_tgt_fput;
778 +- }
779 +- } else
780 ++ } else {
781 ++ get_file(tf.file);
782 + list_add(&tf.file->f_tfile_llink,
783 + &tfile_check_list);
784 ++ }
785 + mutex_lock_nested(&ep->mtx, 0);
786 + if (is_file_epoll(tf.file)) {
787 + tep = tf.file->private_data;
788 +@@ -1973,8 +1976,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
789 + error = ep_insert(ep, &epds, tf.file, fd, full_check);
790 + } else
791 + error = -EEXIST;
792 +- if (full_check)
793 +- clear_tfile_check_list();
794 + break;
795 + case EPOLL_CTL_DEL:
796 + if (epi)
797 +@@ -1997,8 +1998,10 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
798 + mutex_unlock(&ep->mtx);
799 +
800 + error_tgt_fput:
801 +- if (full_check)
802 ++ if (full_check) {
803 ++ clear_tfile_check_list();
804 + mutex_unlock(&epmutex);
805 ++ }
806 +
807 + fdput(tf);
808 + error_fput:
809 +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
810 +index 6225ce9f1884c..157dbbe235f90 100644
811 +--- a/fs/ext4/namei.c
812 ++++ b/fs/ext4/namei.c
813 +@@ -1251,19 +1251,18 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block)
814 + }
815 +
816 + /*
817 +- * NOTE! unlike strncmp, ext4_match returns 1 for success, 0 for failure.
818 ++ * Test whether a directory entry matches the filename being searched for.
819 + *
820 +- * `len <= EXT4_NAME_LEN' is guaranteed by caller.
821 +- * `de != NULL' is guaranteed by caller.
822 ++ * Return: %true if the directory entry matches, otherwise %false.
823 + */
824 +-static inline int ext4_match(struct ext4_filename *fname,
825 +- struct ext4_dir_entry_2 *de)
826 ++static inline bool ext4_match(const struct ext4_filename *fname,
827 ++ const struct ext4_dir_entry_2 *de)
828 + {
829 + const void *name = fname_name(fname);
830 + u32 len = fname_len(fname);
831 +
832 + if (!de->inode)
833 +- return 0;
834 ++ return false;
835 +
836 + #ifdef CONFIG_EXT4_FS_ENCRYPTION
837 + if (unlikely(!name)) {
838 +@@ -1295,48 +1294,31 @@ int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size,
839 + struct ext4_dir_entry_2 * de;
840 + char * dlimit;
841 + int de_len;
842 +- int res;
843 +
844 + de = (struct ext4_dir_entry_2 *)search_buf;
845 + dlimit = search_buf + buf_size;
846 + while ((char *) de < dlimit) {
847 + /* this code is executed quadratically often */
848 + /* do minimal checking `by hand' */
849 +- if ((char *) de + de->name_len <= dlimit) {
850 +- res = ext4_match(fname, de);
851 +- if (res < 0) {
852 +- res = -1;
853 +- goto return_result;
854 +- }
855 +- if (res > 0) {
856 +- /* found a match - just to be sure, do
857 +- * a full check */
858 +- if (ext4_check_dir_entry(dir, NULL, de, bh,
859 +- bh->b_data,
860 +- bh->b_size, offset)) {
861 +- res = -1;
862 +- goto return_result;
863 +- }
864 +- *res_dir = de;
865 +- res = 1;
866 +- goto return_result;
867 +- }
868 +-
869 ++ if ((char *) de + de->name_len <= dlimit &&
870 ++ ext4_match(fname, de)) {
871 ++ /* found a match - just to be sure, do
872 ++ * a full check */
873 ++ if (ext4_check_dir_entry(dir, NULL, de, bh, search_buf,
874 ++ buf_size, offset))
875 ++ return -1;
876 ++ *res_dir = de;
877 ++ return 1;
878 + }
879 + /* prevent looping on a bad block */
880 + de_len = ext4_rec_len_from_disk(de->rec_len,
881 + dir->i_sb->s_blocksize);
882 +- if (de_len <= 0) {
883 +- res = -1;
884 +- goto return_result;
885 +- }
886 ++ if (de_len <= 0)
887 ++ return -1;
888 + offset += de_len;
889 + de = (struct ext4_dir_entry_2 *) ((char *) de + de_len);
890 + }
891 +-
892 +- res = 0;
893 +-return_result:
894 +- return res;
895 ++ return 0;
896 + }
897 +
898 + static int is_dx_internal_node(struct inode *dir, ext4_lblk_t block,
899 +@@ -1777,7 +1759,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
900 + blocksize, hinfo, map);
901 + map -= count;
902 + dx_sort_map(map, count);
903 +- /* Split the existing block in the middle, size-wise */
904 ++ /* Ensure that neither split block is over half full */
905 + size = 0;
906 + move = 0;
907 + for (i = count-1; i >= 0; i--) {
908 +@@ -1787,8 +1769,18 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
909 + size += map[i].size;
910 + move++;
911 + }
912 +- /* map index at which we will split */
913 +- split = count - move;
914 ++ /*
915 ++ * map index at which we will split
916 ++ *
917 ++ * If the sum of active entries didn't exceed half the block size, just
918 ++ * split it in half by count; each resulting block will have at least
919 ++ * half the space free.
920 ++ */
921 ++ if (i > 0)
922 ++ split = count - move;
923 ++ else
924 ++ split = count/2;
925 ++
926 + hash2 = map[split].hash;
927 + continued = hash2 == map[split - 1].hash;
928 + dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n",
929 +@@ -1853,24 +1845,15 @@ int ext4_find_dest_de(struct inode *dir, struct inode *inode,
930 + int nlen, rlen;
931 + unsigned int offset = 0;
932 + char *top;
933 +- int res;
934 +
935 + de = (struct ext4_dir_entry_2 *)buf;
936 + top = buf + buf_size - reclen;
937 + while ((char *) de <= top) {
938 + if (ext4_check_dir_entry(dir, NULL, de, bh,
939 +- buf, buf_size, offset)) {
940 +- res = -EFSCORRUPTED;
941 +- goto return_result;
942 +- }
943 +- /* Provide crypto context and crypto buffer to ext4 match */
944 +- res = ext4_match(fname, de);
945 +- if (res < 0)
946 +- goto return_result;
947 +- if (res > 0) {
948 +- res = -EEXIST;
949 +- goto return_result;
950 +- }
951 ++ buf, buf_size, offset))
952 ++ return -EFSCORRUPTED;
953 ++ if (ext4_match(fname, de))
954 ++ return -EEXIST;
955 + nlen = EXT4_DIR_REC_LEN(de->name_len);
956 + rlen = ext4_rec_len_from_disk(de->rec_len, buf_size);
957 + if ((de->inode ? rlen - nlen : rlen) >= reclen)
958 +@@ -1878,15 +1861,11 @@ int ext4_find_dest_de(struct inode *dir, struct inode *inode,
959 + de = (struct ext4_dir_entry_2 *)((char *)de + rlen);
960 + offset += rlen;
961 + }
962 +-
963 + if ((char *) de > top)
964 +- res = -ENOSPC;
965 +- else {
966 +- *dest_de = de;
967 +- res = 0;
968 +- }
969 +-return_result:
970 +- return res;
971 ++ return -ENOSPC;
972 ++
973 ++ *dest_de = de;
974 ++ return 0;
975 + }
976 +
977 + int ext4_insert_dentry(struct inode *dir,
978 +@@ -2375,7 +2354,7 @@ int ext4_generic_delete_entry(handle_t *handle,
979 + de = (struct ext4_dir_entry_2 *)entry_buf;
980 + while (i < buf_size - csum_size) {
981 + if (ext4_check_dir_entry(dir, NULL, de, bh,
982 +- bh->b_data, bh->b_size, i))
983 ++ entry_buf, buf_size, i))
984 + return -EFSCORRUPTED;
985 + if (de == de_del) {
986 + if (pde)
987 +diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
988 +index e5a6deb38e1e1..f4a5ec92f5dc7 100644
989 +--- a/fs/jffs2/dir.c
990 ++++ b/fs/jffs2/dir.c
991 +@@ -590,10 +590,14 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
992 + int ret;
993 + uint32_t now = get_seconds();
994 +
995 ++ mutex_lock(&f->sem);
996 + for (fd = f->dents ; fd; fd = fd->next) {
997 +- if (fd->ino)
998 ++ if (fd->ino) {
999 ++ mutex_unlock(&f->sem);
1000 + return -ENOTEMPTY;
1001 ++ }
1002 + }
1003 ++ mutex_unlock(&f->sem);
1004 +
1005 + ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
1006 + dentry->d_name.len, f, now);
1007 +diff --git a/fs/romfs/storage.c b/fs/romfs/storage.c
1008 +index f86f51f99aceb..1dcadd22b440d 100644
1009 +--- a/fs/romfs/storage.c
1010 ++++ b/fs/romfs/storage.c
1011 +@@ -221,10 +221,8 @@ int romfs_dev_read(struct super_block *sb, unsigned long pos,
1012 + size_t limit;
1013 +
1014 + limit = romfs_maxsize(sb);
1015 +- if (pos >= limit)
1016 ++ if (pos >= limit || buflen > limit - pos)
1017 + return -EIO;
1018 +- if (buflen > limit - pos)
1019 +- buflen = limit - pos;
1020 +
1021 + #ifdef CONFIG_ROMFS_ON_MTD
1022 + if (sb->s_mtd)
1023 +diff --git a/fs/xfs/xfs_sysfs.h b/fs/xfs/xfs_sysfs.h
1024 +index d04637181ef21..980c9429abec5 100644
1025 +--- a/fs/xfs/xfs_sysfs.h
1026 ++++ b/fs/xfs/xfs_sysfs.h
1027 +@@ -44,9 +44,11 @@ xfs_sysfs_init(
1028 + struct xfs_kobj *parent_kobj,
1029 + const char *name)
1030 + {
1031 ++ struct kobject *parent;
1032 ++
1033 ++ parent = parent_kobj ? &parent_kobj->kobject : NULL;
1034 + init_completion(&kobj->complete);
1035 +- return kobject_init_and_add(&kobj->kobject, ktype,
1036 +- &parent_kobj->kobject, "%s", name);
1037 ++ return kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name);
1038 + }
1039 +
1040 + static inline void
1041 +diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
1042 +index c3d547211d160..9c42e50a5cb7e 100644
1043 +--- a/fs/xfs/xfs_trans_dquot.c
1044 ++++ b/fs/xfs/xfs_trans_dquot.c
1045 +@@ -669,7 +669,7 @@ xfs_trans_dqresv(
1046 + }
1047 + }
1048 + if (ninos > 0) {
1049 +- total_count = be64_to_cpu(dqp->q_core.d_icount) + ninos;
1050 ++ total_count = dqp->q_res_icount + ninos;
1051 + timer = be32_to_cpu(dqp->q_core.d_itimer);
1052 + warns = be16_to_cpu(dqp->q_core.d_iwarns);
1053 + warnlimit = dqp->q_mount->m_quotainfo->qi_iwarnlimit;
1054 +diff --git a/kernel/relay.c b/kernel/relay.c
1055 +index 5034cb3a339fb..3623ad9b529c2 100644
1056 +--- a/kernel/relay.c
1057 ++++ b/kernel/relay.c
1058 +@@ -196,6 +196,7 @@ free_buf:
1059 + static void relay_destroy_channel(struct kref *kref)
1060 + {
1061 + struct rchan *chan = container_of(kref, struct rchan, kref);
1062 ++ free_percpu(chan->buf);
1063 + kfree(chan);
1064 + }
1065 +
1066 +diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
1067 +index 5fe23f0ee7db6..d1e007c729235 100644
1068 +--- a/kernel/trace/trace_hwlat.c
1069 ++++ b/kernel/trace/trace_hwlat.c
1070 +@@ -268,24 +268,14 @@ out:
1071 + static struct cpumask save_cpumask;
1072 + static bool disable_migrate;
1073 +
1074 +-static void move_to_next_cpu(bool initmask)
1075 ++static void move_to_next_cpu(void)
1076 + {
1077 +- static struct cpumask *current_mask;
1078 ++ struct cpumask *current_mask = &save_cpumask;
1079 ++ struct trace_array *tr = hwlat_trace;
1080 + int next_cpu;
1081 +
1082 + if (disable_migrate)
1083 + return;
1084 +-
1085 +- /* Just pick the first CPU on first iteration */
1086 +- if (initmask) {
1087 +- current_mask = &save_cpumask;
1088 +- get_online_cpus();
1089 +- cpumask_and(current_mask, cpu_online_mask, tracing_buffer_mask);
1090 +- put_online_cpus();
1091 +- next_cpu = cpumask_first(current_mask);
1092 +- goto set_affinity;
1093 +- }
1094 +-
1095 + /*
1096 + * If for some reason the user modifies the CPU affinity
1097 + * of this thread, than stop migrating for the duration
1098 +@@ -295,14 +285,13 @@ static void move_to_next_cpu(bool initmask)
1099 + goto disable;
1100 +
1101 + get_online_cpus();
1102 +- cpumask_and(current_mask, cpu_online_mask, tracing_buffer_mask);
1103 ++ cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask);
1104 + next_cpu = cpumask_next(smp_processor_id(), current_mask);
1105 + put_online_cpus();
1106 +
1107 + if (next_cpu >= nr_cpu_ids)
1108 + next_cpu = cpumask_first(current_mask);
1109 +
1110 +- set_affinity:
1111 + if (next_cpu >= nr_cpu_ids) /* Shouldn't happen! */
1112 + goto disable;
1113 +
1114 +@@ -332,12 +321,10 @@ static void move_to_next_cpu(bool initmask)
1115 + static int kthread_fn(void *data)
1116 + {
1117 + u64 interval;
1118 +- bool initmask = true;
1119 +
1120 + while (!kthread_should_stop()) {
1121 +
1122 +- move_to_next_cpu(initmask);
1123 +- initmask = false;
1124 ++ move_to_next_cpu();
1125 +
1126 + local_irq_disable();
1127 + get_sample();
1128 +@@ -368,13 +355,27 @@ static int kthread_fn(void *data)
1129 + */
1130 + static int start_kthread(struct trace_array *tr)
1131 + {
1132 ++ struct cpumask *current_mask = &save_cpumask;
1133 + struct task_struct *kthread;
1134 ++ int next_cpu;
1135 ++
1136 ++ /* Just pick the first CPU on first iteration */
1137 ++ current_mask = &save_cpumask;
1138 ++ get_online_cpus();
1139 ++ cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask);
1140 ++ put_online_cpus();
1141 ++ next_cpu = cpumask_first(current_mask);
1142 +
1143 + kthread = kthread_create(kthread_fn, NULL, "hwlatd");
1144 + if (IS_ERR(kthread)) {
1145 + pr_err(BANNER "could not start sampling thread\n");
1146 + return -ENOMEM;
1147 + }
1148 ++
1149 ++ cpumask_clear(current_mask);
1150 ++ cpumask_set_cpu(next_cpu, current_mask);
1151 ++ sched_setaffinity(kthread->pid, current_mask);
1152 ++
1153 + hwlat_kthread = kthread;
1154 + wake_up_process(kthread);
1155 +
1156 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
1157 +index 9914da93069e8..2c22ea7a20131 100644
1158 +--- a/mm/hugetlb.c
1159 ++++ b/mm/hugetlb.c
1160 +@@ -4380,25 +4380,21 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr)
1161 + void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
1162 + unsigned long *start, unsigned long *end)
1163 + {
1164 +- unsigned long check_addr = *start;
1165 ++ unsigned long a_start, a_end;
1166 +
1167 + if (!(vma->vm_flags & VM_MAYSHARE))
1168 + return;
1169 +
1170 +- for (check_addr = *start; check_addr < *end; check_addr += PUD_SIZE) {
1171 +- unsigned long a_start = check_addr & PUD_MASK;
1172 +- unsigned long a_end = a_start + PUD_SIZE;
1173 ++ /* Extend the range to be PUD aligned for a worst case scenario */
1174 ++ a_start = ALIGN_DOWN(*start, PUD_SIZE);
1175 ++ a_end = ALIGN(*end, PUD_SIZE);
1176 +
1177 +- /*
1178 +- * If sharing is possible, adjust start/end if necessary.
1179 +- */
1180 +- if (range_in_vma(vma, a_start, a_end)) {
1181 +- if (a_start < *start)
1182 +- *start = a_start;
1183 +- if (a_end > *end)
1184 +- *end = a_end;
1185 +- }
1186 +- }
1187 ++ /*
1188 ++ * Intersect the range with the vma range, since pmd sharing won't be
1189 ++ * across vma after all
1190 ++ */
1191 ++ *start = max(vma->vm_start, a_start);
1192 ++ *end = min(vma->vm_end, a_end);
1193 + }
1194 +
1195 + /*
1196 +diff --git a/mm/khugepaged.c b/mm/khugepaged.c
1197 +index 3080c6415493c..1538e5e5c628a 100644
1198 +--- a/mm/khugepaged.c
1199 ++++ b/mm/khugepaged.c
1200 +@@ -391,7 +391,7 @@ static void insert_to_mm_slots_hash(struct mm_struct *mm,
1201 +
1202 + static inline int khugepaged_test_exit(struct mm_struct *mm)
1203 + {
1204 +- return atomic_read(&mm->mm_users) == 0;
1205 ++ return atomic_read(&mm->mm_users) == 0 || !mmget_still_valid(mm);
1206 + }
1207 +
1208 + int __khugepaged_enter(struct mm_struct *mm)
1209 +@@ -404,7 +404,7 @@ int __khugepaged_enter(struct mm_struct *mm)
1210 + return -ENOMEM;
1211 +
1212 + /* __khugepaged_exit() must not run from under us */
1213 +- VM_BUG_ON_MM(khugepaged_test_exit(mm), mm);
1214 ++ VM_BUG_ON_MM(atomic_read(&mm->mm_users) == 0, mm);
1215 + if (unlikely(test_and_set_bit(MMF_VM_HUGEPAGE, &mm->flags))) {
1216 + free_mm_slot(mm_slot);
1217 + return 0;
1218 +@@ -1004,9 +1004,6 @@ static void collapse_huge_page(struct mm_struct *mm,
1219 + * handled by the anon_vma lock + PG_lock.
1220 + */
1221 + down_write(&mm->mmap_sem);
1222 +- result = SCAN_ANY_PROCESS;
1223 +- if (!mmget_still_valid(mm))
1224 +- goto out;
1225 + result = hugepage_vma_revalidate(mm, address, &vma);
1226 + if (result)
1227 + goto out;
1228 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
1229 +index f394dd87fa033..458523bc73916 100644
1230 +--- a/mm/page_alloc.c
1231 ++++ b/mm/page_alloc.c
1232 +@@ -1116,6 +1116,11 @@ static void free_pcppages_bulk(struct zone *zone, int count,
1233 + if (nr_scanned)
1234 + __mod_node_page_state(zone->zone_pgdat, NR_PAGES_SCANNED, -nr_scanned);
1235 +
1236 ++ /*
1237 ++ * Ensure proper count is passed which otherwise would stuck in the
1238 ++ * below while (list_empty(list)) loop.
1239 ++ */
1240 ++ count = min(pcp->count, count);
1241 + while (count) {
1242 + struct page *page;
1243 + struct list_head *list;
1244 +@@ -6782,7 +6787,7 @@ int __meminit init_per_zone_wmark_min(void)
1245 +
1246 + return 0;
1247 + }
1248 +-core_initcall(init_per_zone_wmark_min)
1249 ++postcore_initcall(init_per_zone_wmark_min)
1250 +
1251 + /*
1252 + * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
1253 +diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
1254 +index e83e314a76a53..dc1b9a32c0575 100644
1255 +--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
1256 ++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
1257 +@@ -339,7 +339,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
1258 +
1259 + ret_val = power_up_sst(stream);
1260 + if (ret_val < 0)
1261 +- return ret_val;
1262 ++ goto out_power_up;
1263 +
1264 + /* Make sure, that the period size is always even */
1265 + snd_pcm_hw_constraint_step(substream->runtime, 0,
1266 +@@ -348,8 +348,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
1267 + return snd_pcm_hw_constraint_integer(runtime,
1268 + SNDRV_PCM_HW_PARAM_PERIODS);
1269 + out_ops:
1270 +- kfree(stream);
1271 + mutex_unlock(&sst_lock);
1272 ++out_power_up:
1273 ++ kfree(stream);
1274 + return ret_val;
1275 + }
1276 +
1277 +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
1278 +index 7d0d44b4f3d5c..863f668a07355 100644
1279 +--- a/tools/perf/util/probe-finder.c
1280 ++++ b/tools/perf/util/probe-finder.c
1281 +@@ -1351,7 +1351,7 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
1282 + tf.ntevs = 0;
1283 +
1284 + ret = debuginfo__find_probes(dbg, &tf.pf);
1285 +- if (ret < 0) {
1286 ++ if (ret < 0 || tf.ntevs == 0) {
1287 + for (i = 0; i < tf.ntevs; i++)
1288 + clear_probe_trace_event(&tf.tevs[i]);
1289 + zfree(tevs);