Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Wed, 26 Aug 2020 11:16:43
Message-Id: 1598440575.b0dc77c40c31e3115d85da6c51e04e85d0bde1c3.mpagano@gentoo
1 commit: b0dc77c40c31e3115d85da6c51e04e85d0bde1c3
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 26 11:16:15 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 26 11:16:15 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b0dc77c4
7
8 Linux patch 5.4.61
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1060_linux-5.4.61.patch | 3600 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3604 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 5a3df13..fca4b03 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -283,6 +283,10 @@ Patch: 1059_linux-5.4.60.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.60
23
24 +Patch: 1060_linux-5.4.61.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.61
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/1060_linux-5.4.61.patch b/1060_linux-5.4.61.patch
33 new file mode 100644
34 index 0000000..bee93bc
35 --- /dev/null
36 +++ b/1060_linux-5.4.61.patch
37 @@ -0,0 +1,3600 @@
38 +diff --git a/Documentation/kbuild/index.rst b/Documentation/kbuild/index.rst
39 +index 0f144fad99a6a..3882bd5f7728c 100644
40 +--- a/Documentation/kbuild/index.rst
41 ++++ b/Documentation/kbuild/index.rst
42 +@@ -19,6 +19,7 @@ Kernel Build System
43 +
44 + issues
45 + reproducible-builds
46 ++ llvm
47 +
48 + .. only:: subproject and html
49 +
50 +diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
51 +index f1e5dce86af7c..852ccc551bb3a 100644
52 +--- a/Documentation/kbuild/kbuild.rst
53 ++++ b/Documentation/kbuild/kbuild.rst
54 +@@ -262,3 +262,8 @@ KBUILD_BUILD_USER, KBUILD_BUILD_HOST
55 + These two variables allow to override the user@host string displayed during
56 + boot and in /proc/version. The default value is the output of the commands
57 + whoami and host, respectively.
58 ++
59 ++LLVM
60 ++----
61 ++If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
62 ++of GCC and GNU binutils to build the kernel.
63 +diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
64 +new file mode 100644
65 +index 0000000000000..c776b6eee969f
66 +--- /dev/null
67 ++++ b/Documentation/kbuild/llvm.rst
68 +@@ -0,0 +1,87 @@
69 ++==============================
70 ++Building Linux with Clang/LLVM
71 ++==============================
72 ++
73 ++This document covers how to build the Linux kernel with Clang and LLVM
74 ++utilities.
75 ++
76 ++About
77 ++-----
78 ++
79 ++The Linux kernel has always traditionally been compiled with GNU toolchains
80 ++such as GCC and binutils. Ongoing work has allowed for `Clang
81 ++<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
82 ++used as viable substitutes. Distributions such as `Android
83 ++<https://www.android.com/>`_, `ChromeOS
84 ++<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
85 ++<https://www.openmandriva.org/>`_ use Clang built kernels. `LLVM is a
86 ++collection of toolchain components implemented in terms of C++ objects
87 ++<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
88 ++supports C and the GNU C extensions required by the kernel, and is pronounced
89 ++"klang," not "see-lang."
90 ++
91 ++Clang
92 ++-----
93 ++
94 ++The compiler used can be swapped out via `CC=` command line argument to `make`.
95 ++`CC=` should be set when selecting a config and during a build.
96 ++
97 ++ make CC=clang defconfig
98 ++
99 ++ make CC=clang
100 ++
101 ++Cross Compiling
102 ++---------------
103 ++
104 ++A single Clang compiler binary will typically contain all supported backends,
105 ++which can help simplify cross compiling.
106 ++
107 ++ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
108 ++
109 ++`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
110 ++`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
111 ++example:
112 ++
113 ++ clang --target aarch64-linux-gnu foo.c
114 ++
115 ++LLVM Utilities
116 ++--------------
117 ++
118 ++LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1`
119 ++to enable them.
120 ++
121 ++ make LLVM=1
122 ++
123 ++They can be enabled individually. The full list of the parameters:
124 ++
125 ++ make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
126 ++ OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
127 ++ READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
128 ++ HOSTLD=ld.lld
129 ++
130 ++Currently, the integrated assembler is disabled by default. You can pass
131 ++`LLVM_IAS=1` to enable it.
132 ++
133 ++Getting Help
134 ++------------
135 ++
136 ++- `Website <https://clangbuiltlinux.github.io/>`_
137 ++- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <clang-built-linux@××××××××××××.com>
138 ++- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
139 ++- IRC: #clangbuiltlinux on chat.freenode.net
140 ++- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
141 ++- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
142 ++- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
143 ++
144 ++Getting LLVM
145 ++-------------
146 ++
147 ++- http://releases.llvm.org/download.html
148 ++- https://github.com/llvm/llvm-project
149 ++- https://llvm.org/docs/GettingStarted.html
150 ++- https://llvm.org/docs/CMake.html
151 ++- https://apt.llvm.org/
152 ++- https://www.archlinux.org/packages/extra/x86_64/llvm/
153 ++- https://github.com/ClangBuiltLinux/tc-build
154 ++- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
155 ++- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/
156 +diff --git a/MAINTAINERS b/MAINTAINERS
157 +index fe6fa5d3a63e5..1407008df7491 100644
158 +--- a/MAINTAINERS
159 ++++ b/MAINTAINERS
160 +@@ -4028,6 +4028,7 @@ B: https://github.com/ClangBuiltLinux/linux/issues
161 + C: irc://chat.freenode.net/clangbuiltlinux
162 + S: Supported
163 + K: \b(?i:clang|llvm)\b
164 ++F: Documentation/kbuild/llvm.rst
165 +
166 + CLEANCACHE API
167 + M: Konrad Rzeszutek Wilk <konrad.wilk@××××××.com>
168 +diff --git a/Makefile b/Makefile
169 +index 7c001e21e28e7..2c21b922644d7 100644
170 +--- a/Makefile
171 ++++ b/Makefile
172 +@@ -1,7 +1,7 @@
173 + # SPDX-License-Identifier: GPL-2.0
174 + VERSION = 5
175 + PATCHLEVEL = 4
176 +-SUBLEVEL = 60
177 ++SUBLEVEL = 61
178 + EXTRAVERSION =
179 + NAME = Kleptomaniac Octopus
180 +
181 +@@ -394,8 +394,13 @@ HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null)
182 + HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null)
183 + HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
184 +
185 +-HOSTCC = gcc
186 +-HOSTCXX = g++
187 ++ifneq ($(LLVM),)
188 ++HOSTCC = clang
189 ++HOSTCXX = clang++
190 ++else
191 ++HOSTCC = gcc
192 ++HOSTCXX = g++
193 ++endif
194 + KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
195 + -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \
196 + $(HOSTCFLAGS)
197 +@@ -404,16 +409,28 @@ KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
198 + KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
199 +
200 + # Make variables (CC, etc...)
201 +-AS = $(CROSS_COMPILE)as
202 +-LD = $(CROSS_COMPILE)ld
203 +-CC = $(CROSS_COMPILE)gcc
204 + CPP = $(CC) -E
205 ++ifneq ($(LLVM),)
206 ++CC = clang
207 ++LD = ld.lld
208 ++AR = llvm-ar
209 ++NM = llvm-nm
210 ++OBJCOPY = llvm-objcopy
211 ++OBJDUMP = llvm-objdump
212 ++READELF = llvm-readelf
213 ++OBJSIZE = llvm-size
214 ++STRIP = llvm-strip
215 ++else
216 ++CC = $(CROSS_COMPILE)gcc
217 ++LD = $(CROSS_COMPILE)ld
218 + AR = $(CROSS_COMPILE)ar
219 + NM = $(CROSS_COMPILE)nm
220 +-STRIP = $(CROSS_COMPILE)strip
221 + OBJCOPY = $(CROSS_COMPILE)objcopy
222 + OBJDUMP = $(CROSS_COMPILE)objdump
223 ++READELF = $(CROSS_COMPILE)readelf
224 + OBJSIZE = $(CROSS_COMPILE)size
225 ++STRIP = $(CROSS_COMPILE)strip
226 ++endif
227 + PAHOLE = pahole
228 + LEX = flex
229 + YACC = bison
230 +@@ -422,7 +439,6 @@ INSTALLKERNEL := installkernel
231 + DEPMOD = /sbin/depmod
232 + PERL = perl
233 + PYTHON = python
234 +-PYTHON2 = python2
235 + PYTHON3 = python3
236 + CHECK = sparse
237 + BASH = bash
238 +@@ -471,9 +487,9 @@ KBUILD_LDFLAGS :=
239 + GCC_PLUGINS_CFLAGS :=
240 + CLANG_FLAGS :=
241 +
242 +-export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
243 +-export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE PAHOLE LEX YACC AWK INSTALLKERNEL
244 +-export PERL PYTHON PYTHON2 PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
245 ++export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
246 ++export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL
247 ++export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
248 + export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
249 +
250 + export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
251 +@@ -534,7 +550,7 @@ endif
252 + ifneq ($(GCC_TOOLCHAIN),)
253 + CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
254 + endif
255 +-ifeq ($(shell $(AS) --version 2>&1 | head -n 1 | grep clang),)
256 ++ifneq ($(LLVM_IAS),1)
257 + CLANG_FLAGS += -no-integrated-as
258 + endif
259 + CLANG_FLAGS += -Werror=unknown-warning-option
260 +diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
261 +index b771bf1b53523..103270d5a9fc6 100644
262 +--- a/arch/alpha/include/asm/io.h
263 ++++ b/arch/alpha/include/asm/io.h
264 +@@ -502,10 +502,10 @@ extern inline void writeq(u64 b, volatile void __iomem *addr)
265 + }
266 + #endif
267 +
268 +-#define ioread16be(p) be16_to_cpu(ioread16(p))
269 +-#define ioread32be(p) be32_to_cpu(ioread32(p))
270 +-#define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
271 +-#define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
272 ++#define ioread16be(p) swab16(ioread16(p))
273 ++#define ioread32be(p) swab32(ioread32(p))
274 ++#define iowrite16be(v,p) iowrite16(swab16(v), (p))
275 ++#define iowrite32be(v,p) iowrite32(swab32(v), (p))
276 +
277 + #define inb_p inb
278 + #define inw_p inw
279 +diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
280 +index 1b179b1f46bc5..dd03d5e01a946 100644
281 +--- a/arch/arm/include/asm/kvm_host.h
282 ++++ b/arch/arm/include/asm/kvm_host.h
283 +@@ -266,7 +266,7 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
284 +
285 + #define KVM_ARCH_WANT_MMU_NOTIFIER
286 + int kvm_unmap_hva_range(struct kvm *kvm,
287 +- unsigned long start, unsigned long end);
288 ++ unsigned long start, unsigned long end, unsigned flags);
289 + int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
290 +
291 + unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
292 +diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
293 +index d65aef47ece3b..11a7d6208087f 100644
294 +--- a/arch/arm64/Makefile
295 ++++ b/arch/arm64/Makefile
296 +@@ -146,6 +146,7 @@ zinstall install:
297 + PHONY += vdso_install
298 + vdso_install:
299 + $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
300 ++ $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@
301 +
302 + # We use MRPROPER_FILES and CLEAN_FILES now
303 + archclean:
304 +diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
305 +index 0c3bd6aff6e91..d719c6b4dd81c 100644
306 +--- a/arch/arm64/include/asm/kvm_host.h
307 ++++ b/arch/arm64/include/asm/kvm_host.h
308 +@@ -427,7 +427,7 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
309 +
310 + #define KVM_ARCH_WANT_MMU_NOTIFIER
311 + int kvm_unmap_hva_range(struct kvm *kvm,
312 +- unsigned long start, unsigned long end);
313 ++ unsigned long start, unsigned long end, unsigned flags);
314 + int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
315 + int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
316 + int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
317 +diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
318 +index 76b327f88fbb1..40dffe60b8454 100644
319 +--- a/arch/arm64/kernel/vdso32/Makefile
320 ++++ b/arch/arm64/kernel/vdso32/Makefile
321 +@@ -190,7 +190,7 @@ quiet_cmd_vdsosym = VDSOSYM $@
322 + cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
323 +
324 + # Install commands for the unstripped file
325 +-quiet_cmd_vdso_install = INSTALL $@
326 ++quiet_cmd_vdso_install = INSTALL32 $@
327 + cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so
328 +
329 + vdso.so: $(obj)/vdso.so.dbg
330 +diff --git a/arch/m68k/include/asm/m53xxacr.h b/arch/m68k/include/asm/m53xxacr.h
331 +index 9138a624c5c81..692f90e7fecc1 100644
332 +--- a/arch/m68k/include/asm/m53xxacr.h
333 ++++ b/arch/m68k/include/asm/m53xxacr.h
334 +@@ -89,9 +89,9 @@
335 + * coherency though in all cases. And for copyback caches we will need
336 + * to push cached data as well.
337 + */
338 +-#define CACHE_INIT CACR_CINVA
339 +-#define CACHE_INVALIDATE CACR_CINVA
340 +-#define CACHE_INVALIDATED CACR_CINVA
341 ++#define CACHE_INIT (CACHE_MODE + CACR_CINVA - CACR_EC)
342 ++#define CACHE_INVALIDATE (CACHE_MODE + CACR_CINVA)
343 ++#define CACHE_INVALIDATED (CACHE_MODE + CACR_CINVA)
344 +
345 + #define ACR0_MODE ((CONFIG_RAMBASE & 0xff000000) + \
346 + (0x000f0000) + \
347 +diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
348 +index 7b47a323dc23e..356c61074d136 100644
349 +--- a/arch/mips/include/asm/kvm_host.h
350 ++++ b/arch/mips/include/asm/kvm_host.h
351 +@@ -939,7 +939,7 @@ enum kvm_mips_fault_result kvm_trap_emul_gva_fault(struct kvm_vcpu *vcpu,
352 +
353 + #define KVM_ARCH_WANT_MMU_NOTIFIER
354 + int kvm_unmap_hva_range(struct kvm *kvm,
355 +- unsigned long start, unsigned long end);
356 ++ unsigned long start, unsigned long end, unsigned flags);
357 + int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
358 + int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
359 + int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
360 +diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
361 +index 7b06e6ee6817d..b8884de89c81e 100644
362 +--- a/arch/mips/kernel/setup.c
363 ++++ b/arch/mips/kernel/setup.c
364 +@@ -494,7 +494,7 @@ static void __init mips_parse_crashkernel(void)
365 + if (ret != 0 || crash_size <= 0)
366 + return;
367 +
368 +- if (!memblock_find_in_range(crash_base, crash_base + crash_size, crash_size, 0)) {
369 ++ if (!memblock_find_in_range(crash_base, crash_base + crash_size, crash_size, 1)) {
370 + pr_warn("Invalid memory region reserved for crash kernel\n");
371 + return;
372 + }
373 +diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
374 +index 97e538a8c1be2..97f63a84aa51f 100644
375 +--- a/arch/mips/kvm/mmu.c
376 ++++ b/arch/mips/kvm/mmu.c
377 +@@ -512,7 +512,8 @@ static int kvm_unmap_hva_handler(struct kvm *kvm, gfn_t gfn, gfn_t gfn_end,
378 + return 1;
379 + }
380 +
381 +-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
382 ++int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
383 ++ unsigned flags)
384 + {
385 + handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL);
386 +
387 +diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
388 +index 6fe6ad64cba57..740b52ec35097 100644
389 +--- a/arch/powerpc/include/asm/kvm_host.h
390 ++++ b/arch/powerpc/include/asm/kvm_host.h
391 +@@ -58,7 +58,8 @@
392 + #define KVM_ARCH_WANT_MMU_NOTIFIER
393 +
394 + extern int kvm_unmap_hva_range(struct kvm *kvm,
395 +- unsigned long start, unsigned long end);
396 ++ unsigned long start, unsigned long end,
397 ++ unsigned flags);
398 + extern int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
399 + extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
400 + extern int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
401 +diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
402 +index ec2547cc5ecbe..1ff971f3b06f9 100644
403 +--- a/arch/powerpc/kvm/book3s.c
404 ++++ b/arch/powerpc/kvm/book3s.c
405 +@@ -867,7 +867,8 @@ void kvmppc_core_commit_memory_region(struct kvm *kvm,
406 + kvm->arch.kvm_ops->commit_memory_region(kvm, mem, old, new, change);
407 + }
408 +
409 +-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
410 ++int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
411 ++ unsigned flags)
412 + {
413 + return kvm->arch.kvm_ops->unmap_hva_range(kvm, start, end);
414 + }
415 +diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
416 +index 321db0fdb9db8..7154bd424d243 100644
417 +--- a/arch/powerpc/kvm/e500_mmu_host.c
418 ++++ b/arch/powerpc/kvm/e500_mmu_host.c
419 +@@ -734,7 +734,8 @@ static int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
420 + return 0;
421 + }
422 +
423 +-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
424 ++int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
425 ++ unsigned flags)
426 + {
427 + /* kvm_unmap_hva flushes everything anyways */
428 + kvm_unmap_hva(kvm, start);
429 +diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
430 +index 13ef77fd648f4..b3c4848869e52 100644
431 +--- a/arch/powerpc/platforms/pseries/ras.c
432 ++++ b/arch/powerpc/platforms/pseries/ras.c
433 +@@ -184,7 +184,6 @@ static void handle_system_shutdown(char event_modifier)
434 + case EPOW_SHUTDOWN_ON_UPS:
435 + pr_emerg("Loss of system power detected. System is running on"
436 + " UPS/battery. Check RTAS error log for details\n");
437 +- orderly_poweroff(true);
438 + break;
439 +
440 + case EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS:
441 +diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
442 +index 5aa786063eb3e..c6aef2ecf2890 100644
443 +--- a/arch/s390/kernel/ptrace.c
444 ++++ b/arch/s390/kernel/ptrace.c
445 +@@ -1283,7 +1283,6 @@ static bool is_ri_cb_valid(struct runtime_instr_cb *cb)
446 + cb->pc == 1 &&
447 + cb->qc == 0 &&
448 + cb->reserved2 == 0 &&
449 +- cb->key == PAGE_DEFAULT_KEY &&
450 + cb->reserved3 == 0 &&
451 + cb->reserved4 == 0 &&
452 + cb->reserved5 == 0 &&
453 +@@ -1347,7 +1346,11 @@ static int s390_runtime_instr_set(struct task_struct *target,
454 + kfree(data);
455 + return -EINVAL;
456 + }
457 +-
458 ++ /*
459 ++ * Override access key in any case, since user space should
460 ++ * not be able to set it, nor should it care about it.
461 ++ */
462 ++ ri_cb.key = PAGE_DEFAULT_KEY >> 4;
463 + preempt_disable();
464 + if (!target->thread.ri_cb)
465 + target->thread.ri_cb = data;
466 +diff --git a/arch/s390/kernel/runtime_instr.c b/arch/s390/kernel/runtime_instr.c
467 +index 125c7f6e87150..1788a5454b6fc 100644
468 +--- a/arch/s390/kernel/runtime_instr.c
469 ++++ b/arch/s390/kernel/runtime_instr.c
470 +@@ -57,7 +57,7 @@ static void init_runtime_instr_cb(struct runtime_instr_cb *cb)
471 + cb->k = 1;
472 + cb->ps = 1;
473 + cb->pc = 1;
474 +- cb->key = PAGE_DEFAULT_KEY;
475 ++ cb->key = PAGE_DEFAULT_KEY >> 4;
476 + cb->v = 1;
477 + }
478 +
479 +diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
480 +index 6b84afdd75382..98aac5b4bdb7e 100644
481 +--- a/arch/x86/boot/compressed/Makefile
482 ++++ b/arch/x86/boot/compressed/Makefile
483 +@@ -102,7 +102,7 @@ vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_thunk_$(BITS).o
484 + quiet_cmd_check_data_rel = DATAREL $@
485 + define cmd_check_data_rel
486 + for obj in $(filter %.o,$^); do \
487 +- ${CROSS_COMPILE}readelf -S $$obj | grep -qF .rel.local && { \
488 ++ $(READELF) -S $$obj | grep -qF .rel.local && { \
489 + echo "error: $$obj has data relocations!" >&2; \
490 + exit 1; \
491 + } || true; \
492 +diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
493 +index 742de9d97ba14..c41686641c3fb 100644
494 +--- a/arch/x86/include/asm/kvm_host.h
495 ++++ b/arch/x86/include/asm/kvm_host.h
496 +@@ -1553,7 +1553,8 @@ asmlinkage void kvm_spurious_fault(void);
497 + _ASM_EXTABLE(666b, 667b)
498 +
499 + #define KVM_ARCH_WANT_MMU_NOTIFIER
500 +-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end);
501 ++int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
502 ++ unsigned flags);
503 + int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
504 + int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
505 + int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
506 +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
507 +index 342d9ddf35c3a..bb743f956c232 100644
508 +--- a/arch/x86/kvm/mmu.c
509 ++++ b/arch/x86/kvm/mmu.c
510 +@@ -2045,7 +2045,8 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
511 + return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler);
512 + }
513 +
514 +-int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
515 ++int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end,
516 ++ unsigned flags)
517 + {
518 + return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp);
519 + }
520 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
521 +index 38b2df0e71096..8920ee7b28811 100644
522 +--- a/arch/x86/kvm/x86.c
523 ++++ b/arch/x86/kvm/x86.c
524 +@@ -972,7 +972,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
525 + {
526 + unsigned long old_cr4 = kvm_read_cr4(vcpu);
527 + unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE |
528 +- X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE;
529 ++ X86_CR4_SMEP;
530 +
531 + if (kvm_valid_cr4(vcpu, cr4))
532 + return 1;
533 +diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
534 +index 91220cc258547..5c11ae66b5d8e 100644
535 +--- a/arch/x86/pci/xen.c
536 ++++ b/arch/x86/pci/xen.c
537 +@@ -26,6 +26,7 @@
538 + #include <asm/xen/pci.h>
539 + #include <asm/xen/cpuid.h>
540 + #include <asm/apic.h>
541 ++#include <asm/acpi.h>
542 + #include <asm/i8259.h>
543 +
544 + static int xen_pcifront_enable_irq(struct pci_dev *dev)
545 +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
546 +index d3d7c4ef7d045..53dc0fd6f6d3c 100644
547 +--- a/drivers/cpufreq/intel_pstate.c
548 ++++ b/drivers/cpufreq/intel_pstate.c
549 +@@ -1571,6 +1571,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
550 +
551 + intel_pstate_get_hwp_max(cpu->cpu, &phy_max, &current_max);
552 + cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling;
553 ++ cpu->pstate.turbo_pstate = phy_max;
554 + } else {
555 + cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling;
556 + }
557 +diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
558 +index c1167ef5d2b35..b299e22b7532a 100644
559 +--- a/drivers/firmware/efi/efi.c
560 ++++ b/drivers/firmware/efi/efi.c
561 +@@ -345,6 +345,7 @@ static int __init efisubsys_init(void)
562 + efi_kobj = kobject_create_and_add("efi", firmware_kobj);
563 + if (!efi_kobj) {
564 + pr_err("efi: Firmware registration failed.\n");
565 ++ destroy_workqueue(efi_rts_wq);
566 + return -ENOMEM;
567 + }
568 +
569 +@@ -381,6 +382,7 @@ err_unregister:
570 + generic_ops_unregister();
571 + err_put:
572 + kobject_put(efi_kobj);
573 ++ destroy_workqueue(efi_rts_wq);
574 + return error;
575 + }
576 +
577 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
578 +index 6091194a3955c..2c0eb7140ca0e 100644
579 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
580 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
581 +@@ -1434,6 +1434,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
582 +
583 + drm_connector_update_edid_property(connector,
584 + aconnector->edid);
585 ++ drm_add_edid_modes(connector, aconnector->edid);
586 +
587 + if (aconnector->dc_link->aux_mode)
588 + drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
589 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
590 +index c13dce760098c..05b98eadc2899 100644
591 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
592 ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
593 +@@ -2845,7 +2845,7 @@ static bool dcn20_validate_bandwidth_internal(struct dc *dc, struct dc_state *co
594 + int vlevel = 0;
595 + int pipe_split_from[MAX_PIPES];
596 + int pipe_cnt = 0;
597 +- display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
598 ++ display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);
599 + DC_LOGGER_INIT(dc->ctx->logger);
600 +
601 + BW_VAL_TRACE_COUNT();
602 +diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h
603 +index 89ef9f6860e5b..16df2a485dd0d 100644
604 +--- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
605 ++++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
606 +@@ -431,6 +431,9 @@ struct fixed31_32 dc_fixpt_log(struct fixed31_32 arg);
607 + */
608 + static inline struct fixed31_32 dc_fixpt_pow(struct fixed31_32 arg1, struct fixed31_32 arg2)
609 + {
610 ++ if (arg1.value == 0)
611 ++ return arg2.value == 0 ? dc_fixpt_one : dc_fixpt_zero;
612 ++
613 + return dc_fixpt_exp(
614 + dc_fixpt_mul(
615 + dc_fixpt_log(arg1),
616 +diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
617 +index 46dc3de7e81bf..f2bad14ac04ab 100644
618 +--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
619 ++++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
620 +@@ -358,8 +358,10 @@ static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo,
621 + static int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
622 + void *buf, int len, int write)
623 + {
624 +- unsigned long offset = (addr) - vma->vm_start;
625 + struct ttm_buffer_object *bo = vma->vm_private_data;
626 ++ unsigned long offset = (addr) - vma->vm_start +
627 ++ ((vma->vm_pgoff - drm_vma_node_start(&bo->base.vma_node))
628 ++ << PAGE_SHIFT);
629 + int ret;
630 +
631 + if (len < 1 || (offset + len) >> PAGE_SHIFT > bo->num_pages)
632 +diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
633 +index 909eba43664a2..204d1df5a21d1 100644
634 +--- a/drivers/gpu/drm/vgem/vgem_drv.c
635 ++++ b/drivers/gpu/drm/vgem/vgem_drv.c
636 +@@ -229,32 +229,6 @@ static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
637 + return 0;
638 + }
639 +
640 +-static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
641 +- uint32_t handle, uint64_t *offset)
642 +-{
643 +- struct drm_gem_object *obj;
644 +- int ret;
645 +-
646 +- obj = drm_gem_object_lookup(file, handle);
647 +- if (!obj)
648 +- return -ENOENT;
649 +-
650 +- if (!obj->filp) {
651 +- ret = -EINVAL;
652 +- goto unref;
653 +- }
654 +-
655 +- ret = drm_gem_create_mmap_offset(obj);
656 +- if (ret)
657 +- goto unref;
658 +-
659 +- *offset = drm_vma_node_offset_addr(&obj->vma_node);
660 +-unref:
661 +- drm_gem_object_put_unlocked(obj);
662 +-
663 +- return ret;
664 +-}
665 +-
666 + static struct drm_ioctl_desc vgem_ioctls[] = {
667 + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, DRM_RENDER_ALLOW),
668 + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_RENDER_ALLOW),
669 +@@ -448,7 +422,6 @@ static struct drm_driver vgem_driver = {
670 + .fops = &vgem_driver_fops,
671 +
672 + .dumb_create = vgem_gem_dumb_create,
673 +- .dumb_map_offset = vgem_gem_dumb_map,
674 +
675 + .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
676 + .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
677 +diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
678 +index 27e2df44d043d..cfe5f47d9890e 100644
679 +--- a/drivers/infiniband/hw/bnxt_re/main.c
680 ++++ b/drivers/infiniband/hw/bnxt_re/main.c
681 +@@ -789,7 +789,8 @@ static int bnxt_re_handle_qp_async_event(struct creq_qp_event *qp_event,
682 + struct ib_event event;
683 + unsigned int flags;
684 +
685 +- if (qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_ERR) {
686 ++ if (qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_ERR &&
687 ++ rdma_is_kernel_res(&qp->ib_qp.res)) {
688 + flags = bnxt_re_lock_cqs(qp);
689 + bnxt_qplib_add_flush_qp(&qp->qplib_qp);
690 + bnxt_re_unlock_cqs(qp, flags);
691 +diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c
692 +index 7c6fd720fb2ea..c018fc633cca3 100644
693 +--- a/drivers/infiniband/hw/hfi1/tid_rdma.c
694 ++++ b/drivers/infiniband/hw/hfi1/tid_rdma.c
695 +@@ -3215,6 +3215,7 @@ bool hfi1_tid_rdma_wqe_interlock(struct rvt_qp *qp, struct rvt_swqe *wqe)
696 + case IB_WR_ATOMIC_CMP_AND_SWP:
697 + case IB_WR_ATOMIC_FETCH_AND_ADD:
698 + case IB_WR_RDMA_WRITE:
699 ++ case IB_WR_RDMA_WRITE_WITH_IMM:
700 + switch (prev->wr.opcode) {
701 + case IB_WR_TID_RDMA_WRITE:
702 + req = wqe_to_tid_req(prev);
703 +diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
704 +index 527ae0b9a191e..0b4a3039f312f 100644
705 +--- a/drivers/input/mouse/psmouse-base.c
706 ++++ b/drivers/input/mouse/psmouse-base.c
707 +@@ -2042,7 +2042,7 @@ static int psmouse_get_maxproto(char *buffer, const struct kernel_param *kp)
708 + {
709 + int type = *((unsigned int *)kp->arg);
710 +
711 +- return sprintf(buffer, "%s", psmouse_protocol_by_type(type)->name);
712 ++ return sprintf(buffer, "%s\n", psmouse_protocol_by_type(type)->name);
713 + }
714 +
715 + static int __init psmouse_init(void)
716 +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
717 +index 25ad64a3919f6..2cbfcd99b7ee7 100644
718 +--- a/drivers/md/bcache/super.c
719 ++++ b/drivers/md/bcache/super.c
720 +@@ -816,19 +816,19 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
721 + struct request_queue *q;
722 + const size_t max_stripes = min_t(size_t, INT_MAX,
723 + SIZE_MAX / sizeof(atomic_t));
724 +- size_t n;
725 ++ uint64_t n;
726 + int idx;
727 +
728 + if (!d->stripe_size)
729 + d->stripe_size = 1 << 31;
730 +
731 +- d->nr_stripes = DIV_ROUND_UP_ULL(sectors, d->stripe_size);
732 +-
733 +- if (!d->nr_stripes || d->nr_stripes > max_stripes) {
734 +- pr_err("nr_stripes too large or invalid: %u (start sector beyond end of disk?)",
735 +- (unsigned int)d->nr_stripes);
736 ++ n = DIV_ROUND_UP_ULL(sectors, d->stripe_size);
737 ++ if (!n || n > max_stripes) {
738 ++ pr_err("nr_stripes too large or invalid: %llu (start sector beyond end of disk?)\n",
739 ++ n);
740 + return -ENOMEM;
741 + }
742 ++ d->nr_stripes = n;
743 +
744 + n = d->nr_stripes * sizeof(atomic_t);
745 + d->stripe_sectors_dirty = kvzalloc(n, GFP_KERNEL);
746 +diff --git a/drivers/media/pci/ttpci/budget-core.c b/drivers/media/pci/ttpci/budget-core.c
747 +index fadbdeeb44955..293867b9e7961 100644
748 +--- a/drivers/media/pci/ttpci/budget-core.c
749 ++++ b/drivers/media/pci/ttpci/budget-core.c
750 +@@ -369,20 +369,25 @@ static int budget_register(struct budget *budget)
751 + ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->hw_frontend);
752 +
753 + if (ret < 0)
754 +- return ret;
755 ++ goto err_release_dmx;
756 +
757 + budget->mem_frontend.source = DMX_MEMORY_FE;
758 + ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->mem_frontend);
759 + if (ret < 0)
760 +- return ret;
761 ++ goto err_release_dmx;
762 +
763 + ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, &budget->hw_frontend);
764 + if (ret < 0)
765 +- return ret;
766 ++ goto err_release_dmx;
767 +
768 + dvb_net_init(&budget->dvb_adapter, &budget->dvb_net, &dvbdemux->dmx);
769 +
770 + return 0;
771 ++
772 ++err_release_dmx:
773 ++ dvb_dmxdev_release(&budget->dmxdev);
774 ++ dvb_dmx_release(&budget->demux);
775 ++ return ret;
776 + }
777 +
778 + static void budget_unregister(struct budget *budget)
779 +diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
780 +index d38d2bbb6f0f8..7000f0bf0b353 100644
781 +--- a/drivers/media/platform/davinci/vpss.c
782 ++++ b/drivers/media/platform/davinci/vpss.c
783 +@@ -505,19 +505,31 @@ static void vpss_exit(void)
784 +
785 + static int __init vpss_init(void)
786 + {
787 ++ int ret;
788 ++
789 + if (!request_mem_region(VPSS_CLK_CTRL, 4, "vpss_clock_control"))
790 + return -EBUSY;
791 +
792 + oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
793 + if (unlikely(!oper_cfg.vpss_regs_base2)) {
794 +- release_mem_region(VPSS_CLK_CTRL, 4);
795 +- return -ENOMEM;
796 ++ ret = -ENOMEM;
797 ++ goto err_ioremap;
798 + }
799 +
800 + writel(VPSS_CLK_CTRL_VENCCLKEN |
801 +- VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
802 ++ VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
803 ++
804 ++ ret = platform_driver_register(&vpss_driver);
805 ++ if (ret)
806 ++ goto err_pd_register;
807 ++
808 ++ return 0;
809 +
810 +- return platform_driver_register(&vpss_driver);
811 ++err_pd_register:
812 ++ iounmap(oper_cfg.vpss_regs_base2);
813 ++err_ioremap:
814 ++ release_mem_region(VPSS_CLK_CTRL, 4);
815 ++ return ret;
816 + }
817 + subsys_initcall(vpss_init);
818 + module_exit(vpss_exit);
819 +diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
820 +index 3fdc9f964a3c6..2483641799dfb 100644
821 +--- a/drivers/media/platform/qcom/camss/camss.c
822 ++++ b/drivers/media/platform/qcom/camss/camss.c
823 +@@ -504,7 +504,6 @@ static int camss_of_parse_ports(struct camss *camss)
824 + return num_subdevs;
825 +
826 + err_cleanup:
827 +- v4l2_async_notifier_cleanup(&camss->notifier);
828 + of_node_put(node);
829 + return ret;
830 + }
831 +@@ -835,29 +834,38 @@ static int camss_probe(struct platform_device *pdev)
832 + camss->csid_num = 4;
833 + camss->vfe_num = 2;
834 + } else {
835 +- return -EINVAL;
836 ++ ret = -EINVAL;
837 ++ goto err_free;
838 + }
839 +
840 + camss->csiphy = devm_kcalloc(dev, camss->csiphy_num,
841 + sizeof(*camss->csiphy), GFP_KERNEL);
842 +- if (!camss->csiphy)
843 +- return -ENOMEM;
844 ++ if (!camss->csiphy) {
845 ++ ret = -ENOMEM;
846 ++ goto err_free;
847 ++ }
848 +
849 + camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid),
850 + GFP_KERNEL);
851 +- if (!camss->csid)
852 +- return -ENOMEM;
853 ++ if (!camss->csid) {
854 ++ ret = -ENOMEM;
855 ++ goto err_free;
856 ++ }
857 +
858 + camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
859 + GFP_KERNEL);
860 +- if (!camss->vfe)
861 +- return -ENOMEM;
862 ++ if (!camss->vfe) {
863 ++ ret = -ENOMEM;
864 ++ goto err_free;
865 ++ }
866 +
867 + v4l2_async_notifier_init(&camss->notifier);
868 +
869 + num_subdevs = camss_of_parse_ports(camss);
870 +- if (num_subdevs < 0)
871 +- return num_subdevs;
872 ++ if (num_subdevs < 0) {
873 ++ ret = num_subdevs;
874 ++ goto err_cleanup;
875 ++ }
876 +
877 + ret = camss_init_subdevices(camss);
878 + if (ret < 0)
879 +@@ -936,6 +944,8 @@ err_register_entities:
880 + v4l2_device_unregister(&camss->v4l2_dev);
881 + err_cleanup:
882 + v4l2_async_notifier_cleanup(&camss->notifier);
883 ++err_free:
884 ++ kfree(camss);
885 +
886 + return ret;
887 + }
888 +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
889 +index 499845c32b1bc..0d7a173f8e61c 100644
890 +--- a/drivers/net/bonding/bond_main.c
891 ++++ b/drivers/net/bonding/bond_main.c
892 +@@ -2037,7 +2037,8 @@ static int bond_release_and_destroy(struct net_device *bond_dev,
893 + int ret;
894 +
895 + ret = __bond_release_one(bond_dev, slave_dev, false, true);
896 +- if (ret == 0 && !bond_has_slaves(bond)) {
897 ++ if (ret == 0 && !bond_has_slaves(bond) &&
898 ++ bond_dev->reg_state != NETREG_UNREGISTERING) {
899 + bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
900 + netdev_info(bond_dev, "Destroying bond\n");
901 + bond_remove_proc_entry(bond);
902 +@@ -2777,6 +2778,9 @@ static int bond_ab_arp_inspect(struct bonding *bond)
903 + if (bond_time_in_interval(bond, last_rx, 1)) {
904 + bond_propose_link_state(slave, BOND_LINK_UP);
905 + commit++;
906 ++ } else if (slave->link == BOND_LINK_BACK) {
907 ++ bond_propose_link_state(slave, BOND_LINK_FAIL);
908 ++ commit++;
909 + }
910 + continue;
911 + }
912 +@@ -2885,6 +2889,19 @@ static void bond_ab_arp_commit(struct bonding *bond)
913 +
914 + continue;
915 +
916 ++ case BOND_LINK_FAIL:
917 ++ bond_set_slave_link_state(slave, BOND_LINK_FAIL,
918 ++ BOND_SLAVE_NOTIFY_NOW);
919 ++ bond_set_slave_inactive_flags(slave,
920 ++ BOND_SLAVE_NOTIFY_NOW);
921 ++
922 ++ /* A slave has just been enslaved and has become
923 ++ * the current active slave.
924 ++ */
925 ++ if (rtnl_dereference(bond->curr_active_slave))
926 ++ RCU_INIT_POINTER(bond->current_arp_slave, NULL);
927 ++ continue;
928 ++
929 + default:
930 + slave_err(bond->dev, slave->dev,
931 + "impossible: link_new_state %d on slave\n",
932 +@@ -2935,8 +2952,6 @@ static bool bond_ab_arp_probe(struct bonding *bond)
933 + return should_notify_rtnl;
934 + }
935 +
936 +- bond_set_slave_inactive_flags(curr_arp_slave, BOND_SLAVE_NOTIFY_LATER);
937 +-
938 + bond_for_each_slave_rcu(bond, slave, iter) {
939 + if (!found && !before && bond_slave_is_up(slave))
940 + before = slave;
941 +@@ -4246,13 +4261,23 @@ static netdev_tx_t bond_start_xmit(struct sk_buff *skb, struct net_device *dev)
942 + return ret;
943 + }
944 +
945 ++static u32 bond_mode_bcast_speed(struct slave *slave, u32 speed)
946 ++{
947 ++ if (speed == 0 || speed == SPEED_UNKNOWN)
948 ++ speed = slave->speed;
949 ++ else
950 ++ speed = min(speed, slave->speed);
951 ++
952 ++ return speed;
953 ++}
954 ++
955 + static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
956 + struct ethtool_link_ksettings *cmd)
957 + {
958 + struct bonding *bond = netdev_priv(bond_dev);
959 +- unsigned long speed = 0;
960 + struct list_head *iter;
961 + struct slave *slave;
962 ++ u32 speed = 0;
963 +
964 + cmd->base.duplex = DUPLEX_UNKNOWN;
965 + cmd->base.port = PORT_OTHER;
966 +@@ -4264,8 +4289,13 @@ static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
967 + */
968 + bond_for_each_slave(bond, slave, iter) {
969 + if (bond_slave_can_tx(slave)) {
970 +- if (slave->speed != SPEED_UNKNOWN)
971 +- speed += slave->speed;
972 ++ if (slave->speed != SPEED_UNKNOWN) {
973 ++ if (BOND_MODE(bond) == BOND_MODE_BROADCAST)
974 ++ speed = bond_mode_bcast_speed(slave,
975 ++ speed);
976 ++ else
977 ++ speed += slave->speed;
978 ++ }
979 + if (cmd->base.duplex == DUPLEX_UNKNOWN &&
980 + slave->duplex != DUPLEX_UNKNOWN)
981 + cmd->base.duplex = slave->duplex;
982 +diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
983 +index 14850b7fe6d7f..4bd66ba72c03c 100644
984 +--- a/drivers/net/dsa/b53/b53_common.c
985 ++++ b/drivers/net/dsa/b53/b53_common.c
986 +@@ -1523,6 +1523,8 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
987 + return ret;
988 +
989 + switch (ret) {
990 ++ case -ETIMEDOUT:
991 ++ return ret;
992 + case -ENOSPC:
993 + dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n",
994 + addr, vid);
995 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
996 +index 26325f7b3c1fa..4d0d13d5d0998 100644
997 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
998 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
999 +@@ -2835,16 +2835,14 @@ static void ena_fw_reset_device(struct work_struct *work)
1000 + {
1001 + struct ena_adapter *adapter =
1002 + container_of(work, struct ena_adapter, reset_task);
1003 +- struct pci_dev *pdev = adapter->pdev;
1004 +
1005 +- if (unlikely(!test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
1006 +- dev_err(&pdev->dev,
1007 +- "device reset schedule while reset bit is off\n");
1008 +- return;
1009 +- }
1010 + rtnl_lock();
1011 +- ena_destroy_device(adapter, false);
1012 +- ena_restore_device(adapter);
1013 ++
1014 ++ if (likely(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
1015 ++ ena_destroy_device(adapter, false);
1016 ++ ena_restore_device(adapter);
1017 ++ }
1018 ++
1019 + rtnl_unlock();
1020 + }
1021 +
1022 +@@ -3675,8 +3673,11 @@ static void __ena_shutoff(struct pci_dev *pdev, bool shutdown)
1023 + netdev->rx_cpu_rmap = NULL;
1024 + }
1025 + #endif /* CONFIG_RFS_ACCEL */
1026 +- del_timer_sync(&adapter->timer_service);
1027 +
1028 ++ /* Make sure timer and reset routine won't be called after
1029 ++ * freeing device resources.
1030 ++ */
1031 ++ del_timer_sync(&adapter->timer_service);
1032 + cancel_work_sync(&adapter->reset_task);
1033 +
1034 + rtnl_lock(); /* lock released inside the below if-else block */
1035 +diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
1036 +index 01ae113f122a0..28d4c54505f9a 100644
1037 +--- a/drivers/net/ethernet/cortina/gemini.c
1038 ++++ b/drivers/net/ethernet/cortina/gemini.c
1039 +@@ -2388,7 +2388,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
1040 +
1041 + dev_info(dev, "probe %s ID %d\n", dev_name(dev), id);
1042 +
1043 +- netdev = alloc_etherdev_mq(sizeof(*port), TX_QUEUE_NUM);
1044 ++ netdev = devm_alloc_etherdev_mqs(dev, sizeof(*port), TX_QUEUE_NUM, TX_QUEUE_NUM);
1045 + if (!netdev) {
1046 + dev_err(dev, "Can't allocate ethernet device #%d\n", id);
1047 + return -ENOMEM;
1048 +@@ -2520,7 +2520,6 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
1049 + }
1050 +
1051 + port->netdev = NULL;
1052 +- free_netdev(netdev);
1053 + return ret;
1054 + }
1055 +
1056 +@@ -2529,7 +2528,6 @@ static int gemini_ethernet_port_remove(struct platform_device *pdev)
1057 + struct gemini_ethernet_port *port = platform_get_drvdata(pdev);
1058 +
1059 + gemini_port_remove(port);
1060 +- free_netdev(port->netdev);
1061 + return 0;
1062 + }
1063 +
1064 +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
1065 +index 39c112f1543c1..a0e4b12ac4ea2 100644
1066 +--- a/drivers/net/ethernet/freescale/fec_main.c
1067 ++++ b/drivers/net/ethernet/freescale/fec_main.c
1068 +@@ -3707,11 +3707,11 @@ failed_mii_init:
1069 + failed_irq:
1070 + failed_init:
1071 + fec_ptp_stop(pdev);
1072 +- if (fep->reg_phy)
1073 +- regulator_disable(fep->reg_phy);
1074 + failed_reset:
1075 + pm_runtime_put_noidle(&pdev->dev);
1076 + pm_runtime_disable(&pdev->dev);
1077 ++ if (fep->reg_phy)
1078 ++ regulator_disable(fep->reg_phy);
1079 + failed_regulator:
1080 + clk_disable_unprepare(fep->clk_ahb);
1081 + failed_clk_ahb:
1082 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
1083 +index 69a2daaca5c56..d7684ac2522ef 100644
1084 +--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
1085 ++++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
1086 +@@ -1211,7 +1211,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes {
1087 + #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04
1088 + #define I40E_AQC_SET_VSI_DEFAULT 0x08
1089 + #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10
1090 +-#define I40E_AQC_SET_VSI_PROMISC_TX 0x8000
1091 ++#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY 0x8000
1092 + __le16 seid;
1093 + #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF
1094 + __le16 vlan_tag;
1095 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
1096 +index 3160b5bbe6728..66f7deaf46ae2 100644
1097 +--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
1098 ++++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
1099 +@@ -1949,6 +1949,21 @@ i40e_status i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
1100 + return status;
1101 + }
1102 +
1103 ++/**
1104 ++ * i40e_is_aq_api_ver_ge
1105 ++ * @aq: pointer to AdminQ info containing HW API version to compare
1106 ++ * @maj: API major value
1107 ++ * @min: API minor value
1108 ++ *
1109 ++ * Assert whether current HW API version is greater/equal than provided.
1110 ++ **/
1111 ++static bool i40e_is_aq_api_ver_ge(struct i40e_adminq_info *aq, u16 maj,
1112 ++ u16 min)
1113 ++{
1114 ++ return (aq->api_maj_ver > maj ||
1115 ++ (aq->api_maj_ver == maj && aq->api_min_ver >= min));
1116 ++}
1117 ++
1118 + /**
1119 + * i40e_aq_add_vsi
1120 + * @hw: pointer to the hw struct
1121 +@@ -2074,18 +2089,16 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw,
1122 +
1123 + if (set) {
1124 + flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
1125 +- if (rx_only_promisc &&
1126 +- (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) ||
1127 +- (hw->aq.api_maj_ver > 1)))
1128 +- flags |= I40E_AQC_SET_VSI_PROMISC_TX;
1129 ++ if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1130 ++ flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
1131 + }
1132 +
1133 + cmd->promiscuous_flags = cpu_to_le16(flags);
1134 +
1135 + cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
1136 +- if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) ||
1137 +- (hw->aq.api_maj_ver > 1))
1138 +- cmd->valid_flags |= cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_TX);
1139 ++ if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1140 ++ cmd->valid_flags |=
1141 ++ cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
1142 +
1143 + cmd->seid = cpu_to_le16(seid);
1144 + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
1145 +@@ -2182,11 +2195,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,
1146 + i40e_fill_default_direct_cmd_desc(&desc,
1147 + i40e_aqc_opc_set_vsi_promiscuous_modes);
1148 +
1149 +- if (enable)
1150 ++ if (enable) {
1151 + flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST;
1152 ++ if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1153 ++ flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY;
1154 ++ }
1155 +
1156 + cmd->promiscuous_flags = cpu_to_le16(flags);
1157 + cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST);
1158 ++ if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5))
1159 ++ cmd->valid_flags |=
1160 ++ cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY);
1161 + cmd->seid = cpu_to_le16(seid);
1162 + cmd->vlan_tag = cpu_to_le16(vid | I40E_AQC_SET_VSI_VLAN_VALID);
1163 +
1164 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
1165 +index 095ed81cc0ba4..b3c3911adfc2e 100644
1166 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
1167 ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
1168 +@@ -15342,6 +15342,9 @@ static void i40e_remove(struct pci_dev *pdev)
1169 + i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), 0);
1170 + i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), 0);
1171 +
1172 ++ while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))
1173 ++ usleep_range(1000, 2000);
1174 ++
1175 + /* no more scheduling of any task */
1176 + set_bit(__I40E_SUSPENDED, pf->state);
1177 + set_bit(__I40E_DOWN, pf->state);
1178 +diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
1179 +index 24bb721a12bc0..42eb7a7ecd96b 100644
1180 +--- a/drivers/net/hyperv/netvsc_drv.c
1181 ++++ b/drivers/net/hyperv/netvsc_drv.c
1182 +@@ -501,7 +501,7 @@ static int netvsc_vf_xmit(struct net_device *net, struct net_device *vf_netdev,
1183 + int rc;
1184 +
1185 + skb->dev = vf_netdev;
1186 +- skb->queue_mapping = qdisc_skb_cb(skb)->slave_dev_queue_mapping;
1187 ++ skb_record_rx_queue(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping);
1188 +
1189 + rc = dev_queue_xmit(skb);
1190 + if (likely(rc == NET_XMIT_SUCCESS || rc == NET_XMIT_CN)) {
1191 +diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
1192 +index dd1a147f29716..058d77d2e693d 100644
1193 +--- a/drivers/net/wan/Kconfig
1194 ++++ b/drivers/net/wan/Kconfig
1195 +@@ -200,7 +200,7 @@ config WANXL_BUILD_FIRMWARE
1196 + depends on WANXL && !PREVENT_FIRMWARE_BUILD
1197 + help
1198 + Allows you to rebuild firmware run by the QUICC processor.
1199 +- It requires as68k, ld68k and hexdump programs.
1200 ++ It requires m68k toolchains and hexdump programs.
1201 +
1202 + You should never need this option, say N.
1203 +
1204 +diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
1205 +index 701f5d2fe3b61..cf7a0a65aae8d 100644
1206 +--- a/drivers/net/wan/Makefile
1207 ++++ b/drivers/net/wan/Makefile
1208 +@@ -40,17 +40,17 @@ $(obj)/wanxl.o: $(obj)/wanxlfw.inc
1209 +
1210 + ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
1211 + ifeq ($(ARCH),m68k)
1212 +- AS68K = $(AS)
1213 +- LD68K = $(LD)
1214 ++ M68KCC = $(CC)
1215 ++ M68KLD = $(LD)
1216 + else
1217 +- AS68K = as68k
1218 +- LD68K = ld68k
1219 ++ M68KCC = $(CROSS_COMPILE_M68K)gcc
1220 ++ M68KLD = $(CROSS_COMPILE_M68K)ld
1221 + endif
1222 +
1223 + quiet_cmd_build_wanxlfw = BLD FW $@
1224 + cmd_build_wanxlfw = \
1225 +- $(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
1226 +- $(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
1227 ++ $(M68KCC) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $(obj)/wanxlfw.o $<; \
1228 ++ $(M68KLD) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
1229 + hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
1230 + rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
1231 +
1232 +diff --git a/drivers/opp/core.c b/drivers/opp/core.c
1233 +index 9ff0538ee83a0..7b057c32e11b1 100644
1234 +--- a/drivers/opp/core.c
1235 ++++ b/drivers/opp/core.c
1236 +@@ -843,10 +843,12 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
1237 +
1238 + /* Return early if nothing to do */
1239 + if (old_freq == freq) {
1240 +- dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
1241 +- __func__, freq);
1242 +- ret = 0;
1243 +- goto put_opp_table;
1244 ++ if (!opp_table->required_opp_tables && !opp_table->regulators) {
1245 ++ dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
1246 ++ __func__, freq);
1247 ++ ret = 0;
1248 ++ goto put_opp_table;
1249 ++ }
1250 + }
1251 +
1252 + temp_freq = old_freq;
1253 +diff --git a/drivers/rtc/rtc-goldfish.c b/drivers/rtc/rtc-goldfish.c
1254 +index 1a3420ee6a4d9..d5083b013fbce 100644
1255 +--- a/drivers/rtc/rtc-goldfish.c
1256 ++++ b/drivers/rtc/rtc-goldfish.c
1257 +@@ -73,6 +73,7 @@ static int goldfish_rtc_set_alarm(struct device *dev,
1258 + rtc_alarm64 = rtc_tm_to_time64(&alrm->time) * NSEC_PER_SEC;
1259 + writel((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
1260 + writel(rtc_alarm64, base + TIMER_ALARM_LOW);
1261 ++ writel(1, base + TIMER_IRQ_ENABLED);
1262 + } else {
1263 + /*
1264 + * if this function was called with enabled=0
1265 +diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
1266 +index cf63916814cca..5c652deb6fed4 100644
1267 +--- a/drivers/s390/scsi/zfcp_fsf.c
1268 ++++ b/drivers/s390/scsi/zfcp_fsf.c
1269 +@@ -409,7 +409,7 @@ static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
1270 + return;
1271 + }
1272 +
1273 +- del_timer(&req->timer);
1274 ++ del_timer_sync(&req->timer);
1275 + zfcp_fsf_protstatus_eval(req);
1276 + zfcp_fsf_fsfstatus_eval(req);
1277 + req->handler(req);
1278 +@@ -762,7 +762,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
1279 + req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free);
1280 + req->issued = get_tod_clock();
1281 + if (zfcp_qdio_send(qdio, &req->qdio_req)) {
1282 +- del_timer(&req->timer);
1283 ++ del_timer_sync(&req->timer);
1284 + /* lookup request again, list might have changed */
1285 + zfcp_reqlist_find_rm(adapter->req_list, req_id);
1286 + zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1");
1287 +diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
1288 +index 2b865c6423e29..e00dc4693fcbd 100644
1289 +--- a/drivers/scsi/libfc/fc_disc.c
1290 ++++ b/drivers/scsi/libfc/fc_disc.c
1291 +@@ -581,8 +581,12 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1292 +
1293 + if (PTR_ERR(fp) == -FC_EX_CLOSED)
1294 + goto out;
1295 +- if (IS_ERR(fp))
1296 +- goto redisc;
1297 ++ if (IS_ERR(fp)) {
1298 ++ mutex_lock(&disc->disc_mutex);
1299 ++ fc_disc_restart(disc);
1300 ++ mutex_unlock(&disc->disc_mutex);
1301 ++ goto out;
1302 ++ }
1303 +
1304 + cp = fc_frame_payload_get(fp, sizeof(*cp));
1305 + if (!cp)
1306 +@@ -609,7 +613,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1307 + new_rdata->disc_id = disc->disc_id;
1308 + fc_rport_login(new_rdata);
1309 + }
1310 +- goto out;
1311 ++ goto free_fp;
1312 + }
1313 + rdata->disc_id = disc->disc_id;
1314 + mutex_unlock(&rdata->rp_mutex);
1315 +@@ -626,6 +630,8 @@ redisc:
1316 + fc_disc_restart(disc);
1317 + mutex_unlock(&disc->disc_mutex);
1318 + }
1319 ++free_fp:
1320 ++ fc_frame_free(fp);
1321 + out:
1322 + kref_put(&rdata->kref, fc_rport_destroy);
1323 + if (!IS_ERR(fp))
1324 +diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
1325 +index d7ec4083a0911..d91c95d9981ac 100644
1326 +--- a/drivers/scsi/qla2xxx/qla_os.c
1327 ++++ b/drivers/scsi/qla2xxx/qla_os.c
1328 +@@ -2804,10 +2804,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1329 + /* This may fail but that's ok */
1330 + pci_enable_pcie_error_reporting(pdev);
1331 +
1332 +- /* Turn off T10-DIF when FC-NVMe is enabled */
1333 +- if (ql2xnvmeenable)
1334 +- ql2xenabledif = 0;
1335 +-
1336 + ha = kzalloc(sizeof(struct qla_hw_data), GFP_KERNEL);
1337 + if (!ha) {
1338 + ql_log_pci(ql_log_fatal, pdev, 0x0009,
1339 +diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h
1340 +index fe6cad9b2a0d2..03985919150b9 100644
1341 +--- a/drivers/scsi/ufs/ufs_quirks.h
1342 ++++ b/drivers/scsi/ufs/ufs_quirks.h
1343 +@@ -12,6 +12,7 @@
1344 + #define UFS_ANY_VENDOR 0xFFFF
1345 + #define UFS_ANY_MODEL "ANY_MODEL"
1346 +
1347 ++#define UFS_VENDOR_MICRON 0x12C
1348 + #define UFS_VENDOR_TOSHIBA 0x198
1349 + #define UFS_VENDOR_SAMSUNG 0x1CE
1350 + #define UFS_VENDOR_SKHYNIX 0x1AD
1351 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
1352 +index 2b6853c7375c9..b41b88bcab3d9 100644
1353 +--- a/drivers/scsi/ufs/ufshcd.c
1354 ++++ b/drivers/scsi/ufs/ufshcd.c
1355 +@@ -217,6 +217,8 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,
1356 +
1357 + static struct ufs_dev_fix ufs_fixups[] = {
1358 + /* UFS cards deviations table */
1359 ++ UFS_FIX(UFS_VENDOR_MICRON, UFS_ANY_MODEL,
1360 ++ UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
1361 + UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
1362 + UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
1363 + UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
1364 +diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
1365 +index 6f7fdcbb9151f..5bf7542087776 100644
1366 +--- a/drivers/spi/Kconfig
1367 ++++ b/drivers/spi/Kconfig
1368 +@@ -944,4 +944,7 @@ config SPI_SLAVE_SYSTEM_CONTROL
1369 +
1370 + endif # SPI_SLAVE
1371 +
1372 ++config SPI_DYNAMIC
1373 ++ def_bool ACPI || OF_DYNAMIC || SPI_SLAVE
1374 ++
1375 + endif # SPI
1376 +diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
1377 +index b222ce8d083ef..7e92ab0cc9920 100644
1378 +--- a/drivers/spi/spi-stm32.c
1379 ++++ b/drivers/spi/spi-stm32.c
1380 +@@ -14,6 +14,7 @@
1381 + #include <linux/iopoll.h>
1382 + #include <linux/module.h>
1383 + #include <linux/of_platform.h>
1384 ++#include <linux/pinctrl/consumer.h>
1385 + #include <linux/pm_runtime.h>
1386 + #include <linux/reset.h>
1387 + #include <linux/spi/spi.h>
1388 +@@ -1986,6 +1987,8 @@ static int stm32_spi_remove(struct platform_device *pdev)
1389 +
1390 + pm_runtime_disable(&pdev->dev);
1391 +
1392 ++ pinctrl_pm_select_sleep_state(&pdev->dev);
1393 ++
1394 + return 0;
1395 + }
1396 +
1397 +@@ -1997,13 +2000,18 @@ static int stm32_spi_runtime_suspend(struct device *dev)
1398 +
1399 + clk_disable_unprepare(spi->clk);
1400 +
1401 +- return 0;
1402 ++ return pinctrl_pm_select_sleep_state(dev);
1403 + }
1404 +
1405 + static int stm32_spi_runtime_resume(struct device *dev)
1406 + {
1407 + struct spi_master *master = dev_get_drvdata(dev);
1408 + struct stm32_spi *spi = spi_master_get_devdata(master);
1409 ++ int ret;
1410 ++
1411 ++ ret = pinctrl_pm_select_default_state(dev);
1412 ++ if (ret)
1413 ++ return ret;
1414 +
1415 + return clk_prepare_enable(spi->clk);
1416 + }
1417 +@@ -2033,10 +2041,23 @@ static int stm32_spi_resume(struct device *dev)
1418 + return ret;
1419 +
1420 + ret = spi_master_resume(master);
1421 +- if (ret)
1422 ++ if (ret) {
1423 + clk_disable_unprepare(spi->clk);
1424 ++ return ret;
1425 ++ }
1426 +
1427 +- return ret;
1428 ++ ret = pm_runtime_get_sync(dev);
1429 ++ if (ret) {
1430 ++ dev_err(dev, "Unable to power device:%d\n", ret);
1431 ++ return ret;
1432 ++ }
1433 ++
1434 ++ spi->cfg->config(spi);
1435 ++
1436 ++ pm_runtime_mark_last_busy(dev);
1437 ++ pm_runtime_put_autosuspend(dev);
1438 ++
1439 ++ return 0;
1440 + }
1441 + #endif
1442 +
1443 +diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
1444 +index c6242f0a307f9..6a81b2a33cb4b 100644
1445 +--- a/drivers/spi/spi.c
1446 ++++ b/drivers/spi/spi.c
1447 +@@ -475,6 +475,12 @@ static LIST_HEAD(spi_controller_list);
1448 + */
1449 + static DEFINE_MUTEX(board_lock);
1450 +
1451 ++/*
1452 ++ * Prevents addition of devices with same chip select and
1453 ++ * addition of devices below an unregistering controller.
1454 ++ */
1455 ++static DEFINE_MUTEX(spi_add_lock);
1456 ++
1457 + /**
1458 + * spi_alloc_device - Allocate a new SPI device
1459 + * @ctlr: Controller to which device is connected
1460 +@@ -553,7 +559,6 @@ static int spi_dev_check(struct device *dev, void *data)
1461 + */
1462 + int spi_add_device(struct spi_device *spi)
1463 + {
1464 +- static DEFINE_MUTEX(spi_add_lock);
1465 + struct spi_controller *ctlr = spi->controller;
1466 + struct device *dev = ctlr->dev.parent;
1467 + int status;
1468 +@@ -581,6 +586,13 @@ int spi_add_device(struct spi_device *spi)
1469 + goto done;
1470 + }
1471 +
1472 ++ /* Controller may unregister concurrently */
1473 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC) &&
1474 ++ !device_is_registered(&ctlr->dev)) {
1475 ++ status = -ENODEV;
1476 ++ goto done;
1477 ++ }
1478 ++
1479 + /* Descriptors take precedence */
1480 + if (ctlr->cs_gpiods)
1481 + spi->cs_gpiod = ctlr->cs_gpiods[spi->chip_select];
1482 +@@ -2582,6 +2594,10 @@ void spi_unregister_controller(struct spi_controller *ctlr)
1483 + struct spi_controller *found;
1484 + int id = ctlr->bus_num;
1485 +
1486 ++ /* Prevent addition of new devices, unregister existing ones */
1487 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
1488 ++ mutex_lock(&spi_add_lock);
1489 ++
1490 + device_for_each_child(&ctlr->dev, NULL, __unregister);
1491 +
1492 + /* First make sure that this controller was ever added */
1493 +@@ -2602,6 +2618,9 @@ void spi_unregister_controller(struct spi_controller *ctlr)
1494 + if (found == ctlr)
1495 + idr_remove(&spi_master_idr, id);
1496 + mutex_unlock(&board_lock);
1497 ++
1498 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
1499 ++ mutex_unlock(&spi_add_lock);
1500 + }
1501 + EXPORT_SYMBOL_GPL(spi_unregister_controller);
1502 +
1503 +diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
1504 +index a497e7c1f4fcc..d766fb14942b3 100644
1505 +--- a/drivers/target/target_core_user.c
1506 ++++ b/drivers/target/target_core_user.c
1507 +@@ -601,7 +601,7 @@ static inline void tcmu_flush_dcache_range(void *vaddr, size_t size)
1508 + size = round_up(size+offset, PAGE_SIZE);
1509 +
1510 + while (size) {
1511 +- flush_dcache_page(virt_to_page(start));
1512 ++ flush_dcache_page(vmalloc_to_page(start));
1513 + start += PAGE_SIZE;
1514 + size -= PAGE_SIZE;
1515 + }
1516 +diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
1517 +index 6cc47af1f06d3..ca8c10aa4a4bc 100644
1518 +--- a/drivers/vfio/vfio_iommu_type1.c
1519 ++++ b/drivers/vfio/vfio_iommu_type1.c
1520 +@@ -1187,13 +1187,16 @@ static int vfio_bus_type(struct device *dev, void *data)
1521 + static int vfio_iommu_replay(struct vfio_iommu *iommu,
1522 + struct vfio_domain *domain)
1523 + {
1524 +- struct vfio_domain *d;
1525 ++ struct vfio_domain *d = NULL;
1526 + struct rb_node *n;
1527 + unsigned long limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
1528 + int ret;
1529 +
1530 + /* Arbitrarily pick the first domain in the list for lookups */
1531 +- d = list_first_entry(&iommu->domain_list, struct vfio_domain, next);
1532 ++ if (!list_empty(&iommu->domain_list))
1533 ++ d = list_first_entry(&iommu->domain_list,
1534 ++ struct vfio_domain, next);
1535 ++
1536 + n = rb_first(&iommu->dma_list);
1537 +
1538 + for (; n; n = rb_next(n)) {
1539 +@@ -1211,6 +1214,11 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
1540 + phys_addr_t p;
1541 + dma_addr_t i;
1542 +
1543 ++ if (WARN_ON(!d)) { /* mapped w/o a domain?! */
1544 ++ ret = -EINVAL;
1545 ++ goto unwind;
1546 ++ }
1547 ++
1548 + phys = iommu_iova_to_phys(d->domain, iova);
1549 +
1550 + if (WARN_ON(!phys)) {
1551 +@@ -1240,7 +1248,7 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
1552 + if (npage <= 0) {
1553 + WARN_ON(!npage);
1554 + ret = (int)npage;
1555 +- return ret;
1556 ++ goto unwind;
1557 + }
1558 +
1559 + phys = pfn << PAGE_SHIFT;
1560 +@@ -1249,14 +1257,67 @@ static int vfio_iommu_replay(struct vfio_iommu *iommu,
1561 +
1562 + ret = iommu_map(domain->domain, iova, phys,
1563 + size, dma->prot | domain->prot);
1564 +- if (ret)
1565 +- return ret;
1566 ++ if (ret) {
1567 ++ if (!dma->iommu_mapped)
1568 ++ vfio_unpin_pages_remote(dma, iova,
1569 ++ phys >> PAGE_SHIFT,
1570 ++ size >> PAGE_SHIFT,
1571 ++ true);
1572 ++ goto unwind;
1573 ++ }
1574 +
1575 + iova += size;
1576 + }
1577 ++ }
1578 ++
1579 ++ /* All dmas are now mapped, defer to second tree walk for unwind */
1580 ++ for (n = rb_first(&iommu->dma_list); n; n = rb_next(n)) {
1581 ++ struct vfio_dma *dma = rb_entry(n, struct vfio_dma, node);
1582 ++
1583 + dma->iommu_mapped = true;
1584 + }
1585 ++
1586 + return 0;
1587 ++
1588 ++unwind:
1589 ++ for (; n; n = rb_prev(n)) {
1590 ++ struct vfio_dma *dma = rb_entry(n, struct vfio_dma, node);
1591 ++ dma_addr_t iova;
1592 ++
1593 ++ if (dma->iommu_mapped) {
1594 ++ iommu_unmap(domain->domain, dma->iova, dma->size);
1595 ++ continue;
1596 ++ }
1597 ++
1598 ++ iova = dma->iova;
1599 ++ while (iova < dma->iova + dma->size) {
1600 ++ phys_addr_t phys, p;
1601 ++ size_t size;
1602 ++ dma_addr_t i;
1603 ++
1604 ++ phys = iommu_iova_to_phys(domain->domain, iova);
1605 ++ if (!phys) {
1606 ++ iova += PAGE_SIZE;
1607 ++ continue;
1608 ++ }
1609 ++
1610 ++ size = PAGE_SIZE;
1611 ++ p = phys + size;
1612 ++ i = iova + size;
1613 ++ while (i < dma->iova + dma->size &&
1614 ++ p == iommu_iova_to_phys(domain->domain, i)) {
1615 ++ size += PAGE_SIZE;
1616 ++ p += PAGE_SIZE;
1617 ++ i += PAGE_SIZE;
1618 ++ }
1619 ++
1620 ++ iommu_unmap(domain->domain, iova, size);
1621 ++ vfio_unpin_pages_remote(dma, iova, phys >> PAGE_SHIFT,
1622 ++ size >> PAGE_SHIFT, true);
1623 ++ }
1624 ++ }
1625 ++
1626 ++ return ret;
1627 + }
1628 +
1629 + /*
1630 +diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
1631 +index 51d97ec4f58f9..e0cbf5b3d2174 100644
1632 +--- a/drivers/video/fbdev/efifb.c
1633 ++++ b/drivers/video/fbdev/efifb.c
1634 +@@ -453,7 +453,7 @@ static int efifb_probe(struct platform_device *dev)
1635 + info->apertures->ranges[0].base = efifb_fix.smem_start;
1636 + info->apertures->ranges[0].size = size_remap;
1637 +
1638 +- if (efi_enabled(EFI_BOOT) &&
1639 ++ if (efi_enabled(EFI_MEMMAP) &&
1640 + !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) {
1641 + if ((efifb_fix.smem_start + efifb_fix.smem_len) >
1642 + (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) {
1643 +diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
1644 +index 58b96baa8d488..4f7c73e6052f6 100644
1645 +--- a/drivers/virtio/virtio_ring.c
1646 ++++ b/drivers/virtio/virtio_ring.c
1647 +@@ -1960,6 +1960,9 @@ bool virtqueue_poll(struct virtqueue *_vq, unsigned last_used_idx)
1648 + {
1649 + struct vring_virtqueue *vq = to_vvq(_vq);
1650 +
1651 ++ if (unlikely(vq->broken))
1652 ++ return false;
1653 ++
1654 + virtio_mb(vq->weak_barriers);
1655 + return vq->packed_ring ? virtqueue_poll_packed(_vq, last_used_idx) :
1656 + virtqueue_poll_split(_vq, last_used_idx);
1657 +diff --git a/drivers/xen/preempt.c b/drivers/xen/preempt.c
1658 +index 456a164364a22..98a9d6892d989 100644
1659 +--- a/drivers/xen/preempt.c
1660 ++++ b/drivers/xen/preempt.c
1661 +@@ -27,7 +27,7 @@ EXPORT_SYMBOL_GPL(xen_in_preemptible_hcall);
1662 + asmlinkage __visible void xen_maybe_preempt_hcall(void)
1663 + {
1664 + if (unlikely(__this_cpu_read(xen_in_preemptible_hcall)
1665 +- && need_resched())) {
1666 ++ && need_resched() && !preempt_count())) {
1667 + /*
1668 + * Clear flag as we may be rescheduled on a different
1669 + * cpu.
1670 +diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
1671 +index bd3a10dfac157..06346422f7432 100644
1672 +--- a/drivers/xen/swiotlb-xen.c
1673 ++++ b/drivers/xen/swiotlb-xen.c
1674 +@@ -335,6 +335,7 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
1675 + int order = get_order(size);
1676 + phys_addr_t phys;
1677 + u64 dma_mask = DMA_BIT_MASK(32);
1678 ++ struct page *page;
1679 +
1680 + if (hwdev && hwdev->coherent_dma_mask)
1681 + dma_mask = hwdev->coherent_dma_mask;
1682 +@@ -346,9 +347,14 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
1683 + /* Convert the size to actually allocated. */
1684 + size = 1UL << (order + XEN_PAGE_SHIFT);
1685 +
1686 ++ if (is_vmalloc_addr(vaddr))
1687 ++ page = vmalloc_to_page(vaddr);
1688 ++ else
1689 ++ page = virt_to_page(vaddr);
1690 ++
1691 + if (!WARN_ON((dev_addr + size - 1 > dma_mask) ||
1692 + range_straddles_page_boundary(phys, size)) &&
1693 +- TestClearPageXenRemapped(virt_to_page(vaddr)))
1694 ++ TestClearPageXenRemapped(page))
1695 + xen_destroy_contiguous_region(phys, order);
1696 +
1697 + xen_free_coherent_pages(hwdev, size, vaddr, (dma_addr_t)phys, attrs);
1698 +diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
1699 +index 7503899c0a1b5..f07e53ab808e3 100644
1700 +--- a/fs/afs/dynroot.c
1701 ++++ b/fs/afs/dynroot.c
1702 +@@ -289,15 +289,17 @@ void afs_dynroot_depopulate(struct super_block *sb)
1703 + net->dynroot_sb = NULL;
1704 + mutex_unlock(&net->proc_cells_lock);
1705 +
1706 +- inode_lock(root->d_inode);
1707 +-
1708 +- /* Remove all the pins for dirs created for manually added cells */
1709 +- list_for_each_entry_safe(subdir, tmp, &root->d_subdirs, d_child) {
1710 +- if (subdir->d_fsdata) {
1711 +- subdir->d_fsdata = NULL;
1712 +- dput(subdir);
1713 ++ if (root) {
1714 ++ inode_lock(root->d_inode);
1715 ++
1716 ++ /* Remove all the pins for dirs created for manually added cells */
1717 ++ list_for_each_entry_safe(subdir, tmp, &root->d_subdirs, d_child) {
1718 ++ if (subdir->d_fsdata) {
1719 ++ subdir->d_fsdata = NULL;
1720 ++ dput(subdir);
1721 ++ }
1722 + }
1723 +- }
1724 +
1725 +- inode_unlock(root->d_inode);
1726 ++ inode_unlock(root->d_inode);
1727 ++ }
1728 + }
1729 +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
1730 +index 42d69e77f89d9..b167649f5f5de 100644
1731 +--- a/fs/btrfs/block-group.c
1732 ++++ b/fs/btrfs/block-group.c
1733 +@@ -2168,7 +2168,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
1734 + return 0;
1735 + }
1736 +
1737 +- if (trans->aborted)
1738 ++ if (TRANS_ABORTED(trans))
1739 + return 0;
1740 + again:
1741 + inode = lookup_free_space_inode(block_group, path);
1742 +diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
1743 +index 2374f3f6f3b70..18357b054a91e 100644
1744 +--- a/fs/btrfs/ctree.h
1745 ++++ b/fs/btrfs/ctree.h
1746 +@@ -2965,6 +2965,8 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
1747 + int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
1748 + unsigned long new_flags);
1749 + int btrfs_sync_fs(struct super_block *sb, int wait);
1750 ++char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
1751 ++ u64 subvol_objectid);
1752 +
1753 + static inline __printf(2, 3) __cold
1754 + void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
1755 +diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
1756 +index 5bcccfbcc7c15..a34ee9c2f3151 100644
1757 +--- a/fs/btrfs/delayed-inode.c
1758 ++++ b/fs/btrfs/delayed-inode.c
1759 +@@ -1151,7 +1151,7 @@ static int __btrfs_run_delayed_items(struct btrfs_trans_handle *trans, int nr)
1760 + int ret = 0;
1761 + bool count = (nr > 0);
1762 +
1763 +- if (trans->aborted)
1764 ++ if (TRANS_ABORTED(trans))
1765 + return -EIO;
1766 +
1767 + path = btrfs_alloc_path();
1768 +diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
1769 +index ddf28ecf17f93..93cceeba484cc 100644
1770 +--- a/fs/btrfs/export.c
1771 ++++ b/fs/btrfs/export.c
1772 +@@ -57,9 +57,9 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len,
1773 + return type;
1774 + }
1775 +
1776 +-static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
1777 +- u64 root_objectid, u32 generation,
1778 +- int check_generation)
1779 ++struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
1780 ++ u64 root_objectid, u32 generation,
1781 ++ int check_generation)
1782 + {
1783 + struct btrfs_fs_info *fs_info = btrfs_sb(sb);
1784 + struct btrfs_root *root;
1785 +@@ -152,7 +152,7 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
1786 + return btrfs_get_dentry(sb, objectid, root_objectid, generation, 1);
1787 + }
1788 +
1789 +-static struct dentry *btrfs_get_parent(struct dentry *child)
1790 ++struct dentry *btrfs_get_parent(struct dentry *child)
1791 + {
1792 + struct inode *dir = d_inode(child);
1793 + struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
1794 +diff --git a/fs/btrfs/export.h b/fs/btrfs/export.h
1795 +index 57488ecd7d4ef..f32f4113c976a 100644
1796 +--- a/fs/btrfs/export.h
1797 ++++ b/fs/btrfs/export.h
1798 +@@ -18,4 +18,9 @@ struct btrfs_fid {
1799 + u64 parent_root_objectid;
1800 + } __attribute__ ((packed));
1801 +
1802 ++struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
1803 ++ u64 root_objectid, u32 generation,
1804 ++ int check_generation);
1805 ++struct dentry *btrfs_get_parent(struct dentry *child);
1806 ++
1807 + #endif
1808 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
1809 +index 739332b462059..a36bd4507bacd 100644
1810 +--- a/fs/btrfs/extent-tree.c
1811 ++++ b/fs/btrfs/extent-tree.c
1812 +@@ -1561,7 +1561,7 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans,
1813 + int err = 0;
1814 + int metadata = !extent_op->is_data;
1815 +
1816 +- if (trans->aborted)
1817 ++ if (TRANS_ABORTED(trans))
1818 + return 0;
1819 +
1820 + if (metadata && !btrfs_fs_incompat(fs_info, SKINNY_METADATA))
1821 +@@ -1681,7 +1681,7 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans,
1822 + {
1823 + int ret = 0;
1824 +
1825 +- if (trans->aborted) {
1826 ++ if (TRANS_ABORTED(trans)) {
1827 + if (insert_reserved)
1828 + btrfs_pin_extent(trans->fs_info, node->bytenr,
1829 + node->num_bytes, 1);
1830 +@@ -2169,7 +2169,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
1831 + int run_all = count == (unsigned long)-1;
1832 +
1833 + /* We'll clean this up in btrfs_cleanup_transaction */
1834 +- if (trans->aborted)
1835 ++ if (TRANS_ABORTED(trans))
1836 + return 0;
1837 +
1838 + if (test_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags))
1839 +@@ -2892,7 +2892,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
1840 + else
1841 + unpin = &fs_info->freed_extents[0];
1842 +
1843 +- while (!trans->aborted) {
1844 ++ while (!TRANS_ABORTED(trans)) {
1845 + struct extent_state *cached_state = NULL;
1846 +
1847 + mutex_lock(&fs_info->unused_bg_unpin_mutex);
1848 +@@ -2924,7 +2924,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
1849 + u64 trimmed = 0;
1850 +
1851 + ret = -EROFS;
1852 +- if (!trans->aborted)
1853 ++ if (!TRANS_ABORTED(trans))
1854 + ret = btrfs_discard_extent(fs_info,
1855 + block_group->key.objectid,
1856 + block_group->key.offset,
1857 +diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
1858 +index 035ea5bc692ad..5707bf0575d43 100644
1859 +--- a/fs/btrfs/extent_io.c
1860 ++++ b/fs/btrfs/extent_io.c
1861 +@@ -4073,7 +4073,7 @@ retry:
1862 + if (!test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
1863 + ret = flush_write_bio(&epd);
1864 + } else {
1865 +- ret = -EUCLEAN;
1866 ++ ret = -EROFS;
1867 + end_write_bio(&epd, ret);
1868 + }
1869 + return ret;
1870 +diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
1871 +index a7b043fd7a572..498b824148187 100644
1872 +--- a/fs/btrfs/scrub.c
1873 ++++ b/fs/btrfs/scrub.c
1874 +@@ -3717,7 +3717,7 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx,
1875 + struct btrfs_fs_info *fs_info = sctx->fs_info;
1876 +
1877 + if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))
1878 +- return -EIO;
1879 ++ return -EROFS;
1880 +
1881 + /* Seed devices of a new filesystem has their own generation. */
1882 + if (scrub_dev->fs_devices != fs_info->fs_devices)
1883 +diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
1884 +index 4b0ee34aa65d5..a1498df419b4f 100644
1885 +--- a/fs/btrfs/super.c
1886 ++++ b/fs/btrfs/super.c
1887 +@@ -241,7 +241,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
1888 + {
1889 + struct btrfs_fs_info *fs_info = trans->fs_info;
1890 +
1891 +- trans->aborted = errno;
1892 ++ WRITE_ONCE(trans->aborted, errno);
1893 + /* Nothing used. The other threads that have joined this
1894 + * transaction may be able to continue. */
1895 + if (!trans->dirty && list_empty(&trans->new_bgs)) {
1896 +@@ -1009,8 +1009,8 @@ out:
1897 + return error;
1898 + }
1899 +
1900 +-static char *get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
1901 +- u64 subvol_objectid)
1902 ++char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
1903 ++ u64 subvol_objectid)
1904 + {
1905 + struct btrfs_root *root = fs_info->tree_root;
1906 + struct btrfs_root *fs_root;
1907 +@@ -1291,6 +1291,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
1908 + {
1909 + struct btrfs_fs_info *info = btrfs_sb(dentry->d_sb);
1910 + const char *compress_type;
1911 ++ const char *subvol_name;
1912 +
1913 + if (btrfs_test_opt(info, DEGRADED))
1914 + seq_puts(seq, ",degraded");
1915 +@@ -1375,8 +1376,13 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
1916 + seq_puts(seq, ",ref_verify");
1917 + seq_printf(seq, ",subvolid=%llu",
1918 + BTRFS_I(d_inode(dentry))->root->root_key.objectid);
1919 +- seq_puts(seq, ",subvol=");
1920 +- seq_dentry(seq, dentry, " \t\n\\");
1921 ++ subvol_name = btrfs_get_subvol_name_from_objectid(info,
1922 ++ BTRFS_I(d_inode(dentry))->root->root_key.objectid);
1923 ++ if (!IS_ERR(subvol_name)) {
1924 ++ seq_puts(seq, ",subvol=");
1925 ++ seq_escape(seq, subvol_name, " \t\n\\");
1926 ++ kfree(subvol_name);
1927 ++ }
1928 + return 0;
1929 + }
1930 +
1931 +@@ -1421,8 +1427,8 @@ static struct dentry *mount_subvol(const char *subvol_name, u64 subvol_objectid,
1932 + goto out;
1933 + }
1934 + }
1935 +- subvol_name = get_subvol_name_from_objectid(btrfs_sb(mnt->mnt_sb),
1936 +- subvol_objectid);
1937 ++ subvol_name = btrfs_get_subvol_name_from_objectid(
1938 ++ btrfs_sb(mnt->mnt_sb), subvol_objectid);
1939 + if (IS_ERR(subvol_name)) {
1940 + root = ERR_CAST(subvol_name);
1941 + subvol_name = NULL;
1942 +diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
1943 +index 54589e940f9af..c346ee7ec18d4 100644
1944 +--- a/fs/btrfs/transaction.c
1945 ++++ b/fs/btrfs/transaction.c
1946 +@@ -174,7 +174,7 @@ loop:
1947 +
1948 + cur_trans = fs_info->running_transaction;
1949 + if (cur_trans) {
1950 +- if (cur_trans->aborted) {
1951 ++ if (TRANS_ABORTED(cur_trans)) {
1952 + spin_unlock(&fs_info->trans_lock);
1953 + return cur_trans->aborted;
1954 + }
1955 +@@ -390,7 +390,7 @@ static inline int is_transaction_blocked(struct btrfs_transaction *trans)
1956 + {
1957 + return (trans->state >= TRANS_STATE_BLOCKED &&
1958 + trans->state < TRANS_STATE_UNBLOCKED &&
1959 +- !trans->aborted);
1960 ++ !TRANS_ABORTED(trans));
1961 + }
1962 +
1963 + /* wait for commit against the current transaction to become unblocked
1964 +@@ -409,7 +409,7 @@ static void wait_current_trans(struct btrfs_fs_info *fs_info)
1965 +
1966 + wait_event(fs_info->transaction_wait,
1967 + cur_trans->state >= TRANS_STATE_UNBLOCKED ||
1968 +- cur_trans->aborted);
1969 ++ TRANS_ABORTED(cur_trans));
1970 + btrfs_put_transaction(cur_trans);
1971 + } else {
1972 + spin_unlock(&fs_info->trans_lock);
1973 +@@ -870,10 +870,13 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
1974 + if (throttle)
1975 + btrfs_run_delayed_iputs(info);
1976 +
1977 +- if (trans->aborted ||
1978 ++ if (TRANS_ABORTED(trans) ||
1979 + test_bit(BTRFS_FS_STATE_ERROR, &info->fs_state)) {
1980 + wake_up_process(info->transaction_kthread);
1981 +- err = -EIO;
1982 ++ if (TRANS_ABORTED(trans))
1983 ++ err = trans->aborted;
1984 ++ else
1985 ++ err = -EROFS;
1986 + }
1987 +
1988 + kmem_cache_free(btrfs_trans_handle_cachep, trans);
1989 +@@ -1727,7 +1730,8 @@ static void wait_current_trans_commit_start(struct btrfs_fs_info *fs_info,
1990 + struct btrfs_transaction *trans)
1991 + {
1992 + wait_event(fs_info->transaction_blocked_wait,
1993 +- trans->state >= TRANS_STATE_COMMIT_START || trans->aborted);
1994 ++ trans->state >= TRANS_STATE_COMMIT_START ||
1995 ++ TRANS_ABORTED(trans));
1996 + }
1997 +
1998 + /*
1999 +@@ -1739,7 +1743,8 @@ static void wait_current_trans_commit_start_and_unblock(
2000 + struct btrfs_transaction *trans)
2001 + {
2002 + wait_event(fs_info->transaction_wait,
2003 +- trans->state >= TRANS_STATE_UNBLOCKED || trans->aborted);
2004 ++ trans->state >= TRANS_STATE_UNBLOCKED ||
2005 ++ TRANS_ABORTED(trans));
2006 + }
2007 +
2008 + /*
2009 +@@ -1957,7 +1962,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
2010 + trans->dirty = true;
2011 +
2012 + /* Stop the commit early if ->aborted is set */
2013 +- if (unlikely(READ_ONCE(cur_trans->aborted))) {
2014 ++ if (TRANS_ABORTED(cur_trans)) {
2015 + ret = cur_trans->aborted;
2016 + btrfs_end_transaction(trans);
2017 + return ret;
2018 +@@ -2031,7 +2036,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
2019 +
2020 + wait_for_commit(cur_trans);
2021 +
2022 +- if (unlikely(cur_trans->aborted))
2023 ++ if (TRANS_ABORTED(cur_trans))
2024 + ret = cur_trans->aborted;
2025 +
2026 + btrfs_put_transaction(cur_trans);
2027 +@@ -2050,7 +2055,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
2028 + spin_unlock(&fs_info->trans_lock);
2029 +
2030 + wait_for_commit(prev_trans);
2031 +- ret = prev_trans->aborted;
2032 ++ ret = READ_ONCE(prev_trans->aborted);
2033 +
2034 + btrfs_put_transaction(prev_trans);
2035 + if (ret)
2036 +@@ -2104,8 +2109,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
2037 + wait_event(cur_trans->writer_wait,
2038 + atomic_read(&cur_trans->num_writers) == 1);
2039 +
2040 +- /* ->aborted might be set after the previous check, so check it */
2041 +- if (unlikely(READ_ONCE(cur_trans->aborted))) {
2042 ++ if (TRANS_ABORTED(cur_trans)) {
2043 + ret = cur_trans->aborted;
2044 + goto scrub_continue;
2045 + }
2046 +@@ -2223,7 +2227,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
2047 + * The tasks which save the space cache and inode cache may also
2048 + * update ->aborted, check it.
2049 + */
2050 +- if (unlikely(READ_ONCE(cur_trans->aborted))) {
2051 ++ if (TRANS_ABORTED(cur_trans)) {
2052 + ret = cur_trans->aborted;
2053 + mutex_unlock(&fs_info->tree_log_mutex);
2054 + mutex_unlock(&fs_info->reloc_mutex);
2055 +diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
2056 +index b15c31d231488..7291a2a930751 100644
2057 +--- a/fs/btrfs/transaction.h
2058 ++++ b/fs/btrfs/transaction.h
2059 +@@ -116,6 +116,10 @@ struct btrfs_trans_handle {
2060 + struct btrfs_block_rsv *orig_rsv;
2061 + refcount_t use_count;
2062 + unsigned int type;
2063 ++ /*
2064 ++ * Error code of transaction abort, set outside of locks and must use
2065 ++ * the READ_ONCE/WRITE_ONCE access
2066 ++ */
2067 + short aborted;
2068 + bool adding_csums;
2069 + bool allocating_chunk;
2070 +@@ -127,6 +131,14 @@ struct btrfs_trans_handle {
2071 + struct list_head new_bgs;
2072 + };
2073 +
2074 ++/*
2075 ++ * The abort status can be changed between calls and is not protected by locks.
2076 ++ * This accepts btrfs_transaction and btrfs_trans_handle as types. Once it's
2077 ++ * set to a non-zero value it does not change, so the macro should be in checks
2078 ++ * but is not necessary for further reads of the value.
2079 ++ */
2080 ++#define TRANS_ABORTED(trans) (unlikely(READ_ONCE((trans)->aborted)))
2081 ++
2082 + struct btrfs_pending_snapshot {
2083 + struct dentry *dentry;
2084 + struct inode *dir;
2085 +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
2086 +index 701bc3f4d4ba1..b0077f5a31688 100644
2087 +--- a/fs/ceph/mds_client.c
2088 ++++ b/fs/ceph/mds_client.c
2089 +@@ -4143,7 +4143,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
2090 + return -ENOMEM;
2091 + }
2092 +
2093 +- fsc->mdsc = mdsc;
2094 + init_completion(&mdsc->safe_umount_waiters);
2095 + init_waitqueue_head(&mdsc->session_close_wq);
2096 + INIT_LIST_HEAD(&mdsc->waiting_for_map);
2097 +@@ -4195,6 +4194,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
2098 +
2099 + strscpy(mdsc->nodename, utsname()->nodename,
2100 + sizeof(mdsc->nodename));
2101 ++
2102 ++ fsc->mdsc = mdsc;
2103 + return 0;
2104 + }
2105 +
2106 +diff --git a/fs/eventpoll.c b/fs/eventpoll.c
2107 +index 6307c1d883e0a..0d9b1e2b9da72 100644
2108 +--- a/fs/eventpoll.c
2109 ++++ b/fs/eventpoll.c
2110 +@@ -1991,9 +1991,11 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
2111 + * not already there, and calling reverse_path_check()
2112 + * during ep_insert().
2113 + */
2114 +- if (list_empty(&epi->ffd.file->f_tfile_llink))
2115 ++ if (list_empty(&epi->ffd.file->f_tfile_llink)) {
2116 ++ get_file(epi->ffd.file);
2117 + list_add(&epi->ffd.file->f_tfile_llink,
2118 + &tfile_check_list);
2119 ++ }
2120 + }
2121 + }
2122 + mutex_unlock(&ep->mtx);
2123 +@@ -2037,6 +2039,7 @@ static void clear_tfile_check_list(void)
2124 + file = list_first_entry(&tfile_check_list, struct file,
2125 + f_tfile_llink);
2126 + list_del_init(&file->f_tfile_llink);
2127 ++ fput(file);
2128 + }
2129 + INIT_LIST_HEAD(&tfile_check_list);
2130 + }
2131 +@@ -2192,13 +2195,13 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
2132 + mutex_lock(&epmutex);
2133 + if (is_file_epoll(tf.file)) {
2134 + error = -ELOOP;
2135 +- if (ep_loop_check(ep, tf.file) != 0) {
2136 +- clear_tfile_check_list();
2137 ++ if (ep_loop_check(ep, tf.file) != 0)
2138 + goto error_tgt_fput;
2139 +- }
2140 +- } else
2141 ++ } else {
2142 ++ get_file(tf.file);
2143 + list_add(&tf.file->f_tfile_llink,
2144 + &tfile_check_list);
2145 ++ }
2146 + mutex_lock_nested(&ep->mtx, 0);
2147 + if (is_file_epoll(tf.file)) {
2148 + tep = tf.file->private_data;
2149 +@@ -2222,8 +2225,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
2150 + error = ep_insert(ep, &epds, tf.file, fd, full_check);
2151 + } else
2152 + error = -EEXIST;
2153 +- if (full_check)
2154 +- clear_tfile_check_list();
2155 + break;
2156 + case EPOLL_CTL_DEL:
2157 + if (epi)
2158 +@@ -2246,8 +2247,10 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
2159 + mutex_unlock(&ep->mtx);
2160 +
2161 + error_tgt_fput:
2162 +- if (full_check)
2163 ++ if (full_check) {
2164 ++ clear_tfile_check_list();
2165 + mutex_unlock(&epmutex);
2166 ++ }
2167 +
2168 + fdput(tf);
2169 + error_fput:
2170 +diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
2171 +index ff8e1205127ee..ceb54ccc937e9 100644
2172 +--- a/fs/ext4/block_validity.c
2173 ++++ b/fs/ext4/block_validity.c
2174 +@@ -68,7 +68,7 @@ static int add_system_zone(struct ext4_system_blocks *system_blks,
2175 + ext4_fsblk_t start_blk,
2176 + unsigned int count)
2177 + {
2178 +- struct ext4_system_zone *new_entry = NULL, *entry;
2179 ++ struct ext4_system_zone *new_entry, *entry;
2180 + struct rb_node **n = &system_blks->root.rb_node, *node;
2181 + struct rb_node *parent = NULL, *new_node = NULL;
2182 +
2183 +@@ -79,30 +79,20 @@ static int add_system_zone(struct ext4_system_blocks *system_blks,
2184 + n = &(*n)->rb_left;
2185 + else if (start_blk >= (entry->start_blk + entry->count))
2186 + n = &(*n)->rb_right;
2187 +- else {
2188 +- if (start_blk + count > (entry->start_blk +
2189 +- entry->count))
2190 +- entry->count = (start_blk + count -
2191 +- entry->start_blk);
2192 +- new_node = *n;
2193 +- new_entry = rb_entry(new_node, struct ext4_system_zone,
2194 +- node);
2195 +- break;
2196 +- }
2197 ++ else /* Unexpected overlap of system zones. */
2198 ++ return -EFSCORRUPTED;
2199 + }
2200 +
2201 +- if (!new_entry) {
2202 +- new_entry = kmem_cache_alloc(ext4_system_zone_cachep,
2203 +- GFP_KERNEL);
2204 +- if (!new_entry)
2205 +- return -ENOMEM;
2206 +- new_entry->start_blk = start_blk;
2207 +- new_entry->count = count;
2208 +- new_node = &new_entry->node;
2209 +-
2210 +- rb_link_node(new_node, parent, n);
2211 +- rb_insert_color(new_node, &system_blks->root);
2212 +- }
2213 ++ new_entry = kmem_cache_alloc(ext4_system_zone_cachep,
2214 ++ GFP_KERNEL);
2215 ++ if (!new_entry)
2216 ++ return -ENOMEM;
2217 ++ new_entry->start_blk = start_blk;
2218 ++ new_entry->count = count;
2219 ++ new_node = &new_entry->node;
2220 ++
2221 ++ rb_link_node(new_node, parent, n);
2222 ++ rb_insert_color(new_node, &system_blks->root);
2223 +
2224 + /* Can we merge to the left? */
2225 + node = rb_prev(new_node);
2226 +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
2227 +index a564d0289a70a..36a81b57012a5 100644
2228 +--- a/fs/ext4/namei.c
2229 ++++ b/fs/ext4/namei.c
2230 +@@ -1392,8 +1392,8 @@ int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size,
2231 + ext4_match(dir, fname, de)) {
2232 + /* found a match - just to be sure, do
2233 + * a full check */
2234 +- if (ext4_check_dir_entry(dir, NULL, de, bh, bh->b_data,
2235 +- bh->b_size, offset))
2236 ++ if (ext4_check_dir_entry(dir, NULL, de, bh, search_buf,
2237 ++ buf_size, offset))
2238 + return -1;
2239 + *res_dir = de;
2240 + return 1;
2241 +@@ -1852,7 +1852,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
2242 + blocksize, hinfo, map);
2243 + map -= count;
2244 + dx_sort_map(map, count);
2245 +- /* Split the existing block in the middle, size-wise */
2246 ++ /* Ensure that neither split block is over half full */
2247 + size = 0;
2248 + move = 0;
2249 + for (i = count-1; i >= 0; i--) {
2250 +@@ -1862,8 +1862,18 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
2251 + size += map[i].size;
2252 + move++;
2253 + }
2254 +- /* map index at which we will split */
2255 +- split = count - move;
2256 ++ /*
2257 ++ * map index at which we will split
2258 ++ *
2259 ++ * If the sum of active entries didn't exceed half the block size, just
2260 ++ * split it in half by count; each resulting block will have at least
2261 ++ * half the space free.
2262 ++ */
2263 ++ if (i > 0)
2264 ++ split = count - move;
2265 ++ else
2266 ++ split = count/2;
2267 ++
2268 + hash2 = map[split].hash;
2269 + continued = hash2 == map[split - 1].hash;
2270 + dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n",
2271 +@@ -2462,7 +2472,7 @@ int ext4_generic_delete_entry(handle_t *handle,
2272 + de = (struct ext4_dir_entry_2 *)entry_buf;
2273 + while (i < buf_size - csum_size) {
2274 + if (ext4_check_dir_entry(dir, NULL, de, bh,
2275 +- bh->b_data, bh->b_size, i))
2276 ++ entry_buf, buf_size, i))
2277 + return -EFSCORRUPTED;
2278 + if (de == de_del) {
2279 + if (pde)
2280 +diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
2281 +index adbb8fef22162..50fa3e08c02f3 100644
2282 +--- a/fs/gfs2/bmap.c
2283 ++++ b/fs/gfs2/bmap.c
2284 +@@ -1350,9 +1350,15 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
2285 + return ret;
2286 + }
2287 +
2288 ++/*
2289 ++ * NOTE: Never call gfs2_block_zero_range with an open transaction because it
2290 ++ * uses iomap write to perform its actions, which begin their own transactions
2291 ++ * (iomap_begin, page_prepare, etc.)
2292 ++ */
2293 + static int gfs2_block_zero_range(struct inode *inode, loff_t from,
2294 + unsigned int length)
2295 + {
2296 ++ BUG_ON(current->journal_info);
2297 + return iomap_zero_range(inode, from, length, NULL, &gfs2_iomap_ops);
2298 + }
2299 +
2300 +@@ -1413,6 +1419,16 @@ static int trunc_start(struct inode *inode, u64 newsize)
2301 + u64 oldsize = inode->i_size;
2302 + int error;
2303 +
2304 ++ if (!gfs2_is_stuffed(ip)) {
2305 ++ unsigned int blocksize = i_blocksize(inode);
2306 ++ unsigned int offs = newsize & (blocksize - 1);
2307 ++ if (offs) {
2308 ++ error = gfs2_block_zero_range(inode, newsize,
2309 ++ blocksize - offs);
2310 ++ if (error)
2311 ++ return error;
2312 ++ }
2313 ++ }
2314 + if (journaled)
2315 + error = gfs2_trans_begin(sdp, RES_DINODE + RES_JDATA, GFS2_JTRUNC_REVOKES);
2316 + else
2317 +@@ -1426,19 +1442,10 @@ static int trunc_start(struct inode *inode, u64 newsize)
2318 +
2319 + gfs2_trans_add_meta(ip->i_gl, dibh);
2320 +
2321 +- if (gfs2_is_stuffed(ip)) {
2322 ++ if (gfs2_is_stuffed(ip))
2323 + gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + newsize);
2324 +- } else {
2325 +- unsigned int blocksize = i_blocksize(inode);
2326 +- unsigned int offs = newsize & (blocksize - 1);
2327 +- if (offs) {
2328 +- error = gfs2_block_zero_range(inode, newsize,
2329 +- blocksize - offs);
2330 +- if (error)
2331 +- goto out;
2332 +- }
2333 ++ else
2334 + ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
2335 +- }
2336 +
2337 + i_size_write(inode, newsize);
2338 + ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
2339 +@@ -2442,24 +2449,13 @@ int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length)
2340 + struct inode *inode = file_inode(file);
2341 + struct gfs2_inode *ip = GFS2_I(inode);
2342 + struct gfs2_sbd *sdp = GFS2_SB(inode);
2343 ++ unsigned int blocksize = i_blocksize(inode);
2344 ++ loff_t start, end;
2345 + int error;
2346 +
2347 +- if (gfs2_is_jdata(ip))
2348 +- error = gfs2_trans_begin(sdp, RES_DINODE + 2 * RES_JDATA,
2349 +- GFS2_JTRUNC_REVOKES);
2350 +- else
2351 +- error = gfs2_trans_begin(sdp, RES_DINODE, 0);
2352 +- if (error)
2353 +- return error;
2354 ++ if (!gfs2_is_stuffed(ip)) {
2355 ++ unsigned int start_off, end_len;
2356 +
2357 +- if (gfs2_is_stuffed(ip)) {
2358 +- error = stuffed_zero_range(inode, offset, length);
2359 +- if (error)
2360 +- goto out;
2361 +- } else {
2362 +- unsigned int start_off, end_len, blocksize;
2363 +-
2364 +- blocksize = i_blocksize(inode);
2365 + start_off = offset & (blocksize - 1);
2366 + end_len = (offset + length) & (blocksize - 1);
2367 + if (start_off) {
2368 +@@ -2480,6 +2476,26 @@ int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length)
2369 + }
2370 + }
2371 +
2372 ++ start = round_down(offset, blocksize);
2373 ++ end = round_up(offset + length, blocksize) - 1;
2374 ++ error = filemap_write_and_wait_range(inode->i_mapping, start, end);
2375 ++ if (error)
2376 ++ return error;
2377 ++
2378 ++ if (gfs2_is_jdata(ip))
2379 ++ error = gfs2_trans_begin(sdp, RES_DINODE + 2 * RES_JDATA,
2380 ++ GFS2_JTRUNC_REVOKES);
2381 ++ else
2382 ++ error = gfs2_trans_begin(sdp, RES_DINODE, 0);
2383 ++ if (error)
2384 ++ return error;
2385 ++
2386 ++ if (gfs2_is_stuffed(ip)) {
2387 ++ error = stuffed_zero_range(inode, offset, length);
2388 ++ if (error)
2389 ++ goto out;
2390 ++ }
2391 ++
2392 + if (gfs2_is_jdata(ip)) {
2393 + BUG_ON(!current->journal_info);
2394 + gfs2_journaled_truncate_range(inode, offset, length);
2395 +diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
2396 +index fa58835668a62..b7c5819bfc411 100644
2397 +--- a/fs/jbd2/journal.c
2398 ++++ b/fs/jbd2/journal.c
2399 +@@ -1348,8 +1348,10 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
2400 + int ret;
2401 +
2402 + /* Buffer got discarded which means block device got invalidated */
2403 +- if (!buffer_mapped(bh))
2404 ++ if (!buffer_mapped(bh)) {
2405 ++ unlock_buffer(bh);
2406 + return -EIO;
2407 ++ }
2408 +
2409 + trace_jbd2_write_superblock(journal, write_flags);
2410 + if (!(journal->j_flags & JBD2_BARRIER))
2411 +diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
2412 +index f20cff1194bb6..776493713153f 100644
2413 +--- a/fs/jffs2/dir.c
2414 ++++ b/fs/jffs2/dir.c
2415 +@@ -590,10 +590,14 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
2416 + int ret;
2417 + uint32_t now = JFFS2_NOW();
2418 +
2419 ++ mutex_lock(&f->sem);
2420 + for (fd = f->dents ; fd; fd = fd->next) {
2421 +- if (fd->ino)
2422 ++ if (fd->ino) {
2423 ++ mutex_unlock(&f->sem);
2424 + return -ENOTEMPTY;
2425 ++ }
2426 + }
2427 ++ mutex_unlock(&f->sem);
2428 +
2429 + ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
2430 + dentry->d_name.len, f, now);
2431 +diff --git a/fs/romfs/storage.c b/fs/romfs/storage.c
2432 +index 6b2b4362089e6..b57b3ffcbc327 100644
2433 +--- a/fs/romfs/storage.c
2434 ++++ b/fs/romfs/storage.c
2435 +@@ -217,10 +217,8 @@ int romfs_dev_read(struct super_block *sb, unsigned long pos,
2436 + size_t limit;
2437 +
2438 + limit = romfs_maxsize(sb);
2439 +- if (pos >= limit)
2440 ++ if (pos >= limit || buflen > limit - pos)
2441 + return -EIO;
2442 +- if (buflen > limit - pos)
2443 +- buflen = limit - pos;
2444 +
2445 + #ifdef CONFIG_ROMFS_ON_MTD
2446 + if (sb->s_mtd)
2447 +diff --git a/fs/signalfd.c b/fs/signalfd.c
2448 +index 44b6845b071c3..5b78719be4455 100644
2449 +--- a/fs/signalfd.c
2450 ++++ b/fs/signalfd.c
2451 +@@ -314,9 +314,10 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
2452 + {
2453 + sigset_t mask;
2454 +
2455 +- if (sizemask != sizeof(sigset_t) ||
2456 +- copy_from_user(&mask, user_mask, sizeof(mask)))
2457 ++ if (sizemask != sizeof(sigset_t))
2458 + return -EINVAL;
2459 ++ if (copy_from_user(&mask, user_mask, sizeof(mask)))
2460 ++ return -EFAULT;
2461 + return do_signalfd4(ufd, &mask, flags);
2462 + }
2463 +
2464 +@@ -325,9 +326,10 @@ SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
2465 + {
2466 + sigset_t mask;
2467 +
2468 +- if (sizemask != sizeof(sigset_t) ||
2469 +- copy_from_user(&mask, user_mask, sizeof(mask)))
2470 ++ if (sizemask != sizeof(sigset_t))
2471 + return -EINVAL;
2472 ++ if (copy_from_user(&mask, user_mask, sizeof(mask)))
2473 ++ return -EFAULT;
2474 + return do_signalfd4(ufd, &mask, 0);
2475 + }
2476 +
2477 +diff --git a/fs/xfs/xfs_sysfs.h b/fs/xfs/xfs_sysfs.h
2478 +index e9f810fc67317..43585850f1546 100644
2479 +--- a/fs/xfs/xfs_sysfs.h
2480 ++++ b/fs/xfs/xfs_sysfs.h
2481 +@@ -32,9 +32,11 @@ xfs_sysfs_init(
2482 + struct xfs_kobj *parent_kobj,
2483 + const char *name)
2484 + {
2485 ++ struct kobject *parent;
2486 ++
2487 ++ parent = parent_kobj ? &parent_kobj->kobject : NULL;
2488 + init_completion(&kobj->complete);
2489 +- return kobject_init_and_add(&kobj->kobject, ktype,
2490 +- &parent_kobj->kobject, "%s", name);
2491 ++ return kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name);
2492 + }
2493 +
2494 + static inline void
2495 +diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
2496 +index 16457465833ba..904780dd74aa3 100644
2497 +--- a/fs/xfs/xfs_trans_dquot.c
2498 ++++ b/fs/xfs/xfs_trans_dquot.c
2499 +@@ -646,7 +646,7 @@ xfs_trans_dqresv(
2500 + }
2501 + }
2502 + if (ninos > 0) {
2503 +- total_count = be64_to_cpu(dqp->q_core.d_icount) + ninos;
2504 ++ total_count = dqp->q_res_icount + ninos;
2505 + timer = be32_to_cpu(dqp->q_core.d_itimer);
2506 + warns = be16_to_cpu(dqp->q_core.d_iwarns);
2507 + warnlimit = dqp->q_mount->m_quotainfo->qi_iwarnlimit;
2508 +diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
2509 +index aa83538efc238..a793bd23fe56c 100644
2510 +--- a/kernel/events/uprobes.c
2511 ++++ b/kernel/events/uprobes.c
2512 +@@ -211,7 +211,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
2513 + try_to_free_swap(old_page);
2514 + page_vma_mapped_walk_done(&pvmw);
2515 +
2516 +- if (vma->vm_flags & VM_LOCKED)
2517 ++ if ((vma->vm_flags & VM_LOCKED) && !PageCompound(old_page))
2518 + munlock_vma_page(old_page);
2519 + put_page(old_page);
2520 +
2521 +diff --git a/kernel/kthread.c b/kernel/kthread.c
2522 +index b262f47046ca4..bfbfa481be3a5 100644
2523 +--- a/kernel/kthread.c
2524 ++++ b/kernel/kthread.c
2525 +@@ -199,8 +199,15 @@ static void __kthread_parkme(struct kthread *self)
2526 + if (!test_bit(KTHREAD_SHOULD_PARK, &self->flags))
2527 + break;
2528 +
2529 ++ /*
2530 ++ * Thread is going to call schedule(), do not preempt it,
2531 ++ * or the caller of kthread_park() may spend more time in
2532 ++ * wait_task_inactive().
2533 ++ */
2534 ++ preempt_disable();
2535 + complete(&self->parked);
2536 +- schedule();
2537 ++ schedule_preempt_disabled();
2538 ++ preempt_enable();
2539 + }
2540 + __set_current_state(TASK_RUNNING);
2541 + }
2542 +@@ -245,8 +252,14 @@ static int kthread(void *_create)
2543 + /* OK, tell user we're spawned, wait for stop or wakeup */
2544 + __set_current_state(TASK_UNINTERRUPTIBLE);
2545 + create->result = current;
2546 ++ /*
2547 ++ * Thread is going to call schedule(), do not preempt it,
2548 ++ * or the creator may spend more time in wait_task_inactive().
2549 ++ */
2550 ++ preempt_disable();
2551 + complete(done);
2552 +- schedule();
2553 ++ schedule_preempt_disabled();
2554 ++ preempt_enable();
2555 +
2556 + ret = -EINTR;
2557 + if (!test_bit(KTHREAD_SHOULD_STOP, &self->flags)) {
2558 +diff --git a/kernel/relay.c b/kernel/relay.c
2559 +index 4b760ec163426..d3940becf2fc3 100644
2560 +--- a/kernel/relay.c
2561 ++++ b/kernel/relay.c
2562 +@@ -197,6 +197,7 @@ free_buf:
2563 + static void relay_destroy_channel(struct kref *kref)
2564 + {
2565 + struct rchan *chan = container_of(kref, struct rchan, kref);
2566 ++ free_percpu(chan->buf);
2567 + kfree(chan);
2568 + }
2569 +
2570 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2571 +index 2af1831596f22..2a83b03c54a69 100644
2572 +--- a/mm/hugetlb.c
2573 ++++ b/mm/hugetlb.c
2574 +@@ -4846,25 +4846,21 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr)
2575 + void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
2576 + unsigned long *start, unsigned long *end)
2577 + {
2578 +- unsigned long check_addr = *start;
2579 ++ unsigned long a_start, a_end;
2580 +
2581 + if (!(vma->vm_flags & VM_MAYSHARE))
2582 + return;
2583 +
2584 +- for (check_addr = *start; check_addr < *end; check_addr += PUD_SIZE) {
2585 +- unsigned long a_start = check_addr & PUD_MASK;
2586 +- unsigned long a_end = a_start + PUD_SIZE;
2587 ++ /* Extend the range to be PUD aligned for a worst case scenario */
2588 ++ a_start = ALIGN_DOWN(*start, PUD_SIZE);
2589 ++ a_end = ALIGN(*end, PUD_SIZE);
2590 +
2591 +- /*
2592 +- * If sharing is possible, adjust start/end if necessary.
2593 +- */
2594 +- if (range_in_vma(vma, a_start, a_end)) {
2595 +- if (a_start < *start)
2596 +- *start = a_start;
2597 +- if (a_end > *end)
2598 +- *end = a_end;
2599 +- }
2600 +- }
2601 ++ /*
2602 ++ * Intersect the range with the vma range, since pmd sharing won't be
2603 ++ * across vma after all
2604 ++ */
2605 ++ *start = max(vma->vm_start, a_start);
2606 ++ *end = min(vma->vm_end, a_end);
2607 + }
2608 +
2609 + /*
2610 +diff --git a/mm/khugepaged.c b/mm/khugepaged.c
2611 +index 719f49d1fba2f..3623d1c5343f2 100644
2612 +--- a/mm/khugepaged.c
2613 ++++ b/mm/khugepaged.c
2614 +@@ -401,7 +401,7 @@ static void insert_to_mm_slots_hash(struct mm_struct *mm,
2615 +
2616 + static inline int khugepaged_test_exit(struct mm_struct *mm)
2617 + {
2618 +- return atomic_read(&mm->mm_users) == 0;
2619 ++ return atomic_read(&mm->mm_users) == 0 || !mmget_still_valid(mm);
2620 + }
2621 +
2622 + static bool hugepage_vma_check(struct vm_area_struct *vma,
2623 +@@ -438,7 +438,7 @@ int __khugepaged_enter(struct mm_struct *mm)
2624 + return -ENOMEM;
2625 +
2626 + /* __khugepaged_exit() must not run from under us */
2627 +- VM_BUG_ON_MM(khugepaged_test_exit(mm), mm);
2628 ++ VM_BUG_ON_MM(atomic_read(&mm->mm_users) == 0, mm);
2629 + if (unlikely(test_and_set_bit(MMF_VM_HUGEPAGE, &mm->flags))) {
2630 + free_mm_slot(mm_slot);
2631 + return 0;
2632 +@@ -1019,9 +1019,6 @@ static void collapse_huge_page(struct mm_struct *mm,
2633 + * handled by the anon_vma lock + PG_lock.
2634 + */
2635 + down_write(&mm->mmap_sem);
2636 +- result = SCAN_ANY_PROCESS;
2637 +- if (!mmget_still_valid(mm))
2638 +- goto out;
2639 + result = hugepage_vma_revalidate(mm, address, &vma);
2640 + if (result)
2641 + goto out;
2642 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
2643 +index 8686fe760f34c..67a9943aa595f 100644
2644 +--- a/mm/page_alloc.c
2645 ++++ b/mm/page_alloc.c
2646 +@@ -1256,6 +1256,11 @@ static void free_pcppages_bulk(struct zone *zone, int count,
2647 + struct page *page, *tmp;
2648 + LIST_HEAD(head);
2649 +
2650 ++ /*
2651 ++ * Ensure proper count is passed which otherwise would stuck in the
2652 ++ * below while (list_empty(list)) loop.
2653 ++ */
2654 ++ count = min(pcp->count, count);
2655 + while (count) {
2656 + struct list_head *list;
2657 +
2658 +@@ -7867,7 +7872,7 @@ int __meminit init_per_zone_wmark_min(void)
2659 +
2660 + return 0;
2661 + }
2662 +-core_initcall(init_per_zone_wmark_min)
2663 ++postcore_initcall(init_per_zone_wmark_min)
2664 +
2665 + /*
2666 + * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
2667 +diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
2668 +index f7587428febdd..bf9fd6ee88fe0 100644
2669 +--- a/net/can/j1939/socket.c
2670 ++++ b/net/can/j1939/socket.c
2671 +@@ -398,6 +398,7 @@ static int j1939_sk_init(struct sock *sk)
2672 + spin_lock_init(&jsk->sk_session_queue_lock);
2673 + INIT_LIST_HEAD(&jsk->sk_session_queue);
2674 + sk->sk_destruct = j1939_sk_sock_destruct;
2675 ++ sk->sk_protocol = CAN_J1939;
2676 +
2677 + return 0;
2678 + }
2679 +@@ -466,6 +467,14 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len)
2680 + goto out_release_sock;
2681 + }
2682 +
2683 ++ if (!ndev->ml_priv) {
2684 ++ netdev_warn_once(ndev,
2685 ++ "No CAN mid layer private allocated, please fix your driver and use alloc_candev()!\n");
2686 ++ dev_put(ndev);
2687 ++ ret = -ENODEV;
2688 ++ goto out_release_sock;
2689 ++ }
2690 ++
2691 + priv = j1939_netdev_start(ndev);
2692 + dev_put(ndev);
2693 + if (IS_ERR(priv)) {
2694 +@@ -553,6 +562,11 @@ static int j1939_sk_connect(struct socket *sock, struct sockaddr *uaddr,
2695 + static void j1939_sk_sock2sockaddr_can(struct sockaddr_can *addr,
2696 + const struct j1939_sock *jsk, int peer)
2697 + {
2698 ++ /* There are two holes (2 bytes and 3 bytes) to clear to avoid
2699 ++ * leaking kernel information to user space.
2700 ++ */
2701 ++ memset(addr, 0, J1939_MIN_NAMELEN);
2702 ++
2703 + addr->can_family = AF_CAN;
2704 + addr->can_ifindex = jsk->ifindex;
2705 + addr->can_addr.j1939.pgn = jsk->addr.pgn;
2706 +diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
2707 +index 9f99af5b0b11e..dbd215cbc53d8 100644
2708 +--- a/net/can/j1939/transport.c
2709 ++++ b/net/can/j1939/transport.c
2710 +@@ -352,17 +352,16 @@ void j1939_session_skb_queue(struct j1939_session *session,
2711 + skb_queue_tail(&session->skb_queue, skb);
2712 + }
2713 +
2714 +-static struct sk_buff *j1939_session_skb_find(struct j1939_session *session)
2715 ++static struct
2716 ++sk_buff *j1939_session_skb_find_by_offset(struct j1939_session *session,
2717 ++ unsigned int offset_start)
2718 + {
2719 + struct j1939_priv *priv = session->priv;
2720 ++ struct j1939_sk_buff_cb *do_skcb;
2721 + struct sk_buff *skb = NULL;
2722 + struct sk_buff *do_skb;
2723 +- struct j1939_sk_buff_cb *do_skcb;
2724 +- unsigned int offset_start;
2725 + unsigned long flags;
2726 +
2727 +- offset_start = session->pkt.dpo * 7;
2728 +-
2729 + spin_lock_irqsave(&session->skb_queue.lock, flags);
2730 + skb_queue_walk(&session->skb_queue, do_skb) {
2731 + do_skcb = j1939_skb_to_cb(do_skb);
2732 +@@ -382,6 +381,14 @@ static struct sk_buff *j1939_session_skb_find(struct j1939_session *session)
2733 + return skb;
2734 + }
2735 +
2736 ++static struct sk_buff *j1939_session_skb_find(struct j1939_session *session)
2737 ++{
2738 ++ unsigned int offset_start;
2739 ++
2740 ++ offset_start = session->pkt.dpo * 7;
2741 ++ return j1939_session_skb_find_by_offset(session, offset_start);
2742 ++}
2743 ++
2744 + /* see if we are receiver
2745 + * returns 0 for broadcasts, although we will receive them
2746 + */
2747 +@@ -716,10 +723,12 @@ static int j1939_session_tx_rts(struct j1939_session *session)
2748 + return ret;
2749 +
2750 + session->last_txcmd = dat[0];
2751 +- if (dat[0] == J1939_TP_CMD_BAM)
2752 ++ if (dat[0] == J1939_TP_CMD_BAM) {
2753 + j1939_tp_schedule_txtimer(session, 50);
2754 +-
2755 +- j1939_tp_set_rxtimeout(session, 1250);
2756 ++ j1939_tp_set_rxtimeout(session, 250);
2757 ++ } else {
2758 ++ j1939_tp_set_rxtimeout(session, 1250);
2759 ++ }
2760 +
2761 + netdev_dbg(session->priv->ndev, "%s: 0x%p\n", __func__, session);
2762 +
2763 +@@ -766,7 +775,7 @@ static int j1939_session_tx_dat(struct j1939_session *session)
2764 + int ret = 0;
2765 + u8 dat[8];
2766 +
2767 +- se_skb = j1939_session_skb_find(session);
2768 ++ se_skb = j1939_session_skb_find_by_offset(session, session->pkt.tx * 7);
2769 + if (!se_skb)
2770 + return -ENOBUFS;
2771 +
2772 +@@ -787,6 +796,18 @@ static int j1939_session_tx_dat(struct j1939_session *session)
2773 + if (len > 7)
2774 + len = 7;
2775 +
2776 ++ if (offset + len > se_skb->len) {
2777 ++ netdev_err_once(priv->ndev,
2778 ++ "%s: 0x%p: requested data outside of queued buffer: offset %i, len %i, pkt.tx: %i\n",
2779 ++ __func__, session, skcb->offset, se_skb->len , session->pkt.tx);
2780 ++ return -EOVERFLOW;
2781 ++ }
2782 ++
2783 ++ if (!len) {
2784 ++ ret = -ENOBUFS;
2785 ++ break;
2786 ++ }
2787 ++
2788 + memcpy(&dat[1], &tpdat[offset], len);
2789 + ret = j1939_tp_tx_dat(session, dat, len + 1);
2790 + if (ret < 0) {
2791 +@@ -1055,9 +1076,9 @@ static void __j1939_session_cancel(struct j1939_session *session,
2792 + lockdep_assert_held(&session->priv->active_session_list_lock);
2793 +
2794 + session->err = j1939_xtp_abort_to_errno(priv, err);
2795 ++ session->state = J1939_SESSION_WAITING_ABORT;
2796 + /* do not send aborts on incoming broadcasts */
2797 + if (!j1939_cb_is_broadcast(&session->skcb)) {
2798 +- session->state = J1939_SESSION_WAITING_ABORT;
2799 + j1939_xtp_tx_abort(priv, &session->skcb,
2800 + !session->transmission,
2801 + err, session->skcb.addr.pgn);
2802 +@@ -1120,6 +1141,9 @@ static enum hrtimer_restart j1939_tp_txtimer(struct hrtimer *hrtimer)
2803 + * cleanup including propagation of the error to user space.
2804 + */
2805 + break;
2806 ++ case -EOVERFLOW:
2807 ++ j1939_session_cancel(session, J1939_XTP_ABORT_ECTS_TOO_BIG);
2808 ++ break;
2809 + case 0:
2810 + session->tx_retry = 0;
2811 + break;
2812 +@@ -1651,8 +1675,12 @@ static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
2813 + return;
2814 + }
2815 + session = j1939_xtp_rx_rts_session_new(priv, skb);
2816 +- if (!session)
2817 ++ if (!session) {
2818 ++ if (cmd == J1939_TP_CMD_BAM && j1939_sk_recv_match(priv, skcb))
2819 ++ netdev_info(priv->ndev, "%s: failed to create TP BAM session\n",
2820 ++ __func__);
2821 + return;
2822 ++ }
2823 + } else {
2824 + if (j1939_xtp_rx_rts_session_active(session, skb)) {
2825 + j1939_session_put(session);
2826 +@@ -1661,11 +1689,15 @@ static void j1939_xtp_rx_rts(struct j1939_priv *priv, struct sk_buff *skb,
2827 + }
2828 + session->last_cmd = cmd;
2829 +
2830 +- j1939_tp_set_rxtimeout(session, 1250);
2831 +-
2832 +- if (cmd != J1939_TP_CMD_BAM && !session->transmission) {
2833 +- j1939_session_txtimer_cancel(session);
2834 +- j1939_tp_schedule_txtimer(session, 0);
2835 ++ if (cmd == J1939_TP_CMD_BAM) {
2836 ++ if (!session->transmission)
2837 ++ j1939_tp_set_rxtimeout(session, 750);
2838 ++ } else {
2839 ++ if (!session->transmission) {
2840 ++ j1939_session_txtimer_cancel(session);
2841 ++ j1939_tp_schedule_txtimer(session, 0);
2842 ++ }
2843 ++ j1939_tp_set_rxtimeout(session, 1250);
2844 + }
2845 +
2846 + j1939_session_put(session);
2847 +@@ -1716,6 +1748,7 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
2848 + int offset;
2849 + int nbytes;
2850 + bool final = false;
2851 ++ bool remain = false;
2852 + bool do_cts_eoma = false;
2853 + int packet;
2854 +
2855 +@@ -1750,7 +1783,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
2856 + __func__, session);
2857 + goto out_session_cancel;
2858 + }
2859 +- se_skb = j1939_session_skb_find(session);
2860 ++
2861 ++ se_skb = j1939_session_skb_find_by_offset(session, packet * 7);
2862 + if (!se_skb) {
2863 + netdev_warn(priv->ndev, "%s: 0x%p: no skb found\n", __func__,
2864 + session);
2865 +@@ -1777,6 +1811,8 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
2866 + j1939_cb_is_broadcast(&session->skcb)) {
2867 + if (session->pkt.rx >= session->pkt.total)
2868 + final = true;
2869 ++ else
2870 ++ remain = true;
2871 + } else {
2872 + /* never final, an EOMA must follow */
2873 + if (session->pkt.rx >= session->pkt.last)
2874 +@@ -1784,7 +1820,11 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
2875 + }
2876 +
2877 + if (final) {
2878 ++ j1939_session_timers_cancel(session);
2879 + j1939_session_completed(session);
2880 ++ } else if (remain) {
2881 ++ if (!session->transmission)
2882 ++ j1939_tp_set_rxtimeout(session, 750);
2883 + } else if (do_cts_eoma) {
2884 + j1939_tp_set_rxtimeout(session, 1250);
2885 + if (!session->transmission)
2886 +@@ -1829,6 +1869,13 @@ static void j1939_xtp_rx_dat(struct j1939_priv *priv, struct sk_buff *skb)
2887 + else
2888 + j1939_xtp_rx_dat_one(session, skb);
2889 + }
2890 ++
2891 ++ if (j1939_cb_is_broadcast(skcb)) {
2892 ++ session = j1939_session_get_by_addr(priv, &skcb->addr, false,
2893 ++ false);
2894 ++ if (session)
2895 ++ j1939_xtp_rx_dat_one(session, skb);
2896 ++ }
2897 + }
2898 +
2899 + /* j1939 main intf */
2900 +@@ -1920,7 +1967,7 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
2901 + if (j1939_tp_im_transmitter(skcb))
2902 + j1939_xtp_rx_rts(priv, skb, true);
2903 +
2904 +- if (j1939_tp_im_receiver(skcb))
2905 ++ if (j1939_tp_im_receiver(skcb) || j1939_cb_is_broadcast(skcb))
2906 + j1939_xtp_rx_rts(priv, skb, false);
2907 +
2908 + break;
2909 +@@ -1984,7 +2031,7 @@ int j1939_tp_recv(struct j1939_priv *priv, struct sk_buff *skb)
2910 + {
2911 + struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
2912 +
2913 +- if (!j1939_tp_im_involved_anydir(skcb))
2914 ++ if (!j1939_tp_im_involved_anydir(skcb) && !j1939_cb_is_broadcast(skcb))
2915 + return 0;
2916 +
2917 + switch (skcb->addr.pgn) {
2918 +@@ -2017,6 +2064,10 @@ void j1939_simple_recv(struct j1939_priv *priv, struct sk_buff *skb)
2919 + if (!skb->sk)
2920 + return;
2921 +
2922 ++ if (skb->sk->sk_family != AF_CAN ||
2923 ++ skb->sk->sk_protocol != CAN_J1939)
2924 ++ return;
2925 ++
2926 + j1939_session_list_lock(priv);
2927 + session = j1939_session_get_simple(priv, skb);
2928 + j1939_session_list_unlock(priv);
2929 +diff --git a/net/core/filter.c b/net/core/filter.c
2930 +index bd1e46d61d8a1..5c490d473df1d 100644
2931 +--- a/net/core/filter.c
2932 ++++ b/net/core/filter.c
2933 +@@ -8010,6 +8010,43 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
2934 + offsetof(OBJ, OBJ_FIELD)); \
2935 + } while (0)
2936 +
2937 ++#define SOCK_OPS_GET_SK() \
2938 ++ do { \
2939 ++ int fullsock_reg = si->dst_reg, reg = BPF_REG_9, jmp = 1; \
2940 ++ if (si->dst_reg == reg || si->src_reg == reg) \
2941 ++ reg--; \
2942 ++ if (si->dst_reg == reg || si->src_reg == reg) \
2943 ++ reg--; \
2944 ++ if (si->dst_reg == si->src_reg) { \
2945 ++ *insn++ = BPF_STX_MEM(BPF_DW, si->src_reg, reg, \
2946 ++ offsetof(struct bpf_sock_ops_kern, \
2947 ++ temp)); \
2948 ++ fullsock_reg = reg; \
2949 ++ jmp += 2; \
2950 ++ } \
2951 ++ *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF( \
2952 ++ struct bpf_sock_ops_kern, \
2953 ++ is_fullsock), \
2954 ++ fullsock_reg, si->src_reg, \
2955 ++ offsetof(struct bpf_sock_ops_kern, \
2956 ++ is_fullsock)); \
2957 ++ *insn++ = BPF_JMP_IMM(BPF_JEQ, fullsock_reg, 0, jmp); \
2958 ++ if (si->dst_reg == si->src_reg) \
2959 ++ *insn++ = BPF_LDX_MEM(BPF_DW, reg, si->src_reg, \
2960 ++ offsetof(struct bpf_sock_ops_kern, \
2961 ++ temp)); \
2962 ++ *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF( \
2963 ++ struct bpf_sock_ops_kern, sk),\
2964 ++ si->dst_reg, si->src_reg, \
2965 ++ offsetof(struct bpf_sock_ops_kern, sk));\
2966 ++ if (si->dst_reg == si->src_reg) { \
2967 ++ *insn++ = BPF_JMP_A(1); \
2968 ++ *insn++ = BPF_LDX_MEM(BPF_DW, reg, si->src_reg, \
2969 ++ offsetof(struct bpf_sock_ops_kern, \
2970 ++ temp)); \
2971 ++ } \
2972 ++ } while (0)
2973 ++
2974 + #define SOCK_OPS_GET_TCP_SOCK_FIELD(FIELD) \
2975 + SOCK_OPS_GET_FIELD(FIELD, FIELD, struct tcp_sock)
2976 +
2977 +@@ -8294,17 +8331,7 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
2978 + SOCK_OPS_GET_TCP_SOCK_FIELD(bytes_acked);
2979 + break;
2980 + case offsetof(struct bpf_sock_ops, sk):
2981 +- *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
2982 +- struct bpf_sock_ops_kern,
2983 +- is_fullsock),
2984 +- si->dst_reg, si->src_reg,
2985 +- offsetof(struct bpf_sock_ops_kern,
2986 +- is_fullsock));
2987 +- *insn++ = BPF_JMP_IMM(BPF_JEQ, si->dst_reg, 0, 1);
2988 +- *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(
2989 +- struct bpf_sock_ops_kern, sk),
2990 +- si->dst_reg, si->src_reg,
2991 +- offsetof(struct bpf_sock_ops_kern, sk));
2992 ++ SOCK_OPS_GET_SK();
2993 + break;
2994 + }
2995 + return insn - insn_buf;
2996 +diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c
2997 +index a5e8469859e39..427d77b111b17 100644
2998 +--- a/net/netfilter/nft_exthdr.c
2999 ++++ b/net/netfilter/nft_exthdr.c
3000 +@@ -44,7 +44,7 @@ static void nft_exthdr_ipv6_eval(const struct nft_expr *expr,
3001 +
3002 + err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL);
3003 + if (priv->flags & NFT_EXTHDR_F_PRESENT) {
3004 +- *dest = (err >= 0);
3005 ++ nft_reg_store8(dest, err >= 0);
3006 + return;
3007 + } else if (err < 0) {
3008 + goto err;
3009 +@@ -141,7 +141,7 @@ static void nft_exthdr_ipv4_eval(const struct nft_expr *expr,
3010 +
3011 + err = ipv4_find_option(nft_net(pkt), skb, &offset, priv->type);
3012 + if (priv->flags & NFT_EXTHDR_F_PRESENT) {
3013 +- *dest = (err >= 0);
3014 ++ nft_reg_store8(dest, err >= 0);
3015 + return;
3016 + } else if (err < 0) {
3017 + goto err;
3018 +diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
3019 +index 0ce4e75b29812..d803d814a03ad 100644
3020 +--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
3021 ++++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
3022 +@@ -265,6 +265,8 @@ static int svc_rdma_post_recv(struct svcxprt_rdma *rdma)
3023 + {
3024 + struct svc_rdma_recv_ctxt *ctxt;
3025 +
3026 ++ if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags))
3027 ++ return 0;
3028 + ctxt = svc_rdma_recv_ctxt_get(rdma);
3029 + if (!ctxt)
3030 + return -ENOMEM;
3031 +diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
3032 +index 0f8c77f847114..a94909ad9a53a 100644
3033 +--- a/scripts/kconfig/qconf.cc
3034 ++++ b/scripts/kconfig/qconf.cc
3035 +@@ -869,40 +869,40 @@ void ConfigList::focusInEvent(QFocusEvent *e)
3036 +
3037 + void ConfigList::contextMenuEvent(QContextMenuEvent *e)
3038 + {
3039 +- if (e->y() <= header()->geometry().bottom()) {
3040 +- if (!headerPopup) {
3041 +- QAction *action;
3042 +-
3043 +- headerPopup = new QMenu(this);
3044 +- action = new QAction("Show Name", this);
3045 +- action->setCheckable(true);
3046 +- connect(action, SIGNAL(toggled(bool)),
3047 +- parent(), SLOT(setShowName(bool)));
3048 +- connect(parent(), SIGNAL(showNameChanged(bool)),
3049 +- action, SLOT(setOn(bool)));
3050 +- action->setChecked(showName);
3051 +- headerPopup->addAction(action);
3052 +- action = new QAction("Show Range", this);
3053 +- action->setCheckable(true);
3054 +- connect(action, SIGNAL(toggled(bool)),
3055 +- parent(), SLOT(setShowRange(bool)));
3056 +- connect(parent(), SIGNAL(showRangeChanged(bool)),
3057 +- action, SLOT(setOn(bool)));
3058 +- action->setChecked(showRange);
3059 +- headerPopup->addAction(action);
3060 +- action = new QAction("Show Data", this);
3061 +- action->setCheckable(true);
3062 +- connect(action, SIGNAL(toggled(bool)),
3063 +- parent(), SLOT(setShowData(bool)));
3064 +- connect(parent(), SIGNAL(showDataChanged(bool)),
3065 +- action, SLOT(setOn(bool)));
3066 +- action->setChecked(showData);
3067 +- headerPopup->addAction(action);
3068 +- }
3069 +- headerPopup->exec(e->globalPos());
3070 +- e->accept();
3071 +- } else
3072 +- e->ignore();
3073 ++ if (!headerPopup) {
3074 ++ QAction *action;
3075 ++
3076 ++ headerPopup = new QMenu(this);
3077 ++ action = new QAction("Show Name", this);
3078 ++ action->setCheckable(true);
3079 ++ connect(action, SIGNAL(toggled(bool)),
3080 ++ parent(), SLOT(setShowName(bool)));
3081 ++ connect(parent(), SIGNAL(showNameChanged(bool)),
3082 ++ action, SLOT(setChecked(bool)));
3083 ++ action->setChecked(showName);
3084 ++ headerPopup->addAction(action);
3085 ++
3086 ++ action = new QAction("Show Range", this);
3087 ++ action->setCheckable(true);
3088 ++ connect(action, SIGNAL(toggled(bool)),
3089 ++ parent(), SLOT(setShowRange(bool)));
3090 ++ connect(parent(), SIGNAL(showRangeChanged(bool)),
3091 ++ action, SLOT(setChecked(bool)));
3092 ++ action->setChecked(showRange);
3093 ++ headerPopup->addAction(action);
3094 ++
3095 ++ action = new QAction("Show Data", this);
3096 ++ action->setCheckable(true);
3097 ++ connect(action, SIGNAL(toggled(bool)),
3098 ++ parent(), SLOT(setShowData(bool)));
3099 ++ connect(parent(), SIGNAL(showDataChanged(bool)),
3100 ++ action, SLOT(setChecked(bool)));
3101 ++ action->setChecked(showData);
3102 ++ headerPopup->addAction(action);
3103 ++ }
3104 ++
3105 ++ headerPopup->exec(e->globalPos());
3106 ++ e->accept();
3107 + }
3108 +
3109 + ConfigView*ConfigView::viewList;
3110 +@@ -1228,7 +1228,7 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
3111 +
3112 + action->setCheckable(true);
3113 + connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
3114 +- connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
3115 ++ connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool)));
3116 + action->setChecked(showDebug());
3117 + popup->addSeparator();
3118 + popup->addAction(action);
3119 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3120 +index 88629906f314c..06bbcfbb28153 100644
3121 +--- a/sound/pci/hda/patch_realtek.c
3122 ++++ b/sound/pci/hda/patch_realtek.c
3123 +@@ -7666,6 +7666,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3124 + SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
3125 + SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
3126 + SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
3127 ++ SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
3128 ++ SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
3129 + SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
3130 + SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
3131 + SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
3132 +diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
3133 +index 84289ebeae872..337bddb7c2a49 100644
3134 +--- a/sound/soc/codecs/msm8916-wcd-analog.c
3135 ++++ b/sound/soc/codecs/msm8916-wcd-analog.c
3136 +@@ -19,8 +19,8 @@
3137 +
3138 + #define CDC_D_REVISION1 (0xf000)
3139 + #define CDC_D_PERPH_SUBTYPE (0xf005)
3140 +-#define CDC_D_INT_EN_SET (0x015)
3141 +-#define CDC_D_INT_EN_CLR (0x016)
3142 ++#define CDC_D_INT_EN_SET (0xf015)
3143 ++#define CDC_D_INT_EN_CLR (0xf016)
3144 + #define MBHC_SWITCH_INT BIT(7)
3145 + #define MBHC_MIC_ELECTRICAL_INS_REM_DET BIT(6)
3146 + #define MBHC_BUTTON_PRESS_DET BIT(5)
3147 +diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
3148 +index 8cc3cc363eb03..31f1dd6541aa1 100644
3149 +--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
3150 ++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
3151 +@@ -331,7 +331,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
3152 +
3153 + ret_val = power_up_sst(stream);
3154 + if (ret_val < 0)
3155 +- return ret_val;
3156 ++ goto out_power_up;
3157 +
3158 + /* Make sure, that the period size is always even */
3159 + snd_pcm_hw_constraint_step(substream->runtime, 0,
3160 +@@ -340,8 +340,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
3161 + return snd_pcm_hw_constraint_integer(runtime,
3162 + SNDRV_PCM_HW_PARAM_PERIODS);
3163 + out_ops:
3164 +- kfree(stream);
3165 + mutex_unlock(&sst_lock);
3166 ++out_power_up:
3167 ++ kfree(stream);
3168 + return ret_val;
3169 + }
3170 +
3171 +diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c
3172 +index 2a5302f1db98a..0168af8492727 100644
3173 +--- a/sound/soc/qcom/qdsp6/q6afe-dai.c
3174 ++++ b/sound/soc/qcom/qdsp6/q6afe-dai.c
3175 +@@ -1150,206 +1150,206 @@ static int q6afe_of_xlate_dai_name(struct snd_soc_component *component,
3176 + }
3177 +
3178 + static const struct snd_soc_dapm_widget q6afe_dai_widgets[] = {
3179 +- SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, 0, 0, 0),
3180 +- SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, 0, 0, 0),
3181 +- SND_SOC_DAPM_AIF_IN("SLIMBUS_1_RX", NULL, 0, 0, 0, 0),
3182 +- SND_SOC_DAPM_AIF_IN("SLIMBUS_2_RX", NULL, 0, 0, 0, 0),
3183 +- SND_SOC_DAPM_AIF_IN("SLIMBUS_3_RX", NULL, 0, 0, 0, 0),
3184 +- SND_SOC_DAPM_AIF_IN("SLIMBUS_4_RX", NULL, 0, 0, 0, 0),
3185 +- SND_SOC_DAPM_AIF_IN("SLIMBUS_5_RX", NULL, 0, 0, 0, 0),
3186 +- SND_SOC_DAPM_AIF_IN("SLIMBUS_6_RX", NULL, 0, 0, 0, 0),
3187 +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_0_TX", NULL, 0, 0, 0, 0),
3188 +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_1_TX", NULL, 0, 0, 0, 0),
3189 +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_2_TX", NULL, 0, 0, 0, 0),
3190 +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_3_TX", NULL, 0, 0, 0, 0),
3191 +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_TX", NULL, 0, 0, 0, 0),
3192 +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_5_TX", NULL, 0, 0, 0, 0),
3193 +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_6_TX", NULL, 0, 0, 0, 0),
3194 ++ SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3195 ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3196 ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_1_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3197 ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_2_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3198 ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_3_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3199 ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_4_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3200 ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_5_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3201 ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_6_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
3202 ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_0_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
3203 ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_1_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
3204 ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_2_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
3205 ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_3_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
3206 ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
3207 ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_5_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
3208 ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_6_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
3209 + SND_SOC_DAPM_AIF_IN("QUAT_MI2S_RX", NULL,
3210 +- 0, 0, 0, 0),
3211 ++ 0, SND_SOC_NOPM, 0, 0),
3212 + SND_SOC_DAPM_AIF_OUT("QUAT_MI2S_TX", NULL,
3213 +- 0, 0, 0, 0),
3214 ++ 0, SND_SOC_NOPM, 0, 0),
3215 + SND_SOC_DAPM_AIF_IN("TERT_MI2S_RX", NULL,
3216 +- 0, 0, 0, 0),
3217 ++ 0, SND_SOC_NOPM, 0, 0),
3218 + SND_SOC_DAPM_AIF_OUT("TERT_MI2S_TX", NULL,
3219 +- 0, 0, 0, 0),
3220 ++ 0, SND_SOC_NOPM, 0, 0),
3221 + SND_SOC_DAPM_AIF_IN("SEC_MI2S_RX", NULL,
3222 +- 0, 0, 0, 0),
3223 ++ 0, SND_SOC_NOPM, 0, 0),
3224 + SND_SOC_DAPM_AIF_OUT("SEC_MI2S_TX", NULL,
3225 +- 0, 0, 0, 0),
3226 ++ 0, SND_SOC_NOPM, 0, 0),
3227 + SND_SOC_DAPM_AIF_IN("SEC_MI2S_RX_SD1",
3228 + "Secondary MI2S Playback SD1",
3229 +- 0, 0, 0, 0),
3230 ++ 0, SND_SOC_NOPM, 0, 0),
3231 + SND_SOC_DAPM_AIF_IN("PRI_MI2S_RX", NULL,
3232 +- 0, 0, 0, 0),
3233 ++ 0, SND_SOC_NOPM, 0, 0),
3234 + SND_SOC_DAPM_AIF_OUT("PRI_MI2S_TX", NULL,
3235 +- 0, 0, 0, 0),
3236 ++ 0, SND_SOC_NOPM, 0, 0),
3237 +
3238 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_0", NULL,
3239 +- 0, 0, 0, 0),
3240 ++ 0, SND_SOC_NOPM, 0, 0),
3241 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_1", NULL,
3242 +- 0, 0, 0, 0),
3243 ++ 0, SND_SOC_NOPM, 0, 0),
3244 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_2", NULL,
3245 +- 0, 0, 0, 0),
3246 ++ 0, SND_SOC_NOPM, 0, 0),
3247 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_3", NULL,
3248 +- 0, 0, 0, 0),
3249 ++ 0, SND_SOC_NOPM, 0, 0),
3250 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_4", NULL,
3251 +- 0, 0, 0, 0),
3252 ++ 0, SND_SOC_NOPM, 0, 0),
3253 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_5", NULL,
3254 +- 0, 0, 0, 0),
3255 ++ 0, SND_SOC_NOPM, 0, 0),
3256 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_6", NULL,
3257 +- 0, 0, 0, 0),
3258 ++ 0, SND_SOC_NOPM, 0, 0),
3259 + SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_7", NULL,
3260 +- 0, 0, 0, 0),
3261 ++ 0, SND_SOC_NOPM, 0, 0),
3262 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_0", NULL,
3263 +- 0, 0, 0, 0),
3264 ++ 0, SND_SOC_NOPM, 0, 0),
3265 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_1", NULL,
3266 +- 0, 0, 0, 0),
3267 ++ 0, SND_SOC_NOPM, 0, 0),
3268 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_2", NULL,
3269 +- 0, 0, 0, 0),
3270 ++ 0, SND_SOC_NOPM, 0, 0),
3271 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_3", NULL,
3272 +- 0, 0, 0, 0),
3273 ++ 0, SND_SOC_NOPM, 0, 0),
3274 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_4", NULL,
3275 +- 0, 0, 0, 0),
3276 ++ 0, SND_SOC_NOPM, 0, 0),
3277 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_5", NULL,
3278 +- 0, 0, 0, 0),
3279 ++ 0, SND_SOC_NOPM, 0, 0),
3280 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_6", NULL,
3281 +- 0, 0, 0, 0),
3282 ++ 0, SND_SOC_NOPM, 0, 0),
3283 + SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_7", NULL,
3284 +- 0, 0, 0, 0),
3285 ++ 0, SND_SOC_NOPM, 0, 0),
3286 +
3287 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_0", NULL,
3288 +- 0, 0, 0, 0),
3289 ++ 0, SND_SOC_NOPM, 0, 0),
3290 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_1", NULL,
3291 +- 0, 0, 0, 0),
3292 ++ 0, SND_SOC_NOPM, 0, 0),
3293 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_2", NULL,
3294 +- 0, 0, 0, 0),
3295 ++ 0, SND_SOC_NOPM, 0, 0),
3296 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_3", NULL,
3297 +- 0, 0, 0, 0),
3298 ++ 0, SND_SOC_NOPM, 0, 0),
3299 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_4", NULL,
3300 +- 0, 0, 0, 0),
3301 ++ 0, SND_SOC_NOPM, 0, 0),
3302 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_5", NULL,
3303 +- 0, 0, 0, 0),
3304 ++ 0, SND_SOC_NOPM, 0, 0),
3305 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_6", NULL,
3306 +- 0, 0, 0, 0),
3307 ++ 0, SND_SOC_NOPM, 0, 0),
3308 + SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_7", NULL,
3309 +- 0, 0, 0, 0),
3310 ++ 0, SND_SOC_NOPM, 0, 0),
3311 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_0", NULL,
3312 +- 0, 0, 0, 0),
3313 ++ 0, SND_SOC_NOPM, 0, 0),
3314 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_1", NULL,
3315 +- 0, 0, 0, 0),
3316 ++ 0, SND_SOC_NOPM, 0, 0),
3317 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_2", NULL,
3318 +- 0, 0, 0, 0),
3319 ++ 0, SND_SOC_NOPM, 0, 0),
3320 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_3", NULL,
3321 +- 0, 0, 0, 0),
3322 ++ 0, SND_SOC_NOPM, 0, 0),
3323 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_4", NULL,
3324 +- 0, 0, 0, 0),
3325 ++ 0, SND_SOC_NOPM, 0, 0),
3326 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_5", NULL,
3327 +- 0, 0, 0, 0),
3328 ++ 0, SND_SOC_NOPM, 0, 0),
3329 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_6", NULL,
3330 +- 0, 0, 0, 0),
3331 ++ 0, SND_SOC_NOPM, 0, 0),
3332 + SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_7", NULL,
3333 +- 0, 0, 0, 0),
3334 ++ 0, SND_SOC_NOPM, 0, 0),
3335 +
3336 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_0", NULL,
3337 +- 0, 0, 0, 0),
3338 ++ 0, SND_SOC_NOPM, 0, 0),
3339 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_1", NULL,
3340 +- 0, 0, 0, 0),
3341 ++ 0, SND_SOC_NOPM, 0, 0),
3342 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_2", NULL,
3343 +- 0, 0, 0, 0),
3344 ++ 0, SND_SOC_NOPM, 0, 0),
3345 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_3", NULL,
3346 +- 0, 0, 0, 0),
3347 ++ 0, SND_SOC_NOPM, 0, 0),
3348 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_4", NULL,
3349 +- 0, 0, 0, 0),
3350 ++ 0, SND_SOC_NOPM, 0, 0),
3351 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_5", NULL,
3352 +- 0, 0, 0, 0),
3353 ++ 0, SND_SOC_NOPM, 0, 0),
3354 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_6", NULL,
3355 +- 0, 0, 0, 0),
3356 ++ 0, SND_SOC_NOPM, 0, 0),
3357 + SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_7", NULL,
3358 +- 0, 0, 0, 0),
3359 ++ 0, SND_SOC_NOPM, 0, 0),
3360 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_0", NULL,
3361 +- 0, 0, 0, 0),
3362 ++ 0, SND_SOC_NOPM, 0, 0),
3363 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_1", NULL,
3364 +- 0, 0, 0, 0),
3365 ++ 0, SND_SOC_NOPM, 0, 0),
3366 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_2", NULL,
3367 +- 0, 0, 0, 0),
3368 ++ 0, SND_SOC_NOPM, 0, 0),
3369 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_3", NULL,
3370 +- 0, 0, 0, 0),
3371 ++ 0, SND_SOC_NOPM, 0, 0),
3372 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_4", NULL,
3373 +- 0, 0, 0, 0),
3374 ++ 0, SND_SOC_NOPM, 0, 0),
3375 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_5", NULL,
3376 +- 0, 0, 0, 0),
3377 ++ 0, SND_SOC_NOPM, 0, 0),
3378 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_6", NULL,
3379 +- 0, 0, 0, 0),
3380 ++ 0, SND_SOC_NOPM, 0, 0),
3381 + SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_7", NULL,
3382 +- 0, 0, 0, 0),
3383 ++ 0, SND_SOC_NOPM, 0, 0),
3384 +
3385 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_0", NULL,
3386 +- 0, 0, 0, 0),
3387 ++ 0, SND_SOC_NOPM, 0, 0),
3388 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_1", NULL,
3389 +- 0, 0, 0, 0),
3390 ++ 0, SND_SOC_NOPM, 0, 0),
3391 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_2", NULL,
3392 +- 0, 0, 0, 0),
3393 ++ 0, SND_SOC_NOPM, 0, 0),
3394 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_3", NULL,
3395 +- 0, 0, 0, 0),
3396 ++ 0, SND_SOC_NOPM, 0, 0),
3397 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_4", NULL,
3398 +- 0, 0, 0, 0),
3399 ++ 0, SND_SOC_NOPM, 0, 0),
3400 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_5", NULL,
3401 +- 0, 0, 0, 0),
3402 ++ 0, SND_SOC_NOPM, 0, 0),
3403 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_6", NULL,
3404 +- 0, 0, 0, 0),
3405 ++ 0, SND_SOC_NOPM, 0, 0),
3406 + SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_7", NULL,
3407 +- 0, 0, 0, 0),
3408 ++ 0, SND_SOC_NOPM, 0, 0),
3409 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_0", NULL,
3410 +- 0, 0, 0, 0),
3411 ++ 0, SND_SOC_NOPM, 0, 0),
3412 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_1", NULL,
3413 +- 0, 0, 0, 0),
3414 ++ 0, SND_SOC_NOPM, 0, 0),
3415 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_2", NULL,
3416 +- 0, 0, 0, 0),
3417 ++ 0, SND_SOC_NOPM, 0, 0),
3418 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_3", NULL,
3419 +- 0, 0, 0, 0),
3420 ++ 0, SND_SOC_NOPM, 0, 0),
3421 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_4", NULL,
3422 +- 0, 0, 0, 0),
3423 ++ 0, SND_SOC_NOPM, 0, 0),
3424 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_5", NULL,
3425 +- 0, 0, 0, 0),
3426 ++ 0, SND_SOC_NOPM, 0, 0),
3427 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_6", NULL,
3428 +- 0, 0, 0, 0),
3429 ++ 0, SND_SOC_NOPM, 0, 0),
3430 + SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_7", NULL,
3431 +- 0, 0, 0, 0),
3432 ++ 0, SND_SOC_NOPM, 0, 0),
3433 +
3434 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_0", NULL,
3435 +- 0, 0, 0, 0),
3436 ++ 0, SND_SOC_NOPM, 0, 0),
3437 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_1", NULL,
3438 +- 0, 0, 0, 0),
3439 ++ 0, SND_SOC_NOPM, 0, 0),
3440 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_2", NULL,
3441 +- 0, 0, 0, 0),
3442 ++ 0, SND_SOC_NOPM, 0, 0),
3443 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_3", NULL,
3444 +- 0, 0, 0, 0),
3445 ++ 0, SND_SOC_NOPM, 0, 0),
3446 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_4", NULL,
3447 +- 0, 0, 0, 0),
3448 ++ 0, SND_SOC_NOPM, 0, 0),
3449 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_5", NULL,
3450 +- 0, 0, 0, 0),
3451 ++ 0, SND_SOC_NOPM, 0, 0),
3452 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_6", NULL,
3453 +- 0, 0, 0, 0),
3454 ++ 0, SND_SOC_NOPM, 0, 0),
3455 + SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_7", NULL,
3456 +- 0, 0, 0, 0),
3457 ++ 0, SND_SOC_NOPM, 0, 0),
3458 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_0", NULL,
3459 +- 0, 0, 0, 0),
3460 ++ 0, SND_SOC_NOPM, 0, 0),
3461 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_1", NULL,
3462 +- 0, 0, 0, 0),
3463 ++ 0, SND_SOC_NOPM, 0, 0),
3464 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_2", NULL,
3465 +- 0, 0, 0, 0),
3466 ++ 0, SND_SOC_NOPM, 0, 0),
3467 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_3", NULL,
3468 +- 0, 0, 0, 0),
3469 ++ 0, SND_SOC_NOPM, 0, 0),
3470 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_4", NULL,
3471 +- 0, 0, 0, 0),
3472 ++ 0, SND_SOC_NOPM, 0, 0),
3473 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_5", NULL,
3474 +- 0, 0, 0, 0),
3475 ++ 0, SND_SOC_NOPM, 0, 0),
3476 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_6", NULL,
3477 +- 0, 0, 0, 0),
3478 ++ 0, SND_SOC_NOPM, 0, 0),
3479 + SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_7", NULL,
3480 +- 0, 0, 0, 0),
3481 +- SND_SOC_DAPM_AIF_OUT("DISPLAY_PORT_RX", "NULL", 0, 0, 0, 0),
3482 ++ 0, SND_SOC_NOPM, 0, 0),
3483 ++ SND_SOC_DAPM_AIF_OUT("DISPLAY_PORT_RX", "NULL", 0, SND_SOC_NOPM, 0, 0),
3484 + };
3485 +
3486 + static const struct snd_soc_component_driver q6afe_dai_component = {
3487 +diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
3488 +index ddcd9978cf57b..745cc9dd14f38 100644
3489 +--- a/sound/soc/qcom/qdsp6/q6routing.c
3490 ++++ b/sound/soc/qcom/qdsp6/q6routing.c
3491 +@@ -996,6 +996,20 @@ static int msm_routing_probe(struct snd_soc_component *c)
3492 + return 0;
3493 + }
3494 +
3495 ++static unsigned int q6routing_reg_read(struct snd_soc_component *component,
3496 ++ unsigned int reg)
3497 ++{
3498 ++ /* default value */
3499 ++ return 0;
3500 ++}
3501 ++
3502 ++static int q6routing_reg_write(struct snd_soc_component *component,
3503 ++ unsigned int reg, unsigned int val)
3504 ++{
3505 ++ /* dummy */
3506 ++ return 0;
3507 ++}
3508 ++
3509 + static const struct snd_soc_component_driver msm_soc_routing_component = {
3510 + .ops = &q6pcm_routing_ops,
3511 + .probe = msm_routing_probe,
3512 +@@ -1004,6 +1018,8 @@ static const struct snd_soc_component_driver msm_soc_routing_component = {
3513 + .num_dapm_widgets = ARRAY_SIZE(msm_qdsp6_widgets),
3514 + .dapm_routes = intercon,
3515 + .num_dapm_routes = ARRAY_SIZE(intercon),
3516 ++ .read = q6routing_reg_read,
3517 ++ .write = q6routing_reg_write,
3518 + };
3519 +
3520 + static int q6pcm_routing_probe(struct platform_device *pdev)
3521 +diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
3522 +index ee08aeff30a19..f591c4d1b6fe2 100644
3523 +--- a/tools/objtool/Makefile
3524 ++++ b/tools/objtool/Makefile
3525 +@@ -3,9 +3,15 @@ include ../scripts/Makefile.include
3526 + include ../scripts/Makefile.arch
3527 +
3528 + # always use the host compiler
3529 ++ifneq ($(LLVM),)
3530 ++HOSTAR ?= llvm-ar
3531 ++HOSTCC ?= clang
3532 ++HOSTLD ?= ld.lld
3533 ++else
3534 + HOSTAR ?= ar
3535 + HOSTCC ?= gcc
3536 + HOSTLD ?= ld
3537 ++endif
3538 + AR = $(HOSTAR)
3539 + CC = $(HOSTCC)
3540 + LD = $(HOSTLD)
3541 +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
3542 +index dc9d495e3d6ab..849d8d2e5976b 100644
3543 +--- a/tools/perf/util/probe-finder.c
3544 ++++ b/tools/perf/util/probe-finder.c
3545 +@@ -1362,7 +1362,7 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
3546 + tf.ntevs = 0;
3547 +
3548 + ret = debuginfo__find_probes(dbg, &tf.pf);
3549 +- if (ret < 0) {
3550 ++ if (ret < 0 || tf.ntevs == 0) {
3551 + for (i = 0; i < tf.ntevs; i++)
3552 + clear_probe_trace_event(&tf.tevs[i]);
3553 + zfree(tevs);
3554 +diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
3555 +index bdb69599c4bdc..5e939ff1e3f95 100644
3556 +--- a/tools/testing/selftests/cgroup/cgroup_util.c
3557 ++++ b/tools/testing/selftests/cgroup/cgroup_util.c
3558 +@@ -105,7 +105,7 @@ int cg_read_strcmp(const char *cgroup, const char *control,
3559 +
3560 + /* Handle the case of comparing against empty string */
3561 + if (!expected)
3562 +- size = 32;
3563 ++ return -1;
3564 + else
3565 + size = strlen(expected) + 1;
3566 +
3567 +diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c
3568 +index 767ac4eab4fe9..7501ec8a46004 100644
3569 +--- a/virt/kvm/arm/mmu.c
3570 ++++ b/virt/kvm/arm/mmu.c
3571 +@@ -332,7 +332,8 @@ static void unmap_stage2_puds(struct kvm *kvm, pgd_t *pgd,
3572 + * destroying the VM), otherwise another faulting VCPU may come in and mess
3573 + * with things behind our backs.
3574 + */
3575 +-static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
3576 ++static void __unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size,
3577 ++ bool may_block)
3578 + {
3579 + pgd_t *pgd;
3580 + phys_addr_t addr = start, end = start + size;
3581 +@@ -357,11 +358,16 @@ static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
3582 + * If the range is too large, release the kvm->mmu_lock
3583 + * to prevent starvation and lockup detector warnings.
3584 + */
3585 +- if (next != end)
3586 ++ if (may_block && next != end)
3587 + cond_resched_lock(&kvm->mmu_lock);
3588 + } while (pgd++, addr = next, addr != end);
3589 + }
3590 +
3591 ++static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
3592 ++{
3593 ++ __unmap_stage2_range(kvm, start, size, true);
3594 ++}
3595 ++
3596 + static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
3597 + phys_addr_t addr, phys_addr_t end)
3598 + {
3599 +@@ -2045,18 +2051,21 @@ static int handle_hva_to_gpa(struct kvm *kvm,
3600 +
3601 + static int kvm_unmap_hva_handler(struct kvm *kvm, gpa_t gpa, u64 size, void *data)
3602 + {
3603 +- unmap_stage2_range(kvm, gpa, size);
3604 ++ unsigned flags = *(unsigned *)data;
3605 ++ bool may_block = flags & MMU_NOTIFIER_RANGE_BLOCKABLE;
3606 ++
3607 ++ __unmap_stage2_range(kvm, gpa, size, may_block);
3608 + return 0;
3609 + }
3610 +
3611 + int kvm_unmap_hva_range(struct kvm *kvm,
3612 +- unsigned long start, unsigned long end)
3613 ++ unsigned long start, unsigned long end, unsigned flags)
3614 + {
3615 + if (!kvm->arch.pgd)
3616 + return 0;
3617 +
3618 + trace_kvm_unmap_hva_range(start, end);
3619 +- handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, NULL);
3620 ++ handle_hva_to_gpa(kvm, start, end, &kvm_unmap_hva_handler, &flags);
3621 + return 0;
3622 + }
3623 +
3624 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
3625 +index d5d4cd581af32..278bdc53047e8 100644
3626 +--- a/virt/kvm/kvm_main.c
3627 ++++ b/virt/kvm/kvm_main.c
3628 +@@ -425,7 +425,8 @@ static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
3629 + * count is also read inside the mmu_lock critical section.
3630 + */
3631 + kvm->mmu_notifier_count++;
3632 +- need_tlb_flush = kvm_unmap_hva_range(kvm, range->start, range->end);
3633 ++ need_tlb_flush = kvm_unmap_hva_range(kvm, range->start, range->end,
3634 ++ range->flags);
3635 + need_tlb_flush |= kvm->tlbs_dirty;
3636 + /* we've to flush the tlb before the pages can be freed */
3637 + if (need_tlb_flush)