Gentoo Archives: gentoo-commits

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