Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Fri, 17 Aug 2018 19:26:00
Message-Id: 1534533946.caf35e4ea48da0c3fc42812affc0a96e3ffebc7d.mpagano@gentoo
1 commit: caf35e4ea48da0c3fc42812affc0a96e3ffebc7d
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 17 19:25:46 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 17 19:25:46 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=caf35e4e
7
8 Linux patch 4.9.121
9
10 0000_README | 4 +
11 1120_linux-4.9.121.patch | 1234 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1238 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 7fd9f53..17809f7 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -523,6 +523,10 @@ Patch: 1119_linux-4.9.120.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.120
21
22 +Patch: 1120_linux-4.9.121.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.121
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1120_linux-4.9.121.patch b/1120_linux-4.9.121.patch
31 new file mode 100644
32 index 0000000..9a6e77d
33 --- /dev/null
34 +++ b/1120_linux-4.9.121.patch
35 @@ -0,0 +1,1234 @@
36 +diff --git a/Documentation/Changes b/Documentation/Changes
37 +index 22797a15dc24..76d6dc0d3227 100644
38 +--- a/Documentation/Changes
39 ++++ b/Documentation/Changes
40 +@@ -33,7 +33,7 @@ GNU C 3.2 gcc --version
41 + GNU make 3.80 make --version
42 + binutils 2.12 ld -v
43 + util-linux 2.10o fdformat --version
44 +-module-init-tools 0.9.10 depmod -V
45 ++kmod 13 depmod -V
46 + e2fsprogs 1.41.4 e2fsck -V
47 + jfsutils 1.1.3 fsck.jfs -V
48 + reiserfsprogs 3.6.3 reiserfsck -V
49 +@@ -143,12 +143,6 @@ is not build with ``CONFIG_KALLSYMS`` and you have no way to rebuild and
50 + reproduce the Oops with that option, then you can still decode that Oops
51 + with ksymoops.
52 +
53 +-Module-Init-Tools
54 +------------------
55 +-
56 +-A new module loader is now in the kernel that requires ``module-init-tools``
57 +-to use. It is backward compatible with the 2.4.x series kernels.
58 +-
59 + Mkinitrd
60 + --------
61 +
62 +@@ -363,16 +357,17 @@ Util-linux
63 +
64 + - <ftp://ftp.kernel.org/pub/linux/utils/util-linux/>
65 +
66 ++Kmod
67 ++----
68 ++
69 ++- <https://www.kernel.org/pub/linux/utils/kernel/kmod/>
70 ++- <https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git>
71 ++
72 + Ksymoops
73 + --------
74 +
75 + - <ftp://ftp.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/>
76 +
77 +-Module-Init-Tools
78 +------------------
79 +-
80 +-- <ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/>
81 +-
82 + Mkinitrd
83 + --------
84 +
85 +diff --git a/Makefile b/Makefile
86 +index fea2fe577185..e54a126841a9 100644
87 +--- a/Makefile
88 ++++ b/Makefile
89 +@@ -1,6 +1,6 @@
90 + VERSION = 4
91 + PATCHLEVEL = 9
92 +-SUBLEVEL = 120
93 ++SUBLEVEL = 121
94 + EXTRAVERSION =
95 + NAME = Roaring Lionus
96 +
97 +@@ -417,7 +417,8 @@ export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
98 + export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
99 +
100 + export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
101 +-export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_KASAN CFLAGS_UBSAN
102 ++export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
103 ++export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
104 + export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
105 + export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
106 + export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
107 +diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
108 +index 4cd4862845cd..0a56898f8410 100644
109 +--- a/arch/arm64/mm/mmu.c
110 ++++ b/arch/arm64/mm/mmu.c
111 +@@ -804,12 +804,12 @@ int pmd_clear_huge(pmd_t *pmd)
112 + return 1;
113 + }
114 +
115 +-int pud_free_pmd_page(pud_t *pud)
116 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr)
117 + {
118 + return pud_none(*pud);
119 + }
120 +
121 +-int pmd_free_pte_page(pmd_t *pmd)
122 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
123 + {
124 + return pmd_none(*pmd);
125 + }
126 +diff --git a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
127 +index ec9bee661d50..b7f50427a3ef 100644
128 +--- a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
129 ++++ b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
130 +@@ -265,7 +265,7 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2)
131 + vpinsrd $1, _args_digest+1*32(state, idx, 4), %xmm0, %xmm0
132 + vpinsrd $2, _args_digest+2*32(state, idx, 4), %xmm0, %xmm0
133 + vpinsrd $3, _args_digest+3*32(state, idx, 4), %xmm0, %xmm0
134 +- vmovd _args_digest(state , idx, 4) , %xmm0
135 ++ vmovd _args_digest+4*32(state, idx, 4), %xmm1
136 + vpinsrd $1, _args_digest+5*32(state, idx, 4), %xmm1, %xmm1
137 + vpinsrd $2, _args_digest+6*32(state, idx, 4), %xmm1, %xmm1
138 + vpinsrd $3, _args_digest+7*32(state, idx, 4), %xmm1, %xmm1
139 +diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h
140 +index bb078786a323..be6492c0deae 100644
141 +--- a/arch/x86/include/asm/i8259.h
142 ++++ b/arch/x86/include/asm/i8259.h
143 +@@ -2,6 +2,7 @@
144 + #define _ASM_X86_I8259_H
145 +
146 + #include <linux/delay.h>
147 ++#include <asm/io.h>
148 +
149 + extern unsigned int cached_irq_mask;
150 +
151 +diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
152 +index 5229eaf73828..ac67a76550bd 100644
153 +--- a/arch/x86/kernel/cpu/bugs.c
154 ++++ b/arch/x86/kernel/cpu/bugs.c
155 +@@ -647,10 +647,9 @@ void x86_spec_ctrl_setup_ap(void)
156 + enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
157 + #if IS_ENABLED(CONFIG_KVM_INTEL)
158 + EXPORT_SYMBOL_GPL(l1tf_mitigation);
159 +-
160 ++#endif
161 + enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
162 + EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
163 +-#endif
164 +
165 + static void __init l1tf_select_mitigation(void)
166 + {
167 +diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
168 +index a3b63e5a527c..e30baa8ad94f 100644
169 +--- a/arch/x86/mm/pgtable.c
170 ++++ b/arch/x86/mm/pgtable.c
171 +@@ -653,28 +653,50 @@ int pmd_clear_huge(pmd_t *pmd)
172 + return 0;
173 + }
174 +
175 ++#ifdef CONFIG_X86_64
176 + /**
177 + * pud_free_pmd_page - Clear pud entry and free pmd page.
178 + * @pud: Pointer to a PUD.
179 ++ * @addr: Virtual address associated with pud.
180 + *
181 +- * Context: The pud range has been unmaped and TLB purged.
182 ++ * Context: The pud range has been unmapped and TLB purged.
183 + * Return: 1 if clearing the entry succeeded. 0 otherwise.
184 ++ *
185 ++ * NOTE: Callers must allow a single page allocation.
186 + */
187 +-int pud_free_pmd_page(pud_t *pud)
188 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr)
189 + {
190 +- pmd_t *pmd;
191 ++ pmd_t *pmd, *pmd_sv;
192 ++ pte_t *pte;
193 + int i;
194 +
195 + if (pud_none(*pud))
196 + return 1;
197 +
198 + pmd = (pmd_t *)pud_page_vaddr(*pud);
199 ++ pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL);
200 ++ if (!pmd_sv)
201 ++ return 0;
202 +
203 +- for (i = 0; i < PTRS_PER_PMD; i++)
204 +- if (!pmd_free_pte_page(&pmd[i]))
205 +- return 0;
206 ++ for (i = 0; i < PTRS_PER_PMD; i++) {
207 ++ pmd_sv[i] = pmd[i];
208 ++ if (!pmd_none(pmd[i]))
209 ++ pmd_clear(&pmd[i]);
210 ++ }
211 +
212 + pud_clear(pud);
213 ++
214 ++ /* INVLPG to clear all paging-structure caches */
215 ++ flush_tlb_kernel_range(addr, addr + PAGE_SIZE-1);
216 ++
217 ++ for (i = 0; i < PTRS_PER_PMD; i++) {
218 ++ if (!pmd_none(pmd_sv[i])) {
219 ++ pte = (pte_t *)pmd_page_vaddr(pmd_sv[i]);
220 ++ free_page((unsigned long)pte);
221 ++ }
222 ++ }
223 ++
224 ++ free_page((unsigned long)pmd_sv);
225 + free_page((unsigned long)pmd);
226 +
227 + return 1;
228 +@@ -683,11 +705,12 @@ int pud_free_pmd_page(pud_t *pud)
229 + /**
230 + * pmd_free_pte_page - Clear pmd entry and free pte page.
231 + * @pmd: Pointer to a PMD.
232 ++ * @addr: Virtual address associated with pmd.
233 + *
234 +- * Context: The pmd range has been unmaped and TLB purged.
235 ++ * Context: The pmd range has been unmapped and TLB purged.
236 + * Return: 1 if clearing the entry succeeded. 0 otherwise.
237 + */
238 +-int pmd_free_pte_page(pmd_t *pmd)
239 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
240 + {
241 + pte_t *pte;
242 +
243 +@@ -696,8 +719,30 @@ int pmd_free_pte_page(pmd_t *pmd)
244 +
245 + pte = (pte_t *)pmd_page_vaddr(*pmd);
246 + pmd_clear(pmd);
247 ++
248 ++ /* INVLPG to clear all paging-structure caches */
249 ++ flush_tlb_kernel_range(addr, addr + PAGE_SIZE-1);
250 ++
251 + free_page((unsigned long)pte);
252 +
253 + return 1;
254 + }
255 ++
256 ++#else /* !CONFIG_X86_64 */
257 ++
258 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr)
259 ++{
260 ++ return pud_none(*pud);
261 ++}
262 ++
263 ++/*
264 ++ * Disable free page handling on x86-PAE. This assures that ioremap()
265 ++ * does not update sync'd pmd entries. See vmalloc_sync_one().
266 ++ */
267 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
268 ++{
269 ++ return pmd_none(*pmd);
270 ++}
271 ++
272 ++#endif /* CONFIG_X86_64 */
273 + #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
274 +diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
275 +index d676fc59521a..860c9e5dfd7a 100644
276 +--- a/crypto/ablkcipher.c
277 ++++ b/crypto/ablkcipher.c
278 +@@ -70,11 +70,9 @@ static inline u8 *ablkcipher_get_spot(u8 *start, unsigned int len)
279 + return max(start, end_page);
280 + }
281 +
282 +-static inline unsigned int ablkcipher_done_slow(struct ablkcipher_walk *walk,
283 +- unsigned int bsize)
284 ++static inline void ablkcipher_done_slow(struct ablkcipher_walk *walk,
285 ++ unsigned int n)
286 + {
287 +- unsigned int n = bsize;
288 +-
289 + for (;;) {
290 + unsigned int len_this_page = scatterwalk_pagelen(&walk->out);
291 +
292 +@@ -86,17 +84,13 @@ static inline unsigned int ablkcipher_done_slow(struct ablkcipher_walk *walk,
293 + n -= len_this_page;
294 + scatterwalk_start(&walk->out, sg_next(walk->out.sg));
295 + }
296 +-
297 +- return bsize;
298 + }
299 +
300 +-static inline unsigned int ablkcipher_done_fast(struct ablkcipher_walk *walk,
301 +- unsigned int n)
302 ++static inline void ablkcipher_done_fast(struct ablkcipher_walk *walk,
303 ++ unsigned int n)
304 + {
305 + scatterwalk_advance(&walk->in, n);
306 + scatterwalk_advance(&walk->out, n);
307 +-
308 +- return n;
309 + }
310 +
311 + static int ablkcipher_walk_next(struct ablkcipher_request *req,
312 +@@ -106,39 +100,40 @@ int ablkcipher_walk_done(struct ablkcipher_request *req,
313 + struct ablkcipher_walk *walk, int err)
314 + {
315 + struct crypto_tfm *tfm = req->base.tfm;
316 +- unsigned int nbytes = 0;
317 ++ unsigned int n; /* bytes processed */
318 ++ bool more;
319 +
320 +- if (likely(err >= 0)) {
321 +- unsigned int n = walk->nbytes - err;
322 ++ if (unlikely(err < 0))
323 ++ goto finish;
324 +
325 +- if (likely(!(walk->flags & ABLKCIPHER_WALK_SLOW)))
326 +- n = ablkcipher_done_fast(walk, n);
327 +- else if (WARN_ON(err)) {
328 +- err = -EINVAL;
329 +- goto err;
330 +- } else
331 +- n = ablkcipher_done_slow(walk, n);
332 ++ n = walk->nbytes - err;
333 ++ walk->total -= n;
334 ++ more = (walk->total != 0);
335 +
336 +- nbytes = walk->total - n;
337 +- err = 0;
338 ++ if (likely(!(walk->flags & ABLKCIPHER_WALK_SLOW))) {
339 ++ ablkcipher_done_fast(walk, n);
340 ++ } else {
341 ++ if (WARN_ON(err)) {
342 ++ /* unexpected case; didn't process all bytes */
343 ++ err = -EINVAL;
344 ++ goto finish;
345 ++ }
346 ++ ablkcipher_done_slow(walk, n);
347 + }
348 +
349 +- scatterwalk_done(&walk->in, 0, nbytes);
350 +- scatterwalk_done(&walk->out, 1, nbytes);
351 +-
352 +-err:
353 +- walk->total = nbytes;
354 +- walk->nbytes = nbytes;
355 ++ scatterwalk_done(&walk->in, 0, more);
356 ++ scatterwalk_done(&walk->out, 1, more);
357 +
358 +- if (nbytes) {
359 ++ if (more) {
360 + crypto_yield(req->base.flags);
361 + return ablkcipher_walk_next(req, walk);
362 + }
363 +-
364 ++ err = 0;
365 ++finish:
366 ++ walk->nbytes = 0;
367 + if (walk->iv != req->info)
368 + memcpy(req->info, walk->iv, tfm->crt_ablkcipher.ivsize);
369 + kfree(walk->iv_buffer);
370 +-
371 + return err;
372 + }
373 + EXPORT_SYMBOL_GPL(ablkcipher_walk_done);
374 +diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
375 +index a832426820e8..27f98666763a 100644
376 +--- a/crypto/blkcipher.c
377 ++++ b/crypto/blkcipher.c
378 +@@ -70,19 +70,18 @@ static inline u8 *blkcipher_get_spot(u8 *start, unsigned int len)
379 + return max(start, end_page);
380 + }
381 +
382 +-static inline unsigned int blkcipher_done_slow(struct blkcipher_walk *walk,
383 +- unsigned int bsize)
384 ++static inline void blkcipher_done_slow(struct blkcipher_walk *walk,
385 ++ unsigned int bsize)
386 + {
387 + u8 *addr;
388 +
389 + addr = (u8 *)ALIGN((unsigned long)walk->buffer, walk->alignmask + 1);
390 + addr = blkcipher_get_spot(addr, bsize);
391 + scatterwalk_copychunks(addr, &walk->out, bsize, 1);
392 +- return bsize;
393 + }
394 +
395 +-static inline unsigned int blkcipher_done_fast(struct blkcipher_walk *walk,
396 +- unsigned int n)
397 ++static inline void blkcipher_done_fast(struct blkcipher_walk *walk,
398 ++ unsigned int n)
399 + {
400 + if (walk->flags & BLKCIPHER_WALK_COPY) {
401 + blkcipher_map_dst(walk);
402 +@@ -96,49 +95,48 @@ static inline unsigned int blkcipher_done_fast(struct blkcipher_walk *walk,
403 +
404 + scatterwalk_advance(&walk->in, n);
405 + scatterwalk_advance(&walk->out, n);
406 +-
407 +- return n;
408 + }
409 +
410 + int blkcipher_walk_done(struct blkcipher_desc *desc,
411 + struct blkcipher_walk *walk, int err)
412 + {
413 +- unsigned int nbytes = 0;
414 ++ unsigned int n; /* bytes processed */
415 ++ bool more;
416 +
417 +- if (likely(err >= 0)) {
418 +- unsigned int n = walk->nbytes - err;
419 ++ if (unlikely(err < 0))
420 ++ goto finish;
421 +
422 +- if (likely(!(walk->flags & BLKCIPHER_WALK_SLOW)))
423 +- n = blkcipher_done_fast(walk, n);
424 +- else if (WARN_ON(err)) {
425 +- err = -EINVAL;
426 +- goto err;
427 +- } else
428 +- n = blkcipher_done_slow(walk, n);
429 ++ n = walk->nbytes - err;
430 ++ walk->total -= n;
431 ++ more = (walk->total != 0);
432 +
433 +- nbytes = walk->total - n;
434 +- err = 0;
435 ++ if (likely(!(walk->flags & BLKCIPHER_WALK_SLOW))) {
436 ++ blkcipher_done_fast(walk, n);
437 ++ } else {
438 ++ if (WARN_ON(err)) {
439 ++ /* unexpected case; didn't process all bytes */
440 ++ err = -EINVAL;
441 ++ goto finish;
442 ++ }
443 ++ blkcipher_done_slow(walk, n);
444 + }
445 +
446 +- scatterwalk_done(&walk->in, 0, nbytes);
447 +- scatterwalk_done(&walk->out, 1, nbytes);
448 ++ scatterwalk_done(&walk->in, 0, more);
449 ++ scatterwalk_done(&walk->out, 1, more);
450 +
451 +-err:
452 +- walk->total = nbytes;
453 +- walk->nbytes = nbytes;
454 +-
455 +- if (nbytes) {
456 ++ if (more) {
457 + crypto_yield(desc->flags);
458 + return blkcipher_walk_next(desc, walk);
459 + }
460 +-
461 ++ err = 0;
462 ++finish:
463 ++ walk->nbytes = 0;
464 + if (walk->iv != desc->info)
465 + memcpy(desc->info, walk->iv, walk->ivsize);
466 + if (walk->buffer != walk->page)
467 + kfree(walk->buffer);
468 + if (walk->page)
469 + free_page((unsigned long)walk->page);
470 +-
471 + return err;
472 + }
473 + EXPORT_SYMBOL_GPL(blkcipher_walk_done);
474 +diff --git a/crypto/vmac.c b/crypto/vmac.c
475 +index df76a816cfb2..bb2fc787d615 100644
476 +--- a/crypto/vmac.c
477 ++++ b/crypto/vmac.c
478 +@@ -1,6 +1,10 @@
479 + /*
480 +- * Modified to interface to the Linux kernel
481 ++ * VMAC: Message Authentication Code using Universal Hashing
482 ++ *
483 ++ * Reference: https://tools.ietf.org/html/draft-krovetz-vmac-01
484 ++ *
485 + * Copyright (c) 2009, Intel Corporation.
486 ++ * Copyright (c) 2018, Google Inc.
487 + *
488 + * This program is free software; you can redistribute it and/or modify it
489 + * under the terms and conditions of the GNU General Public License,
490 +@@ -16,14 +20,15 @@
491 + * Place - Suite 330, Boston, MA 02111-1307 USA.
492 + */
493 +
494 +-/* --------------------------------------------------------------------------
495 +- * VMAC and VHASH Implementation by Ted Krovetz (tdk@×××.org) and Wei Dai.
496 +- * This implementation is herby placed in the public domain.
497 +- * The authors offers no warranty. Use at your own risk.
498 +- * Please send bug reports to the authors.
499 +- * Last modified: 17 APR 08, 1700 PDT
500 +- * ----------------------------------------------------------------------- */
501 ++/*
502 ++ * Derived from:
503 ++ * VMAC and VHASH Implementation by Ted Krovetz (tdk@×××.org) and Wei Dai.
504 ++ * This implementation is herby placed in the public domain.
505 ++ * The authors offers no warranty. Use at your own risk.
506 ++ * Last modified: 17 APR 08, 1700 PDT
507 ++ */
508 +
509 ++#include <asm/unaligned.h>
510 + #include <linux/init.h>
511 + #include <linux/types.h>
512 + #include <linux/crypto.h>
513 +@@ -31,9 +36,35 @@
514 + #include <linux/scatterlist.h>
515 + #include <asm/byteorder.h>
516 + #include <crypto/scatterwalk.h>
517 +-#include <crypto/vmac.h>
518 + #include <crypto/internal/hash.h>
519 +
520 ++/*
521 ++ * User definable settings.
522 ++ */
523 ++#define VMAC_TAG_LEN 64
524 ++#define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */
525 ++#define VMAC_KEY_LEN (VMAC_KEY_SIZE/8)
526 ++#define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/
527 ++
528 ++/* per-transform (per-key) context */
529 ++struct vmac_tfm_ctx {
530 ++ struct crypto_cipher *cipher;
531 ++ u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
532 ++ u64 polykey[2*VMAC_TAG_LEN/64];
533 ++ u64 l3key[2*VMAC_TAG_LEN/64];
534 ++};
535 ++
536 ++/* per-request context */
537 ++struct vmac_desc_ctx {
538 ++ union {
539 ++ u8 partial[VMAC_NHBYTES]; /* partial block */
540 ++ __le64 partial_words[VMAC_NHBYTES / 8];
541 ++ };
542 ++ unsigned int partial_size; /* size of the partial block */
543 ++ bool first_block_processed;
544 ++ u64 polytmp[2*VMAC_TAG_LEN/64]; /* running total of L2-hash */
545 ++};
546 ++
547 + /*
548 + * Constants and masks
549 + */
550 +@@ -318,13 +349,6 @@ static void poly_step_func(u64 *ahi, u64 *alo,
551 + } while (0)
552 + #endif
553 +
554 +-static void vhash_abort(struct vmac_ctx *ctx)
555 +-{
556 +- ctx->polytmp[0] = ctx->polykey[0] ;
557 +- ctx->polytmp[1] = ctx->polykey[1] ;
558 +- ctx->first_block_processed = 0;
559 +-}
560 +-
561 + static u64 l3hash(u64 p1, u64 p2, u64 k1, u64 k2, u64 len)
562 + {
563 + u64 rh, rl, t, z = 0;
564 +@@ -364,280 +388,209 @@ static u64 l3hash(u64 p1, u64 p2, u64 k1, u64 k2, u64 len)
565 + return rl;
566 + }
567 +
568 +-static void vhash_update(const unsigned char *m,
569 +- unsigned int mbytes, /* Pos multiple of VMAC_NHBYTES */
570 +- struct vmac_ctx *ctx)
571 ++/* L1 and L2-hash one or more VMAC_NHBYTES-byte blocks */
572 ++static void vhash_blocks(const struct vmac_tfm_ctx *tctx,
573 ++ struct vmac_desc_ctx *dctx,
574 ++ const __le64 *mptr, unsigned int blocks)
575 + {
576 +- u64 rh, rl, *mptr;
577 +- const u64 *kptr = (u64 *)ctx->nhkey;
578 +- int i;
579 +- u64 ch, cl;
580 +- u64 pkh = ctx->polykey[0];
581 +- u64 pkl = ctx->polykey[1];
582 +-
583 +- if (!mbytes)
584 +- return;
585 +-
586 +- BUG_ON(mbytes % VMAC_NHBYTES);
587 +-
588 +- mptr = (u64 *)m;
589 +- i = mbytes / VMAC_NHBYTES; /* Must be non-zero */
590 +-
591 +- ch = ctx->polytmp[0];
592 +- cl = ctx->polytmp[1];
593 +-
594 +- if (!ctx->first_block_processed) {
595 +- ctx->first_block_processed = 1;
596 ++ const u64 *kptr = tctx->nhkey;
597 ++ const u64 pkh = tctx->polykey[0];
598 ++ const u64 pkl = tctx->polykey[1];
599 ++ u64 ch = dctx->polytmp[0];
600 ++ u64 cl = dctx->polytmp[1];
601 ++ u64 rh, rl;
602 ++
603 ++ if (!dctx->first_block_processed) {
604 ++ dctx->first_block_processed = true;
605 + nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
606 + rh &= m62;
607 + ADD128(ch, cl, rh, rl);
608 + mptr += (VMAC_NHBYTES/sizeof(u64));
609 +- i--;
610 ++ blocks--;
611 + }
612 +
613 +- while (i--) {
614 ++ while (blocks--) {
615 + nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
616 + rh &= m62;
617 + poly_step(ch, cl, pkh, pkl, rh, rl);
618 + mptr += (VMAC_NHBYTES/sizeof(u64));
619 + }
620 +
621 +- ctx->polytmp[0] = ch;
622 +- ctx->polytmp[1] = cl;
623 ++ dctx->polytmp[0] = ch;
624 ++ dctx->polytmp[1] = cl;
625 + }
626 +
627 +-static u64 vhash(unsigned char m[], unsigned int mbytes,
628 +- u64 *tagl, struct vmac_ctx *ctx)
629 ++static int vmac_setkey(struct crypto_shash *tfm,
630 ++ const u8 *key, unsigned int keylen)
631 + {
632 +- u64 rh, rl, *mptr;
633 +- const u64 *kptr = (u64 *)ctx->nhkey;
634 +- int i, remaining;
635 +- u64 ch, cl;
636 +- u64 pkh = ctx->polykey[0];
637 +- u64 pkl = ctx->polykey[1];
638 +-
639 +- mptr = (u64 *)m;
640 +- i = mbytes / VMAC_NHBYTES;
641 +- remaining = mbytes % VMAC_NHBYTES;
642 +-
643 +- if (ctx->first_block_processed) {
644 +- ch = ctx->polytmp[0];
645 +- cl = ctx->polytmp[1];
646 +- } else if (i) {
647 +- nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, ch, cl);
648 +- ch &= m62;
649 +- ADD128(ch, cl, pkh, pkl);
650 +- mptr += (VMAC_NHBYTES/sizeof(u64));
651 +- i--;
652 +- } else if (remaining) {
653 +- nh_16(mptr, kptr, 2*((remaining+15)/16), ch, cl);
654 +- ch &= m62;
655 +- ADD128(ch, cl, pkh, pkl);
656 +- mptr += (VMAC_NHBYTES/sizeof(u64));
657 +- goto do_l3;
658 +- } else {/* Empty String */
659 +- ch = pkh; cl = pkl;
660 +- goto do_l3;
661 +- }
662 +-
663 +- while (i--) {
664 +- nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
665 +- rh &= m62;
666 +- poly_step(ch, cl, pkh, pkl, rh, rl);
667 +- mptr += (VMAC_NHBYTES/sizeof(u64));
668 +- }
669 +- if (remaining) {
670 +- nh_16(mptr, kptr, 2*((remaining+15)/16), rh, rl);
671 +- rh &= m62;
672 +- poly_step(ch, cl, pkh, pkl, rh, rl);
673 +- }
674 +-
675 +-do_l3:
676 +- vhash_abort(ctx);
677 +- remaining *= 8;
678 +- return l3hash(ch, cl, ctx->l3key[0], ctx->l3key[1], remaining);
679 +-}
680 ++ struct vmac_tfm_ctx *tctx = crypto_shash_ctx(tfm);
681 ++ __be64 out[2];
682 ++ u8 in[16] = { 0 };
683 ++ unsigned int i;
684 ++ int err;
685 +
686 +-static u64 vmac(unsigned char m[], unsigned int mbytes,
687 +- const unsigned char n[16], u64 *tagl,
688 +- struct vmac_ctx_t *ctx)
689 +-{
690 +- u64 *in_n, *out_p;
691 +- u64 p, h;
692 +- int i;
693 +-
694 +- in_n = ctx->__vmac_ctx.cached_nonce;
695 +- out_p = ctx->__vmac_ctx.cached_aes;
696 +-
697 +- i = n[15] & 1;
698 +- if ((*(u64 *)(n+8) != in_n[1]) || (*(u64 *)(n) != in_n[0])) {
699 +- in_n[0] = *(u64 *)(n);
700 +- in_n[1] = *(u64 *)(n+8);
701 +- ((unsigned char *)in_n)[15] &= 0xFE;
702 +- crypto_cipher_encrypt_one(ctx->child,
703 +- (unsigned char *)out_p, (unsigned char *)in_n);
704 +-
705 +- ((unsigned char *)in_n)[15] |= (unsigned char)(1-i);
706 ++ if (keylen != VMAC_KEY_LEN) {
707 ++ crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
708 ++ return -EINVAL;
709 + }
710 +- p = be64_to_cpup(out_p + i);
711 +- h = vhash(m, mbytes, (u64 *)0, &ctx->__vmac_ctx);
712 +- return le64_to_cpu(p + h);
713 +-}
714 +
715 +-static int vmac_set_key(unsigned char user_key[], struct vmac_ctx_t *ctx)
716 +-{
717 +- u64 in[2] = {0}, out[2];
718 +- unsigned i;
719 +- int err = 0;
720 +-
721 +- err = crypto_cipher_setkey(ctx->child, user_key, VMAC_KEY_LEN);
722 ++ err = crypto_cipher_setkey(tctx->cipher, key, keylen);
723 + if (err)
724 + return err;
725 +
726 + /* Fill nh key */
727 +- ((unsigned char *)in)[0] = 0x80;
728 +- for (i = 0; i < sizeof(ctx->__vmac_ctx.nhkey)/8; i += 2) {
729 +- crypto_cipher_encrypt_one(ctx->child,
730 +- (unsigned char *)out, (unsigned char *)in);
731 +- ctx->__vmac_ctx.nhkey[i] = be64_to_cpup(out);
732 +- ctx->__vmac_ctx.nhkey[i+1] = be64_to_cpup(out+1);
733 +- ((unsigned char *)in)[15] += 1;
734 ++ in[0] = 0x80;
735 ++ for (i = 0; i < ARRAY_SIZE(tctx->nhkey); i += 2) {
736 ++ crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
737 ++ tctx->nhkey[i] = be64_to_cpu(out[0]);
738 ++ tctx->nhkey[i+1] = be64_to_cpu(out[1]);
739 ++ in[15]++;
740 + }
741 +
742 + /* Fill poly key */
743 +- ((unsigned char *)in)[0] = 0xC0;
744 +- in[1] = 0;
745 +- for (i = 0; i < sizeof(ctx->__vmac_ctx.polykey)/8; i += 2) {
746 +- crypto_cipher_encrypt_one(ctx->child,
747 +- (unsigned char *)out, (unsigned char *)in);
748 +- ctx->__vmac_ctx.polytmp[i] =
749 +- ctx->__vmac_ctx.polykey[i] =
750 +- be64_to_cpup(out) & mpoly;
751 +- ctx->__vmac_ctx.polytmp[i+1] =
752 +- ctx->__vmac_ctx.polykey[i+1] =
753 +- be64_to_cpup(out+1) & mpoly;
754 +- ((unsigned char *)in)[15] += 1;
755 ++ in[0] = 0xC0;
756 ++ in[15] = 0;
757 ++ for (i = 0; i < ARRAY_SIZE(tctx->polykey); i += 2) {
758 ++ crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
759 ++ tctx->polykey[i] = be64_to_cpu(out[0]) & mpoly;
760 ++ tctx->polykey[i+1] = be64_to_cpu(out[1]) & mpoly;
761 ++ in[15]++;
762 + }
763 +
764 + /* Fill ip key */
765 +- ((unsigned char *)in)[0] = 0xE0;
766 +- in[1] = 0;
767 +- for (i = 0; i < sizeof(ctx->__vmac_ctx.l3key)/8; i += 2) {
768 ++ in[0] = 0xE0;
769 ++ in[15] = 0;
770 ++ for (i = 0; i < ARRAY_SIZE(tctx->l3key); i += 2) {
771 + do {
772 +- crypto_cipher_encrypt_one(ctx->child,
773 +- (unsigned char *)out, (unsigned char *)in);
774 +- ctx->__vmac_ctx.l3key[i] = be64_to_cpup(out);
775 +- ctx->__vmac_ctx.l3key[i+1] = be64_to_cpup(out+1);
776 +- ((unsigned char *)in)[15] += 1;
777 +- } while (ctx->__vmac_ctx.l3key[i] >= p64
778 +- || ctx->__vmac_ctx.l3key[i+1] >= p64);
779 ++ crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
780 ++ tctx->l3key[i] = be64_to_cpu(out[0]);
781 ++ tctx->l3key[i+1] = be64_to_cpu(out[1]);
782 ++ in[15]++;
783 ++ } while (tctx->l3key[i] >= p64 || tctx->l3key[i+1] >= p64);
784 + }
785 +
786 +- /* Invalidate nonce/aes cache and reset other elements */
787 +- ctx->__vmac_ctx.cached_nonce[0] = (u64)-1; /* Ensure illegal nonce */
788 +- ctx->__vmac_ctx.cached_nonce[1] = (u64)0; /* Ensure illegal nonce */
789 +- ctx->__vmac_ctx.first_block_processed = 0;
790 +-
791 +- return err;
792 ++ return 0;
793 + }
794 +
795 +-static int vmac_setkey(struct crypto_shash *parent,
796 +- const u8 *key, unsigned int keylen)
797 ++static int vmac_init(struct shash_desc *desc)
798 + {
799 +- struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
800 ++ const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
801 ++ struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
802 +
803 +- if (keylen != VMAC_KEY_LEN) {
804 +- crypto_shash_set_flags(parent, CRYPTO_TFM_RES_BAD_KEY_LEN);
805 +- return -EINVAL;
806 +- }
807 +-
808 +- return vmac_set_key((u8 *)key, ctx);
809 +-}
810 +-
811 +-static int vmac_init(struct shash_desc *pdesc)
812 +-{
813 ++ dctx->partial_size = 0;
814 ++ dctx->first_block_processed = false;
815 ++ memcpy(dctx->polytmp, tctx->polykey, sizeof(dctx->polytmp));
816 + return 0;
817 + }
818 +
819 +-static int vmac_update(struct shash_desc *pdesc, const u8 *p,
820 +- unsigned int len)
821 ++static int vmac_update(struct shash_desc *desc, const u8 *p, unsigned int len)
822 + {
823 +- struct crypto_shash *parent = pdesc->tfm;
824 +- struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
825 +- int expand;
826 +- int min;
827 +-
828 +- expand = VMAC_NHBYTES - ctx->partial_size > 0 ?
829 +- VMAC_NHBYTES - ctx->partial_size : 0;
830 +-
831 +- min = len < expand ? len : expand;
832 +-
833 +- memcpy(ctx->partial + ctx->partial_size, p, min);
834 +- ctx->partial_size += min;
835 +-
836 +- if (len < expand)
837 +- return 0;
838 +-
839 +- vhash_update(ctx->partial, VMAC_NHBYTES, &ctx->__vmac_ctx);
840 +- ctx->partial_size = 0;
841 +-
842 +- len -= expand;
843 +- p += expand;
844 ++ const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
845 ++ struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
846 ++ unsigned int n;
847 ++
848 ++ if (dctx->partial_size) {
849 ++ n = min(len, VMAC_NHBYTES - dctx->partial_size);
850 ++ memcpy(&dctx->partial[dctx->partial_size], p, n);
851 ++ dctx->partial_size += n;
852 ++ p += n;
853 ++ len -= n;
854 ++ if (dctx->partial_size == VMAC_NHBYTES) {
855 ++ vhash_blocks(tctx, dctx, dctx->partial_words, 1);
856 ++ dctx->partial_size = 0;
857 ++ }
858 ++ }
859 +
860 +- if (len % VMAC_NHBYTES) {
861 +- memcpy(ctx->partial, p + len - (len % VMAC_NHBYTES),
862 +- len % VMAC_NHBYTES);
863 +- ctx->partial_size = len % VMAC_NHBYTES;
864 ++ if (len >= VMAC_NHBYTES) {
865 ++ n = round_down(len, VMAC_NHBYTES);
866 ++ /* TODO: 'p' may be misaligned here */
867 ++ vhash_blocks(tctx, dctx, (const __le64 *)p, n / VMAC_NHBYTES);
868 ++ p += n;
869 ++ len -= n;
870 + }
871 +
872 +- vhash_update(p, len - len % VMAC_NHBYTES, &ctx->__vmac_ctx);
873 ++ if (len) {
874 ++ memcpy(dctx->partial, p, len);
875 ++ dctx->partial_size = len;
876 ++ }
877 +
878 + return 0;
879 + }
880 +
881 +-static int vmac_final(struct shash_desc *pdesc, u8 *out)
882 ++static u64 vhash_final(const struct vmac_tfm_ctx *tctx,
883 ++ struct vmac_desc_ctx *dctx)
884 + {
885 +- struct crypto_shash *parent = pdesc->tfm;
886 +- struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
887 +- vmac_t mac;
888 +- u8 nonce[16] = {};
889 +-
890 +- /* vmac() ends up accessing outside the array bounds that
891 +- * we specify. In appears to access up to the next 2-word
892 +- * boundary. We'll just be uber cautious and zero the
893 +- * unwritten bytes in the buffer.
894 +- */
895 +- if (ctx->partial_size) {
896 +- memset(ctx->partial + ctx->partial_size, 0,
897 +- VMAC_NHBYTES - ctx->partial_size);
898 ++ unsigned int partial = dctx->partial_size;
899 ++ u64 ch = dctx->polytmp[0];
900 ++ u64 cl = dctx->polytmp[1];
901 ++
902 ++ /* L1 and L2-hash the final block if needed */
903 ++ if (partial) {
904 ++ /* Zero-pad to next 128-bit boundary */
905 ++ unsigned int n = round_up(partial, 16);
906 ++ u64 rh, rl;
907 ++
908 ++ memset(&dctx->partial[partial], 0, n - partial);
909 ++ nh_16(dctx->partial_words, tctx->nhkey, n / 8, rh, rl);
910 ++ rh &= m62;
911 ++ if (dctx->first_block_processed)
912 ++ poly_step(ch, cl, tctx->polykey[0], tctx->polykey[1],
913 ++ rh, rl);
914 ++ else
915 ++ ADD128(ch, cl, rh, rl);
916 + }
917 +- mac = vmac(ctx->partial, ctx->partial_size, nonce, NULL, ctx);
918 +- memcpy(out, &mac, sizeof(vmac_t));
919 +- memzero_explicit(&mac, sizeof(vmac_t));
920 +- memset(&ctx->__vmac_ctx, 0, sizeof(struct vmac_ctx));
921 +- ctx->partial_size = 0;
922 ++
923 ++ /* L3-hash the 128-bit output of L2-hash */
924 ++ return l3hash(ch, cl, tctx->l3key[0], tctx->l3key[1], partial * 8);
925 ++}
926 ++
927 ++static int vmac_final(struct shash_desc *desc, u8 *out)
928 ++{
929 ++ const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
930 ++ struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
931 ++ static const u8 nonce[16] = {}; /* TODO: this is insecure */
932 ++ union {
933 ++ u8 bytes[16];
934 ++ __be64 pads[2];
935 ++ } block;
936 ++ int index;
937 ++ u64 hash, pad;
938 ++
939 ++ /* Finish calculating the VHASH of the message */
940 ++ hash = vhash_final(tctx, dctx);
941 ++
942 ++ /* Generate pseudorandom pad by encrypting the nonce */
943 ++ memcpy(&block, nonce, 16);
944 ++ index = block.bytes[15] & 1;
945 ++ block.bytes[15] &= ~1;
946 ++ crypto_cipher_encrypt_one(tctx->cipher, block.bytes, block.bytes);
947 ++ pad = be64_to_cpu(block.pads[index]);
948 ++
949 ++ /* The VMAC is the sum of VHASH and the pseudorandom pad */
950 ++ put_unaligned_le64(hash + pad, out);
951 + return 0;
952 + }
953 +
954 + static int vmac_init_tfm(struct crypto_tfm *tfm)
955 + {
956 +- struct crypto_cipher *cipher;
957 +- struct crypto_instance *inst = (void *)tfm->__crt_alg;
958 ++ struct crypto_instance *inst = crypto_tfm_alg_instance(tfm);
959 + struct crypto_spawn *spawn = crypto_instance_ctx(inst);
960 +- struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
961 ++ struct vmac_tfm_ctx *tctx = crypto_tfm_ctx(tfm);
962 ++ struct crypto_cipher *cipher;
963 +
964 + cipher = crypto_spawn_cipher(spawn);
965 + if (IS_ERR(cipher))
966 + return PTR_ERR(cipher);
967 +
968 +- ctx->child = cipher;
969 ++ tctx->cipher = cipher;
970 + return 0;
971 + }
972 +
973 + static void vmac_exit_tfm(struct crypto_tfm *tfm)
974 + {
975 +- struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
976 +- crypto_free_cipher(ctx->child);
977 ++ struct vmac_tfm_ctx *tctx = crypto_tfm_ctx(tfm);
978 ++
979 ++ crypto_free_cipher(tctx->cipher);
980 + }
981 +
982 + static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
983 +@@ -655,6 +608,10 @@ static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
984 + if (IS_ERR(alg))
985 + return PTR_ERR(alg);
986 +
987 ++ err = -EINVAL;
988 ++ if (alg->cra_blocksize != 16)
989 ++ goto out_put_alg;
990 ++
991 + inst = shash_alloc_instance("vmac", alg);
992 + err = PTR_ERR(inst);
993 + if (IS_ERR(inst))
994 +@@ -670,11 +627,12 @@ static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
995 + inst->alg.base.cra_blocksize = alg->cra_blocksize;
996 + inst->alg.base.cra_alignmask = alg->cra_alignmask;
997 +
998 +- inst->alg.digestsize = sizeof(vmac_t);
999 +- inst->alg.base.cra_ctxsize = sizeof(struct vmac_ctx_t);
1000 ++ inst->alg.base.cra_ctxsize = sizeof(struct vmac_tfm_ctx);
1001 + inst->alg.base.cra_init = vmac_init_tfm;
1002 + inst->alg.base.cra_exit = vmac_exit_tfm;
1003 +
1004 ++ inst->alg.descsize = sizeof(struct vmac_desc_ctx);
1005 ++ inst->alg.digestsize = VMAC_TAG_LEN / 8;
1006 + inst->alg.init = vmac_init;
1007 + inst->alg.update = vmac_update;
1008 + inst->alg.final = vmac_final;
1009 +diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
1010 +index 7aea28815d99..b51adffa4841 100644
1011 +--- a/drivers/i2c/busses/i2c-ismt.c
1012 ++++ b/drivers/i2c/busses/i2c-ismt.c
1013 +@@ -589,7 +589,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
1014 +
1015 + /* unmap the data buffer */
1016 + if (dma_size != 0)
1017 +- dma_unmap_single(&adap->dev, dma_addr, dma_size, dma_direction);
1018 ++ dma_unmap_single(dev, dma_addr, dma_size, dma_direction);
1019 +
1020 + if (unlikely(!time_left)) {
1021 + dev_err(dev, "completion wait timed out\n");
1022 +diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
1023 +index a88ea9e37a25..0a4c2d4d9f8d 100644
1024 +--- a/include/asm-generic/pgtable.h
1025 ++++ b/include/asm-generic/pgtable.h
1026 +@@ -779,8 +779,8 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
1027 + int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
1028 + int pud_clear_huge(pud_t *pud);
1029 + int pmd_clear_huge(pmd_t *pmd);
1030 +-int pud_free_pmd_page(pud_t *pud);
1031 +-int pmd_free_pte_page(pmd_t *pmd);
1032 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr);
1033 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr);
1034 + #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
1035 + static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot)
1036 + {
1037 +@@ -798,11 +798,11 @@ static inline int pmd_clear_huge(pmd_t *pmd)
1038 + {
1039 + return 0;
1040 + }
1041 +-static inline int pud_free_pmd_page(pud_t *pud)
1042 ++static inline int pud_free_pmd_page(pud_t *pud, unsigned long addr)
1043 + {
1044 + return 0;
1045 + }
1046 +-static inline int pmd_free_pte_page(pmd_t *pmd)
1047 ++static inline int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
1048 + {
1049 + return 0;
1050 + }
1051 +diff --git a/include/crypto/vmac.h b/include/crypto/vmac.h
1052 +deleted file mode 100644
1053 +index 6b700c7b2fe1..000000000000
1054 +--- a/include/crypto/vmac.h
1055 ++++ /dev/null
1056 +@@ -1,63 +0,0 @@
1057 +-/*
1058 +- * Modified to interface to the Linux kernel
1059 +- * Copyright (c) 2009, Intel Corporation.
1060 +- *
1061 +- * This program is free software; you can redistribute it and/or modify it
1062 +- * under the terms and conditions of the GNU General Public License,
1063 +- * version 2, as published by the Free Software Foundation.
1064 +- *
1065 +- * This program is distributed in the hope it will be useful, but WITHOUT
1066 +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1067 +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1068 +- * more details.
1069 +- *
1070 +- * You should have received a copy of the GNU General Public License along with
1071 +- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
1072 +- * Place - Suite 330, Boston, MA 02111-1307 USA.
1073 +- */
1074 +-
1075 +-#ifndef __CRYPTO_VMAC_H
1076 +-#define __CRYPTO_VMAC_H
1077 +-
1078 +-/* --------------------------------------------------------------------------
1079 +- * VMAC and VHASH Implementation by Ted Krovetz (tdk@×××.org) and Wei Dai.
1080 +- * This implementation is herby placed in the public domain.
1081 +- * The authors offers no warranty. Use at your own risk.
1082 +- * Please send bug reports to the authors.
1083 +- * Last modified: 17 APR 08, 1700 PDT
1084 +- * ----------------------------------------------------------------------- */
1085 +-
1086 +-/*
1087 +- * User definable settings.
1088 +- */
1089 +-#define VMAC_TAG_LEN 64
1090 +-#define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */
1091 +-#define VMAC_KEY_LEN (VMAC_KEY_SIZE/8)
1092 +-#define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/
1093 +-
1094 +-/*
1095 +- * This implementation uses u32 and u64 as names for unsigned 32-
1096 +- * and 64-bit integer types. These are defined in C99 stdint.h. The
1097 +- * following may need adaptation if you are not running a C99 or
1098 +- * Microsoft C environment.
1099 +- */
1100 +-struct vmac_ctx {
1101 +- u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
1102 +- u64 polykey[2*VMAC_TAG_LEN/64];
1103 +- u64 l3key[2*VMAC_TAG_LEN/64];
1104 +- u64 polytmp[2*VMAC_TAG_LEN/64];
1105 +- u64 cached_nonce[2];
1106 +- u64 cached_aes[2];
1107 +- int first_block_processed;
1108 +-};
1109 +-
1110 +-typedef u64 vmac_t;
1111 +-
1112 +-struct vmac_ctx_t {
1113 +- struct crypto_cipher *child;
1114 +- struct vmac_ctx __vmac_ctx;
1115 +- u8 partial[VMAC_NHBYTES]; /* partial block */
1116 +- int partial_size; /* size of the partial block */
1117 +-};
1118 +-
1119 +-#endif /* __CRYPTO_VMAC_H */
1120 +diff --git a/lib/ioremap.c b/lib/ioremap.c
1121 +index 5323b59ca393..b9462037868d 100644
1122 +--- a/lib/ioremap.c
1123 ++++ b/lib/ioremap.c
1124 +@@ -84,7 +84,7 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
1125 + if (ioremap_pmd_enabled() &&
1126 + ((next - addr) == PMD_SIZE) &&
1127 + IS_ALIGNED(phys_addr + addr, PMD_SIZE) &&
1128 +- pmd_free_pte_page(pmd)) {
1129 ++ pmd_free_pte_page(pmd, addr)) {
1130 + if (pmd_set_huge(pmd, phys_addr + addr, prot))
1131 + continue;
1132 + }
1133 +@@ -111,7 +111,7 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
1134 + if (ioremap_pud_enabled() &&
1135 + ((next - addr) == PUD_SIZE) &&
1136 + IS_ALIGNED(phys_addr + addr, PUD_SIZE) &&
1137 +- pud_free_pmd_page(pud)) {
1138 ++ pud_free_pmd_page(pud, addr)) {
1139 + if (pud_set_huge(pud, phys_addr + addr, prot))
1140 + continue;
1141 + }
1142 +diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
1143 +index 1fc076420d1e..1811f8e7ddf4 100644
1144 +--- a/net/bluetooth/hidp/core.c
1145 ++++ b/net/bluetooth/hidp/core.c
1146 +@@ -431,8 +431,8 @@ static void hidp_del_timer(struct hidp_session *session)
1147 + del_timer(&session->timer);
1148 + }
1149 +
1150 +-static void hidp_process_report(struct hidp_session *session,
1151 +- int type, const u8 *data, int len, int intr)
1152 ++static void hidp_process_report(struct hidp_session *session, int type,
1153 ++ const u8 *data, unsigned int len, int intr)
1154 + {
1155 + if (len > HID_MAX_BUFFER_SIZE)
1156 + len = HID_MAX_BUFFER_SIZE;
1157 +diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
1158 +index 37323b0df374..2624d4bf9a45 100644
1159 +--- a/scripts/Makefile.kasan
1160 ++++ b/scripts/Makefile.kasan
1161 +@@ -28,4 +28,7 @@ else
1162 + CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
1163 + endif
1164 + endif
1165 ++
1166 ++CFLAGS_KASAN_NOSANITIZE := -fno-builtin
1167 ++
1168 + endif
1169 +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
1170 +index ae0f9ab1a70d..c954040c3cf2 100644
1171 +--- a/scripts/Makefile.lib
1172 ++++ b/scripts/Makefile.lib
1173 +@@ -127,7 +127,7 @@ endif
1174 + ifeq ($(CONFIG_KASAN),y)
1175 + _c_flags += $(if $(patsubst n%,, \
1176 + $(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \
1177 +- $(CFLAGS_KASAN))
1178 ++ $(CFLAGS_KASAN), $(CFLAGS_KASAN_NOSANITIZE))
1179 + endif
1180 +
1181 + ifeq ($(CONFIG_UBSAN),y)
1182 +diff --git a/scripts/depmod.sh b/scripts/depmod.sh
1183 +index 122599b1c13b..ea1e96921e3b 100755
1184 +--- a/scripts/depmod.sh
1185 ++++ b/scripts/depmod.sh
1186 +@@ -10,10 +10,16 @@ DEPMOD=$1
1187 + KERNELRELEASE=$2
1188 + SYMBOL_PREFIX=$3
1189 +
1190 +-if ! test -r System.map -a -x "$DEPMOD"; then
1191 ++if ! test -r System.map ; then
1192 + exit 0
1193 + fi
1194 +
1195 ++if [ -z $(command -v $DEPMOD) ]; then
1196 ++ echo "'make modules_install' requires $DEPMOD. Please install it." >&2
1197 ++ echo "This is probably in the kmod package." >&2
1198 ++ exit 1
1199 ++fi
1200 ++
1201 + # older versions of depmod don't support -P <symbol-prefix>
1202 + # support was added in module-init-tools 3.13
1203 + if test -n "$SYMBOL_PREFIX"; then
1204 +diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
1205 +index cdcced9f32b6..b7c1e3d74ccc 100644
1206 +--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
1207 ++++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
1208 +@@ -128,23 +128,19 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
1209 + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
1210 + struct snd_soc_jack *jack = &ctx->jack;
1211 +
1212 +- /**
1213 +- * TI supports 4 butons headset detection
1214 +- * KEY_MEDIA
1215 +- * KEY_VOICECOMMAND
1216 +- * KEY_VOLUMEUP
1217 +- * KEY_VOLUMEDOWN
1218 +- */
1219 +- if (ctx->ts3a227e_present)
1220 +- jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
1221 +- SND_JACK_BTN_0 | SND_JACK_BTN_1 |
1222 +- SND_JACK_BTN_2 | SND_JACK_BTN_3;
1223 +- else
1224 +- jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
1225 ++ if (ctx->ts3a227e_present) {
1226 ++ /*
1227 ++ * The jack has already been created in the
1228 ++ * cht_max98090_headset_init() function.
1229 ++ */
1230 ++ snd_soc_jack_notifier_register(jack, &cht_jack_nb);
1231 ++ return 0;
1232 ++ }
1233 ++
1234 ++ jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
1235 +
1236 + ret = snd_soc_card_jack_new(runtime->card, "Headset Jack",
1237 + jack_type, jack, NULL, 0);
1238 +-
1239 + if (ret) {
1240 + dev_err(runtime->dev, "Headset Jack creation failed %d\n", ret);
1241 + return ret;
1242 +@@ -200,6 +196,27 @@ static int cht_max98090_headset_init(struct snd_soc_component *component)
1243 + {
1244 + struct snd_soc_card *card = component->card;
1245 + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
1246 ++ struct snd_soc_jack *jack = &ctx->jack;
1247 ++ int jack_type;
1248 ++ int ret;
1249 ++
1250 ++ /*
1251 ++ * TI supports 4 butons headset detection
1252 ++ * KEY_MEDIA
1253 ++ * KEY_VOICECOMMAND
1254 ++ * KEY_VOLUMEUP
1255 ++ * KEY_VOLUMEDOWN
1256 ++ */
1257 ++ jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
1258 ++ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
1259 ++ SND_JACK_BTN_2 | SND_JACK_BTN_3;
1260 ++
1261 ++ ret = snd_soc_card_jack_new(card, "Headset Jack", jack_type,
1262 ++ jack, NULL, 0);
1263 ++ if (ret) {
1264 ++ dev_err(card->dev, "Headset Jack creation failed %d\n", ret);
1265 ++ return ret;
1266 ++ }
1267 +
1268 + return ts3a227e_enable_jack_detect(component, &ctx->jack);
1269 + }