Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Fri, 17 Aug 2018 19:26:53
Message-Id: 1534533998.22f52f43b9e8d3d1ff09551d42d95d4b81adf987.mpagano@gentoo
1 commit: 22f52f43b9e8d3d1ff09551d42d95d4b81adf987
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 17 19:26:38 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 17 19:26:38 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=22f52f43
7
8 Linux patch 4.14.64
9
10 0000_README | 4 +
11 1063_linux-4.14.64.patch | 1527 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1531 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index ada5b82..41f1d75 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -295,6 +295,10 @@ Patch: 1062_linux-4.14.63.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.14.63
21
22 +Patch: 1063_linux-4.14.64.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.14.64
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/1063_linux-4.14.64.patch b/1063_linux-4.14.64.patch
31 new file mode 100644
32 index 0000000..b4a1f5f
33 --- /dev/null
34 +++ b/1063_linux-4.14.64.patch
35 @@ -0,0 +1,1527 @@
36 +diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
37 +index 560beaef5a7c..73fcdcd52b87 100644
38 +--- a/Documentation/process/changes.rst
39 ++++ b/Documentation/process/changes.rst
40 +@@ -33,7 +33,7 @@ GNU C 3.2 gcc --version
41 + GNU make 3.81 make --version
42 + binutils 2.20 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 +@@ -141,12 +141,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 +@@ -346,16 +340,17 @@ Util-linux
63 +
64 + - <https://www.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 + - <https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/>
76 +
77 +-Module-Init-Tools
78 +------------------
79 +-
80 +-- <https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/>
81 +-
82 + Mkinitrd
83 + --------
84 +
85 +diff --git a/Makefile b/Makefile
86 +index f3bb9428b3dc..025156791e90 100644
87 +--- a/Makefile
88 ++++ b/Makefile
89 +@@ -1,7 +1,7 @@
90 + # SPDX-License-Identifier: GPL-2.0
91 + VERSION = 4
92 + PATCHLEVEL = 14
93 +-SUBLEVEL = 63
94 ++SUBLEVEL = 64
95 + EXTRAVERSION =
96 + NAME = Petit Gorille
97 +
98 +diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
99 +index f6b877d2726d..6ac0d32d60a5 100644
100 +--- a/arch/arm64/mm/mmu.c
101 ++++ b/arch/arm64/mm/mmu.c
102 +@@ -938,12 +938,12 @@ int pmd_clear_huge(pmd_t *pmd)
103 + return 1;
104 + }
105 +
106 +-int pud_free_pmd_page(pud_t *pud)
107 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr)
108 + {
109 + return pud_none(*pud);
110 + }
111 +
112 +-int pmd_free_pte_page(pmd_t *pmd)
113 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
114 + {
115 + return pmd_none(*pmd);
116 + }
117 +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
118 +index 16c4ccb1f154..d2364c55bbde 100644
119 +--- a/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
120 ++++ b/arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S
121 +@@ -265,7 +265,7 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2)
122 + vpinsrd $1, _args_digest+1*32(state, idx, 4), %xmm0, %xmm0
123 + vpinsrd $2, _args_digest+2*32(state, idx, 4), %xmm0, %xmm0
124 + vpinsrd $3, _args_digest+3*32(state, idx, 4), %xmm0, %xmm0
125 +- vmovd _args_digest(state , idx, 4) , %xmm0
126 ++ vmovd _args_digest+4*32(state, idx, 4), %xmm1
127 + vpinsrd $1, _args_digest+5*32(state, idx, 4), %xmm1, %xmm1
128 + vpinsrd $2, _args_digest+6*32(state, idx, 4), %xmm1, %xmm1
129 + vpinsrd $3, _args_digest+7*32(state, idx, 4), %xmm1, %xmm1
130 +diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h
131 +index 5cdcdbd4d892..89789e8c80f6 100644
132 +--- a/arch/x86/include/asm/i8259.h
133 ++++ b/arch/x86/include/asm/i8259.h
134 +@@ -3,6 +3,7 @@
135 + #define _ASM_X86_I8259_H
136 +
137 + #include <linux/delay.h>
138 ++#include <asm/io.h>
139 +
140 + extern unsigned int cached_irq_mask;
141 +
142 +diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
143 +index edfc64a8a154..d07addb99b71 100644
144 +--- a/arch/x86/kernel/cpu/bugs.c
145 ++++ b/arch/x86/kernel/cpu/bugs.c
146 +@@ -648,10 +648,9 @@ void x86_spec_ctrl_setup_ap(void)
147 + enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
148 + #if IS_ENABLED(CONFIG_KVM_INTEL)
149 + EXPORT_SYMBOL_GPL(l1tf_mitigation);
150 +-
151 ++#endif
152 + enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
153 + EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
154 +-#endif
155 +
156 + static void __init l1tf_select_mitigation(void)
157 + {
158 +diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
159 +index c03c85e4fb6a..2bdb8e8a9d7c 100644
160 +--- a/arch/x86/mm/pgtable.c
161 ++++ b/arch/x86/mm/pgtable.c
162 +@@ -712,28 +712,50 @@ int pmd_clear_huge(pmd_t *pmd)
163 + return 0;
164 + }
165 +
166 ++#ifdef CONFIG_X86_64
167 + /**
168 + * pud_free_pmd_page - Clear pud entry and free pmd page.
169 + * @pud: Pointer to a PUD.
170 ++ * @addr: Virtual address associated with pud.
171 + *
172 +- * Context: The pud range has been unmaped and TLB purged.
173 ++ * Context: The pud range has been unmapped and TLB purged.
174 + * Return: 1 if clearing the entry succeeded. 0 otherwise.
175 ++ *
176 ++ * NOTE: Callers must allow a single page allocation.
177 + */
178 +-int pud_free_pmd_page(pud_t *pud)
179 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr)
180 + {
181 +- pmd_t *pmd;
182 ++ pmd_t *pmd, *pmd_sv;
183 ++ pte_t *pte;
184 + int i;
185 +
186 + if (pud_none(*pud))
187 + return 1;
188 +
189 + pmd = (pmd_t *)pud_page_vaddr(*pud);
190 ++ pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL);
191 ++ if (!pmd_sv)
192 ++ return 0;
193 +
194 +- for (i = 0; i < PTRS_PER_PMD; i++)
195 +- if (!pmd_free_pte_page(&pmd[i]))
196 +- return 0;
197 ++ for (i = 0; i < PTRS_PER_PMD; i++) {
198 ++ pmd_sv[i] = pmd[i];
199 ++ if (!pmd_none(pmd[i]))
200 ++ pmd_clear(&pmd[i]);
201 ++ }
202 +
203 + pud_clear(pud);
204 ++
205 ++ /* INVLPG to clear all paging-structure caches */
206 ++ flush_tlb_kernel_range(addr, addr + PAGE_SIZE-1);
207 ++
208 ++ for (i = 0; i < PTRS_PER_PMD; i++) {
209 ++ if (!pmd_none(pmd_sv[i])) {
210 ++ pte = (pte_t *)pmd_page_vaddr(pmd_sv[i]);
211 ++ free_page((unsigned long)pte);
212 ++ }
213 ++ }
214 ++
215 ++ free_page((unsigned long)pmd_sv);
216 + free_page((unsigned long)pmd);
217 +
218 + return 1;
219 +@@ -742,11 +764,12 @@ int pud_free_pmd_page(pud_t *pud)
220 + /**
221 + * pmd_free_pte_page - Clear pmd entry and free pte page.
222 + * @pmd: Pointer to a PMD.
223 ++ * @addr: Virtual address associated with pmd.
224 + *
225 +- * Context: The pmd range has been unmaped and TLB purged.
226 ++ * Context: The pmd range has been unmapped and TLB purged.
227 + * Return: 1 if clearing the entry succeeded. 0 otherwise.
228 + */
229 +-int pmd_free_pte_page(pmd_t *pmd)
230 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
231 + {
232 + pte_t *pte;
233 +
234 +@@ -755,8 +778,30 @@ int pmd_free_pte_page(pmd_t *pmd)
235 +
236 + pte = (pte_t *)pmd_page_vaddr(*pmd);
237 + pmd_clear(pmd);
238 ++
239 ++ /* INVLPG to clear all paging-structure caches */
240 ++ flush_tlb_kernel_range(addr, addr + PAGE_SIZE-1);
241 ++
242 + free_page((unsigned long)pte);
243 +
244 + return 1;
245 + }
246 ++
247 ++#else /* !CONFIG_X86_64 */
248 ++
249 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr)
250 ++{
251 ++ return pud_none(*pud);
252 ++}
253 ++
254 ++/*
255 ++ * Disable free page handling on x86-PAE. This assures that ioremap()
256 ++ * does not update sync'd pmd entries. See vmalloc_sync_one().
257 ++ */
258 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
259 ++{
260 ++ return pmd_none(*pmd);
261 ++}
262 ++
263 ++#endif /* CONFIG_X86_64 */
264 + #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
265 +diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
266 +index 4a4b7d3c909a..3b44bd28fc45 100644
267 +--- a/block/bfq-iosched.c
268 ++++ b/block/bfq-iosched.c
269 +@@ -1203,6 +1203,24 @@ static unsigned int bfq_wr_duration(struct bfq_data *bfqd)
270 + return dur;
271 + }
272 +
273 ++/*
274 ++ * Return the farthest future time instant according to jiffies
275 ++ * macros.
276 ++ */
277 ++static unsigned long bfq_greatest_from_now(void)
278 ++{
279 ++ return jiffies + MAX_JIFFY_OFFSET;
280 ++}
281 ++
282 ++/*
283 ++ * Return the farthest past time instant according to jiffies
284 ++ * macros.
285 ++ */
286 ++static unsigned long bfq_smallest_from_now(void)
287 ++{
288 ++ return jiffies - MAX_JIFFY_OFFSET;
289 ++}
290 ++
291 + static void bfq_update_bfqq_wr_on_rq_arrival(struct bfq_data *bfqd,
292 + struct bfq_queue *bfqq,
293 + unsigned int old_wr_coeff,
294 +@@ -1217,7 +1235,19 @@ static void bfq_update_bfqq_wr_on_rq_arrival(struct bfq_data *bfqd,
295 + bfqq->wr_coeff = bfqd->bfq_wr_coeff;
296 + bfqq->wr_cur_max_time = bfq_wr_duration(bfqd);
297 + } else {
298 +- bfqq->wr_start_at_switch_to_srt = jiffies;
299 ++ /*
300 ++ * No interactive weight raising in progress
301 ++ * here: assign minus infinity to
302 ++ * wr_start_at_switch_to_srt, to make sure
303 ++ * that, at the end of the soft-real-time
304 ++ * weight raising periods that is starting
305 ++ * now, no interactive weight-raising period
306 ++ * may be wrongly considered as still in
307 ++ * progress (and thus actually started by
308 ++ * mistake).
309 ++ */
310 ++ bfqq->wr_start_at_switch_to_srt =
311 ++ bfq_smallest_from_now();
312 + bfqq->wr_coeff = bfqd->bfq_wr_coeff *
313 + BFQ_SOFTRT_WEIGHT_FACTOR;
314 + bfqq->wr_cur_max_time =
315 +@@ -2896,24 +2926,6 @@ static unsigned long bfq_bfqq_softrt_next_start(struct bfq_data *bfqd,
316 + jiffies + nsecs_to_jiffies(bfqq->bfqd->bfq_slice_idle) + 4);
317 + }
318 +
319 +-/*
320 +- * Return the farthest future time instant according to jiffies
321 +- * macros.
322 +- */
323 +-static unsigned long bfq_greatest_from_now(void)
324 +-{
325 +- return jiffies + MAX_JIFFY_OFFSET;
326 +-}
327 +-
328 +-/*
329 +- * Return the farthest past time instant according to jiffies
330 +- * macros.
331 +- */
332 +-static unsigned long bfq_smallest_from_now(void)
333 +-{
334 +- return jiffies - MAX_JIFFY_OFFSET;
335 +-}
336 +-
337 + /**
338 + * bfq_bfqq_expire - expire a queue.
339 + * @bfqd: device owning the queue.
340 +diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
341 +index d880a4897159..4ee7c041bb82 100644
342 +--- a/crypto/ablkcipher.c
343 ++++ b/crypto/ablkcipher.c
344 +@@ -71,11 +71,9 @@ static inline u8 *ablkcipher_get_spot(u8 *start, unsigned int len)
345 + return max(start, end_page);
346 + }
347 +
348 +-static inline unsigned int ablkcipher_done_slow(struct ablkcipher_walk *walk,
349 +- unsigned int bsize)
350 ++static inline void ablkcipher_done_slow(struct ablkcipher_walk *walk,
351 ++ unsigned int n)
352 + {
353 +- unsigned int n = bsize;
354 +-
355 + for (;;) {
356 + unsigned int len_this_page = scatterwalk_pagelen(&walk->out);
357 +
358 +@@ -87,17 +85,13 @@ static inline unsigned int ablkcipher_done_slow(struct ablkcipher_walk *walk,
359 + n -= len_this_page;
360 + scatterwalk_start(&walk->out, sg_next(walk->out.sg));
361 + }
362 +-
363 +- return bsize;
364 + }
365 +
366 +-static inline unsigned int ablkcipher_done_fast(struct ablkcipher_walk *walk,
367 +- unsigned int n)
368 ++static inline void ablkcipher_done_fast(struct ablkcipher_walk *walk,
369 ++ unsigned int n)
370 + {
371 + scatterwalk_advance(&walk->in, n);
372 + scatterwalk_advance(&walk->out, n);
373 +-
374 +- return n;
375 + }
376 +
377 + static int ablkcipher_walk_next(struct ablkcipher_request *req,
378 +@@ -107,39 +101,40 @@ int ablkcipher_walk_done(struct ablkcipher_request *req,
379 + struct ablkcipher_walk *walk, int err)
380 + {
381 + struct crypto_tfm *tfm = req->base.tfm;
382 +- unsigned int nbytes = 0;
383 ++ unsigned int n; /* bytes processed */
384 ++ bool more;
385 +
386 +- if (likely(err >= 0)) {
387 +- unsigned int n = walk->nbytes - err;
388 ++ if (unlikely(err < 0))
389 ++ goto finish;
390 +
391 +- if (likely(!(walk->flags & ABLKCIPHER_WALK_SLOW)))
392 +- n = ablkcipher_done_fast(walk, n);
393 +- else if (WARN_ON(err)) {
394 +- err = -EINVAL;
395 +- goto err;
396 +- } else
397 +- n = ablkcipher_done_slow(walk, n);
398 ++ n = walk->nbytes - err;
399 ++ walk->total -= n;
400 ++ more = (walk->total != 0);
401 +
402 +- nbytes = walk->total - n;
403 +- err = 0;
404 ++ if (likely(!(walk->flags & ABLKCIPHER_WALK_SLOW))) {
405 ++ ablkcipher_done_fast(walk, n);
406 ++ } else {
407 ++ if (WARN_ON(err)) {
408 ++ /* unexpected case; didn't process all bytes */
409 ++ err = -EINVAL;
410 ++ goto finish;
411 ++ }
412 ++ ablkcipher_done_slow(walk, n);
413 + }
414 +
415 +- scatterwalk_done(&walk->in, 0, nbytes);
416 +- scatterwalk_done(&walk->out, 1, nbytes);
417 +-
418 +-err:
419 +- walk->total = nbytes;
420 +- walk->nbytes = nbytes;
421 ++ scatterwalk_done(&walk->in, 0, more);
422 ++ scatterwalk_done(&walk->out, 1, more);
423 +
424 +- if (nbytes) {
425 ++ if (more) {
426 + crypto_yield(req->base.flags);
427 + return ablkcipher_walk_next(req, walk);
428 + }
429 +-
430 ++ err = 0;
431 ++finish:
432 ++ walk->nbytes = 0;
433 + if (walk->iv != req->info)
434 + memcpy(req->info, walk->iv, tfm->crt_ablkcipher.ivsize);
435 + kfree(walk->iv_buffer);
436 +-
437 + return err;
438 + }
439 + EXPORT_SYMBOL_GPL(ablkcipher_walk_done);
440 +diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
441 +index 6c43a0a17a55..d84c6920ada9 100644
442 +--- a/crypto/blkcipher.c
443 ++++ b/crypto/blkcipher.c
444 +@@ -71,19 +71,18 @@ static inline u8 *blkcipher_get_spot(u8 *start, unsigned int len)
445 + return max(start, end_page);
446 + }
447 +
448 +-static inline unsigned int blkcipher_done_slow(struct blkcipher_walk *walk,
449 +- unsigned int bsize)
450 ++static inline void blkcipher_done_slow(struct blkcipher_walk *walk,
451 ++ unsigned int bsize)
452 + {
453 + u8 *addr;
454 +
455 + addr = (u8 *)ALIGN((unsigned long)walk->buffer, walk->alignmask + 1);
456 + addr = blkcipher_get_spot(addr, bsize);
457 + scatterwalk_copychunks(addr, &walk->out, bsize, 1);
458 +- return bsize;
459 + }
460 +
461 +-static inline unsigned int blkcipher_done_fast(struct blkcipher_walk *walk,
462 +- unsigned int n)
463 ++static inline void blkcipher_done_fast(struct blkcipher_walk *walk,
464 ++ unsigned int n)
465 + {
466 + if (walk->flags & BLKCIPHER_WALK_COPY) {
467 + blkcipher_map_dst(walk);
468 +@@ -97,49 +96,48 @@ static inline unsigned int blkcipher_done_fast(struct blkcipher_walk *walk,
469 +
470 + scatterwalk_advance(&walk->in, n);
471 + scatterwalk_advance(&walk->out, n);
472 +-
473 +- return n;
474 + }
475 +
476 + int blkcipher_walk_done(struct blkcipher_desc *desc,
477 + struct blkcipher_walk *walk, int err)
478 + {
479 +- unsigned int nbytes = 0;
480 ++ unsigned int n; /* bytes processed */
481 ++ bool more;
482 +
483 +- if (likely(err >= 0)) {
484 +- unsigned int n = walk->nbytes - err;
485 ++ if (unlikely(err < 0))
486 ++ goto finish;
487 +
488 +- if (likely(!(walk->flags & BLKCIPHER_WALK_SLOW)))
489 +- n = blkcipher_done_fast(walk, n);
490 +- else if (WARN_ON(err)) {
491 +- err = -EINVAL;
492 +- goto err;
493 +- } else
494 +- n = blkcipher_done_slow(walk, n);
495 ++ n = walk->nbytes - err;
496 ++ walk->total -= n;
497 ++ more = (walk->total != 0);
498 +
499 +- nbytes = walk->total - n;
500 +- err = 0;
501 ++ if (likely(!(walk->flags & BLKCIPHER_WALK_SLOW))) {
502 ++ blkcipher_done_fast(walk, n);
503 ++ } else {
504 ++ if (WARN_ON(err)) {
505 ++ /* unexpected case; didn't process all bytes */
506 ++ err = -EINVAL;
507 ++ goto finish;
508 ++ }
509 ++ blkcipher_done_slow(walk, n);
510 + }
511 +
512 +- scatterwalk_done(&walk->in, 0, nbytes);
513 +- scatterwalk_done(&walk->out, 1, nbytes);
514 ++ scatterwalk_done(&walk->in, 0, more);
515 ++ scatterwalk_done(&walk->out, 1, more);
516 +
517 +-err:
518 +- walk->total = nbytes;
519 +- walk->nbytes = nbytes;
520 +-
521 +- if (nbytes) {
522 ++ if (more) {
523 + crypto_yield(desc->flags);
524 + return blkcipher_walk_next(desc, walk);
525 + }
526 +-
527 ++ err = 0;
528 ++finish:
529 ++ walk->nbytes = 0;
530 + if (walk->iv != desc->info)
531 + memcpy(desc->info, walk->iv, walk->ivsize);
532 + if (walk->buffer != walk->page)
533 + kfree(walk->buffer);
534 + if (walk->page)
535 + free_page((unsigned long)walk->page);
536 +-
537 + return err;
538 + }
539 + EXPORT_SYMBOL_GPL(blkcipher_walk_done);
540 +diff --git a/crypto/skcipher.c b/crypto/skcipher.c
541 +index 11af5fd6a443..e319421a32e7 100644
542 +--- a/crypto/skcipher.c
543 ++++ b/crypto/skcipher.c
544 +@@ -95,7 +95,7 @@ static inline u8 *skcipher_get_spot(u8 *start, unsigned int len)
545 + return max(start, end_page);
546 + }
547 +
548 +-static int skcipher_done_slow(struct skcipher_walk *walk, unsigned int bsize)
549 ++static void skcipher_done_slow(struct skcipher_walk *walk, unsigned int bsize)
550 + {
551 + u8 *addr;
552 +
553 +@@ -103,23 +103,24 @@ static int skcipher_done_slow(struct skcipher_walk *walk, unsigned int bsize)
554 + addr = skcipher_get_spot(addr, bsize);
555 + scatterwalk_copychunks(addr, &walk->out, bsize,
556 + (walk->flags & SKCIPHER_WALK_PHYS) ? 2 : 1);
557 +- return 0;
558 + }
559 +
560 + int skcipher_walk_done(struct skcipher_walk *walk, int err)
561 + {
562 +- unsigned int n = walk->nbytes - err;
563 +- unsigned int nbytes;
564 ++ unsigned int n; /* bytes processed */
565 ++ bool more;
566 ++
567 ++ if (unlikely(err < 0))
568 ++ goto finish;
569 +
570 +- nbytes = walk->total - n;
571 ++ n = walk->nbytes - err;
572 ++ walk->total -= n;
573 ++ more = (walk->total != 0);
574 +
575 +- if (unlikely(err < 0)) {
576 +- nbytes = 0;
577 +- n = 0;
578 +- } else if (likely(!(walk->flags & (SKCIPHER_WALK_PHYS |
579 +- SKCIPHER_WALK_SLOW |
580 +- SKCIPHER_WALK_COPY |
581 +- SKCIPHER_WALK_DIFF)))) {
582 ++ if (likely(!(walk->flags & (SKCIPHER_WALK_PHYS |
583 ++ SKCIPHER_WALK_SLOW |
584 ++ SKCIPHER_WALK_COPY |
585 ++ SKCIPHER_WALK_DIFF)))) {
586 + unmap_src:
587 + skcipher_unmap_src(walk);
588 + } else if (walk->flags & SKCIPHER_WALK_DIFF) {
589 +@@ -131,28 +132,28 @@ unmap_src:
590 + skcipher_unmap_dst(walk);
591 + } else if (unlikely(walk->flags & SKCIPHER_WALK_SLOW)) {
592 + if (WARN_ON(err)) {
593 ++ /* unexpected case; didn't process all bytes */
594 + err = -EINVAL;
595 +- nbytes = 0;
596 +- } else
597 +- n = skcipher_done_slow(walk, n);
598 ++ goto finish;
599 ++ }
600 ++ skcipher_done_slow(walk, n);
601 ++ goto already_advanced;
602 + }
603 +
604 +- if (err > 0)
605 +- err = 0;
606 +-
607 +- walk->total = nbytes;
608 +- walk->nbytes = nbytes;
609 +-
610 + scatterwalk_advance(&walk->in, n);
611 + scatterwalk_advance(&walk->out, n);
612 +- scatterwalk_done(&walk->in, 0, nbytes);
613 +- scatterwalk_done(&walk->out, 1, nbytes);
614 ++already_advanced:
615 ++ scatterwalk_done(&walk->in, 0, more);
616 ++ scatterwalk_done(&walk->out, 1, more);
617 +
618 +- if (nbytes) {
619 ++ if (more) {
620 + crypto_yield(walk->flags & SKCIPHER_WALK_SLEEP ?
621 + CRYPTO_TFM_REQ_MAY_SLEEP : 0);
622 + return skcipher_walk_next(walk);
623 + }
624 ++ err = 0;
625 ++finish:
626 ++ walk->nbytes = 0;
627 +
628 + /* Short-circuit for the common/fast path. */
629 + if (!((unsigned long)walk->buffer | (unsigned long)walk->page))
630 +@@ -399,7 +400,7 @@ static int skcipher_copy_iv(struct skcipher_walk *walk)
631 + unsigned size;
632 + u8 *iv;
633 +
634 +- aligned_bs = ALIGN(bs, alignmask);
635 ++ aligned_bs = ALIGN(bs, alignmask + 1);
636 +
637 + /* Minimum size to align buffer by alignmask. */
638 + size = alignmask & ~a;
639 +diff --git a/crypto/vmac.c b/crypto/vmac.c
640 +index df76a816cfb2..bb2fc787d615 100644
641 +--- a/crypto/vmac.c
642 ++++ b/crypto/vmac.c
643 +@@ -1,6 +1,10 @@
644 + /*
645 +- * Modified to interface to the Linux kernel
646 ++ * VMAC: Message Authentication Code using Universal Hashing
647 ++ *
648 ++ * Reference: https://tools.ietf.org/html/draft-krovetz-vmac-01
649 ++ *
650 + * Copyright (c) 2009, Intel Corporation.
651 ++ * Copyright (c) 2018, Google Inc.
652 + *
653 + * This program is free software; you can redistribute it and/or modify it
654 + * under the terms and conditions of the GNU General Public License,
655 +@@ -16,14 +20,15 @@
656 + * Place - Suite 330, Boston, MA 02111-1307 USA.
657 + */
658 +
659 +-/* --------------------------------------------------------------------------
660 +- * VMAC and VHASH Implementation by Ted Krovetz (tdk@×××.org) and Wei Dai.
661 +- * This implementation is herby placed in the public domain.
662 +- * The authors offers no warranty. Use at your own risk.
663 +- * Please send bug reports to the authors.
664 +- * Last modified: 17 APR 08, 1700 PDT
665 +- * ----------------------------------------------------------------------- */
666 ++/*
667 ++ * Derived from:
668 ++ * VMAC and VHASH Implementation by Ted Krovetz (tdk@×××.org) and Wei Dai.
669 ++ * This implementation is herby placed in the public domain.
670 ++ * The authors offers no warranty. Use at your own risk.
671 ++ * Last modified: 17 APR 08, 1700 PDT
672 ++ */
673 +
674 ++#include <asm/unaligned.h>
675 + #include <linux/init.h>
676 + #include <linux/types.h>
677 + #include <linux/crypto.h>
678 +@@ -31,9 +36,35 @@
679 + #include <linux/scatterlist.h>
680 + #include <asm/byteorder.h>
681 + #include <crypto/scatterwalk.h>
682 +-#include <crypto/vmac.h>
683 + #include <crypto/internal/hash.h>
684 +
685 ++/*
686 ++ * User definable settings.
687 ++ */
688 ++#define VMAC_TAG_LEN 64
689 ++#define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */
690 ++#define VMAC_KEY_LEN (VMAC_KEY_SIZE/8)
691 ++#define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/
692 ++
693 ++/* per-transform (per-key) context */
694 ++struct vmac_tfm_ctx {
695 ++ struct crypto_cipher *cipher;
696 ++ u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
697 ++ u64 polykey[2*VMAC_TAG_LEN/64];
698 ++ u64 l3key[2*VMAC_TAG_LEN/64];
699 ++};
700 ++
701 ++/* per-request context */
702 ++struct vmac_desc_ctx {
703 ++ union {
704 ++ u8 partial[VMAC_NHBYTES]; /* partial block */
705 ++ __le64 partial_words[VMAC_NHBYTES / 8];
706 ++ };
707 ++ unsigned int partial_size; /* size of the partial block */
708 ++ bool first_block_processed;
709 ++ u64 polytmp[2*VMAC_TAG_LEN/64]; /* running total of L2-hash */
710 ++};
711 ++
712 + /*
713 + * Constants and masks
714 + */
715 +@@ -318,13 +349,6 @@ static void poly_step_func(u64 *ahi, u64 *alo,
716 + } while (0)
717 + #endif
718 +
719 +-static void vhash_abort(struct vmac_ctx *ctx)
720 +-{
721 +- ctx->polytmp[0] = ctx->polykey[0] ;
722 +- ctx->polytmp[1] = ctx->polykey[1] ;
723 +- ctx->first_block_processed = 0;
724 +-}
725 +-
726 + static u64 l3hash(u64 p1, u64 p2, u64 k1, u64 k2, u64 len)
727 + {
728 + u64 rh, rl, t, z = 0;
729 +@@ -364,280 +388,209 @@ static u64 l3hash(u64 p1, u64 p2, u64 k1, u64 k2, u64 len)
730 + return rl;
731 + }
732 +
733 +-static void vhash_update(const unsigned char *m,
734 +- unsigned int mbytes, /* Pos multiple of VMAC_NHBYTES */
735 +- struct vmac_ctx *ctx)
736 ++/* L1 and L2-hash one or more VMAC_NHBYTES-byte blocks */
737 ++static void vhash_blocks(const struct vmac_tfm_ctx *tctx,
738 ++ struct vmac_desc_ctx *dctx,
739 ++ const __le64 *mptr, unsigned int blocks)
740 + {
741 +- u64 rh, rl, *mptr;
742 +- const u64 *kptr = (u64 *)ctx->nhkey;
743 +- int i;
744 +- u64 ch, cl;
745 +- u64 pkh = ctx->polykey[0];
746 +- u64 pkl = ctx->polykey[1];
747 +-
748 +- if (!mbytes)
749 +- return;
750 +-
751 +- BUG_ON(mbytes % VMAC_NHBYTES);
752 +-
753 +- mptr = (u64 *)m;
754 +- i = mbytes / VMAC_NHBYTES; /* Must be non-zero */
755 +-
756 +- ch = ctx->polytmp[0];
757 +- cl = ctx->polytmp[1];
758 +-
759 +- if (!ctx->first_block_processed) {
760 +- ctx->first_block_processed = 1;
761 ++ const u64 *kptr = tctx->nhkey;
762 ++ const u64 pkh = tctx->polykey[0];
763 ++ const u64 pkl = tctx->polykey[1];
764 ++ u64 ch = dctx->polytmp[0];
765 ++ u64 cl = dctx->polytmp[1];
766 ++ u64 rh, rl;
767 ++
768 ++ if (!dctx->first_block_processed) {
769 ++ dctx->first_block_processed = true;
770 + nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
771 + rh &= m62;
772 + ADD128(ch, cl, rh, rl);
773 + mptr += (VMAC_NHBYTES/sizeof(u64));
774 +- i--;
775 ++ blocks--;
776 + }
777 +
778 +- while (i--) {
779 ++ while (blocks--) {
780 + nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
781 + rh &= m62;
782 + poly_step(ch, cl, pkh, pkl, rh, rl);
783 + mptr += (VMAC_NHBYTES/sizeof(u64));
784 + }
785 +
786 +- ctx->polytmp[0] = ch;
787 +- ctx->polytmp[1] = cl;
788 ++ dctx->polytmp[0] = ch;
789 ++ dctx->polytmp[1] = cl;
790 + }
791 +
792 +-static u64 vhash(unsigned char m[], unsigned int mbytes,
793 +- u64 *tagl, struct vmac_ctx *ctx)
794 ++static int vmac_setkey(struct crypto_shash *tfm,
795 ++ const u8 *key, unsigned int keylen)
796 + {
797 +- u64 rh, rl, *mptr;
798 +- const u64 *kptr = (u64 *)ctx->nhkey;
799 +- int i, remaining;
800 +- u64 ch, cl;
801 +- u64 pkh = ctx->polykey[0];
802 +- u64 pkl = ctx->polykey[1];
803 +-
804 +- mptr = (u64 *)m;
805 +- i = mbytes / VMAC_NHBYTES;
806 +- remaining = mbytes % VMAC_NHBYTES;
807 +-
808 +- if (ctx->first_block_processed) {
809 +- ch = ctx->polytmp[0];
810 +- cl = ctx->polytmp[1];
811 +- } else if (i) {
812 +- nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, ch, cl);
813 +- ch &= m62;
814 +- ADD128(ch, cl, pkh, pkl);
815 +- mptr += (VMAC_NHBYTES/sizeof(u64));
816 +- i--;
817 +- } else if (remaining) {
818 +- nh_16(mptr, kptr, 2*((remaining+15)/16), ch, cl);
819 +- ch &= m62;
820 +- ADD128(ch, cl, pkh, pkl);
821 +- mptr += (VMAC_NHBYTES/sizeof(u64));
822 +- goto do_l3;
823 +- } else {/* Empty String */
824 +- ch = pkh; cl = pkl;
825 +- goto do_l3;
826 +- }
827 +-
828 +- while (i--) {
829 +- nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
830 +- rh &= m62;
831 +- poly_step(ch, cl, pkh, pkl, rh, rl);
832 +- mptr += (VMAC_NHBYTES/sizeof(u64));
833 +- }
834 +- if (remaining) {
835 +- nh_16(mptr, kptr, 2*((remaining+15)/16), rh, rl);
836 +- rh &= m62;
837 +- poly_step(ch, cl, pkh, pkl, rh, rl);
838 +- }
839 +-
840 +-do_l3:
841 +- vhash_abort(ctx);
842 +- remaining *= 8;
843 +- return l3hash(ch, cl, ctx->l3key[0], ctx->l3key[1], remaining);
844 +-}
845 ++ struct vmac_tfm_ctx *tctx = crypto_shash_ctx(tfm);
846 ++ __be64 out[2];
847 ++ u8 in[16] = { 0 };
848 ++ unsigned int i;
849 ++ int err;
850 +
851 +-static u64 vmac(unsigned char m[], unsigned int mbytes,
852 +- const unsigned char n[16], u64 *tagl,
853 +- struct vmac_ctx_t *ctx)
854 +-{
855 +- u64 *in_n, *out_p;
856 +- u64 p, h;
857 +- int i;
858 +-
859 +- in_n = ctx->__vmac_ctx.cached_nonce;
860 +- out_p = ctx->__vmac_ctx.cached_aes;
861 +-
862 +- i = n[15] & 1;
863 +- if ((*(u64 *)(n+8) != in_n[1]) || (*(u64 *)(n) != in_n[0])) {
864 +- in_n[0] = *(u64 *)(n);
865 +- in_n[1] = *(u64 *)(n+8);
866 +- ((unsigned char *)in_n)[15] &= 0xFE;
867 +- crypto_cipher_encrypt_one(ctx->child,
868 +- (unsigned char *)out_p, (unsigned char *)in_n);
869 +-
870 +- ((unsigned char *)in_n)[15] |= (unsigned char)(1-i);
871 ++ if (keylen != VMAC_KEY_LEN) {
872 ++ crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
873 ++ return -EINVAL;
874 + }
875 +- p = be64_to_cpup(out_p + i);
876 +- h = vhash(m, mbytes, (u64 *)0, &ctx->__vmac_ctx);
877 +- return le64_to_cpu(p + h);
878 +-}
879 +
880 +-static int vmac_set_key(unsigned char user_key[], struct vmac_ctx_t *ctx)
881 +-{
882 +- u64 in[2] = {0}, out[2];
883 +- unsigned i;
884 +- int err = 0;
885 +-
886 +- err = crypto_cipher_setkey(ctx->child, user_key, VMAC_KEY_LEN);
887 ++ err = crypto_cipher_setkey(tctx->cipher, key, keylen);
888 + if (err)
889 + return err;
890 +
891 + /* Fill nh key */
892 +- ((unsigned char *)in)[0] = 0x80;
893 +- for (i = 0; i < sizeof(ctx->__vmac_ctx.nhkey)/8; i += 2) {
894 +- crypto_cipher_encrypt_one(ctx->child,
895 +- (unsigned char *)out, (unsigned char *)in);
896 +- ctx->__vmac_ctx.nhkey[i] = be64_to_cpup(out);
897 +- ctx->__vmac_ctx.nhkey[i+1] = be64_to_cpup(out+1);
898 +- ((unsigned char *)in)[15] += 1;
899 ++ in[0] = 0x80;
900 ++ for (i = 0; i < ARRAY_SIZE(tctx->nhkey); i += 2) {
901 ++ crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
902 ++ tctx->nhkey[i] = be64_to_cpu(out[0]);
903 ++ tctx->nhkey[i+1] = be64_to_cpu(out[1]);
904 ++ in[15]++;
905 + }
906 +
907 + /* Fill poly key */
908 +- ((unsigned char *)in)[0] = 0xC0;
909 +- in[1] = 0;
910 +- for (i = 0; i < sizeof(ctx->__vmac_ctx.polykey)/8; i += 2) {
911 +- crypto_cipher_encrypt_one(ctx->child,
912 +- (unsigned char *)out, (unsigned char *)in);
913 +- ctx->__vmac_ctx.polytmp[i] =
914 +- ctx->__vmac_ctx.polykey[i] =
915 +- be64_to_cpup(out) & mpoly;
916 +- ctx->__vmac_ctx.polytmp[i+1] =
917 +- ctx->__vmac_ctx.polykey[i+1] =
918 +- be64_to_cpup(out+1) & mpoly;
919 +- ((unsigned char *)in)[15] += 1;
920 ++ in[0] = 0xC0;
921 ++ in[15] = 0;
922 ++ for (i = 0; i < ARRAY_SIZE(tctx->polykey); i += 2) {
923 ++ crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
924 ++ tctx->polykey[i] = be64_to_cpu(out[0]) & mpoly;
925 ++ tctx->polykey[i+1] = be64_to_cpu(out[1]) & mpoly;
926 ++ in[15]++;
927 + }
928 +
929 + /* Fill ip key */
930 +- ((unsigned char *)in)[0] = 0xE0;
931 +- in[1] = 0;
932 +- for (i = 0; i < sizeof(ctx->__vmac_ctx.l3key)/8; i += 2) {
933 ++ in[0] = 0xE0;
934 ++ in[15] = 0;
935 ++ for (i = 0; i < ARRAY_SIZE(tctx->l3key); i += 2) {
936 + do {
937 +- crypto_cipher_encrypt_one(ctx->child,
938 +- (unsigned char *)out, (unsigned char *)in);
939 +- ctx->__vmac_ctx.l3key[i] = be64_to_cpup(out);
940 +- ctx->__vmac_ctx.l3key[i+1] = be64_to_cpup(out+1);
941 +- ((unsigned char *)in)[15] += 1;
942 +- } while (ctx->__vmac_ctx.l3key[i] >= p64
943 +- || ctx->__vmac_ctx.l3key[i+1] >= p64);
944 ++ crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
945 ++ tctx->l3key[i] = be64_to_cpu(out[0]);
946 ++ tctx->l3key[i+1] = be64_to_cpu(out[1]);
947 ++ in[15]++;
948 ++ } while (tctx->l3key[i] >= p64 || tctx->l3key[i+1] >= p64);
949 + }
950 +
951 +- /* Invalidate nonce/aes cache and reset other elements */
952 +- ctx->__vmac_ctx.cached_nonce[0] = (u64)-1; /* Ensure illegal nonce */
953 +- ctx->__vmac_ctx.cached_nonce[1] = (u64)0; /* Ensure illegal nonce */
954 +- ctx->__vmac_ctx.first_block_processed = 0;
955 +-
956 +- return err;
957 ++ return 0;
958 + }
959 +
960 +-static int vmac_setkey(struct crypto_shash *parent,
961 +- const u8 *key, unsigned int keylen)
962 ++static int vmac_init(struct shash_desc *desc)
963 + {
964 +- struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
965 ++ const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
966 ++ struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
967 +
968 +- if (keylen != VMAC_KEY_LEN) {
969 +- crypto_shash_set_flags(parent, CRYPTO_TFM_RES_BAD_KEY_LEN);
970 +- return -EINVAL;
971 +- }
972 +-
973 +- return vmac_set_key((u8 *)key, ctx);
974 +-}
975 +-
976 +-static int vmac_init(struct shash_desc *pdesc)
977 +-{
978 ++ dctx->partial_size = 0;
979 ++ dctx->first_block_processed = false;
980 ++ memcpy(dctx->polytmp, tctx->polykey, sizeof(dctx->polytmp));
981 + return 0;
982 + }
983 +
984 +-static int vmac_update(struct shash_desc *pdesc, const u8 *p,
985 +- unsigned int len)
986 ++static int vmac_update(struct shash_desc *desc, const u8 *p, unsigned int len)
987 + {
988 +- struct crypto_shash *parent = pdesc->tfm;
989 +- struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
990 +- int expand;
991 +- int min;
992 +-
993 +- expand = VMAC_NHBYTES - ctx->partial_size > 0 ?
994 +- VMAC_NHBYTES - ctx->partial_size : 0;
995 +-
996 +- min = len < expand ? len : expand;
997 +-
998 +- memcpy(ctx->partial + ctx->partial_size, p, min);
999 +- ctx->partial_size += min;
1000 +-
1001 +- if (len < expand)
1002 +- return 0;
1003 +-
1004 +- vhash_update(ctx->partial, VMAC_NHBYTES, &ctx->__vmac_ctx);
1005 +- ctx->partial_size = 0;
1006 +-
1007 +- len -= expand;
1008 +- p += expand;
1009 ++ const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
1010 ++ struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
1011 ++ unsigned int n;
1012 ++
1013 ++ if (dctx->partial_size) {
1014 ++ n = min(len, VMAC_NHBYTES - dctx->partial_size);
1015 ++ memcpy(&dctx->partial[dctx->partial_size], p, n);
1016 ++ dctx->partial_size += n;
1017 ++ p += n;
1018 ++ len -= n;
1019 ++ if (dctx->partial_size == VMAC_NHBYTES) {
1020 ++ vhash_blocks(tctx, dctx, dctx->partial_words, 1);
1021 ++ dctx->partial_size = 0;
1022 ++ }
1023 ++ }
1024 +
1025 +- if (len % VMAC_NHBYTES) {
1026 +- memcpy(ctx->partial, p + len - (len % VMAC_NHBYTES),
1027 +- len % VMAC_NHBYTES);
1028 +- ctx->partial_size = len % VMAC_NHBYTES;
1029 ++ if (len >= VMAC_NHBYTES) {
1030 ++ n = round_down(len, VMAC_NHBYTES);
1031 ++ /* TODO: 'p' may be misaligned here */
1032 ++ vhash_blocks(tctx, dctx, (const __le64 *)p, n / VMAC_NHBYTES);
1033 ++ p += n;
1034 ++ len -= n;
1035 + }
1036 +
1037 +- vhash_update(p, len - len % VMAC_NHBYTES, &ctx->__vmac_ctx);
1038 ++ if (len) {
1039 ++ memcpy(dctx->partial, p, len);
1040 ++ dctx->partial_size = len;
1041 ++ }
1042 +
1043 + return 0;
1044 + }
1045 +
1046 +-static int vmac_final(struct shash_desc *pdesc, u8 *out)
1047 ++static u64 vhash_final(const struct vmac_tfm_ctx *tctx,
1048 ++ struct vmac_desc_ctx *dctx)
1049 + {
1050 +- struct crypto_shash *parent = pdesc->tfm;
1051 +- struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
1052 +- vmac_t mac;
1053 +- u8 nonce[16] = {};
1054 +-
1055 +- /* vmac() ends up accessing outside the array bounds that
1056 +- * we specify. In appears to access up to the next 2-word
1057 +- * boundary. We'll just be uber cautious and zero the
1058 +- * unwritten bytes in the buffer.
1059 +- */
1060 +- if (ctx->partial_size) {
1061 +- memset(ctx->partial + ctx->partial_size, 0,
1062 +- VMAC_NHBYTES - ctx->partial_size);
1063 ++ unsigned int partial = dctx->partial_size;
1064 ++ u64 ch = dctx->polytmp[0];
1065 ++ u64 cl = dctx->polytmp[1];
1066 ++
1067 ++ /* L1 and L2-hash the final block if needed */
1068 ++ if (partial) {
1069 ++ /* Zero-pad to next 128-bit boundary */
1070 ++ unsigned int n = round_up(partial, 16);
1071 ++ u64 rh, rl;
1072 ++
1073 ++ memset(&dctx->partial[partial], 0, n - partial);
1074 ++ nh_16(dctx->partial_words, tctx->nhkey, n / 8, rh, rl);
1075 ++ rh &= m62;
1076 ++ if (dctx->first_block_processed)
1077 ++ poly_step(ch, cl, tctx->polykey[0], tctx->polykey[1],
1078 ++ rh, rl);
1079 ++ else
1080 ++ ADD128(ch, cl, rh, rl);
1081 + }
1082 +- mac = vmac(ctx->partial, ctx->partial_size, nonce, NULL, ctx);
1083 +- memcpy(out, &mac, sizeof(vmac_t));
1084 +- memzero_explicit(&mac, sizeof(vmac_t));
1085 +- memset(&ctx->__vmac_ctx, 0, sizeof(struct vmac_ctx));
1086 +- ctx->partial_size = 0;
1087 ++
1088 ++ /* L3-hash the 128-bit output of L2-hash */
1089 ++ return l3hash(ch, cl, tctx->l3key[0], tctx->l3key[1], partial * 8);
1090 ++}
1091 ++
1092 ++static int vmac_final(struct shash_desc *desc, u8 *out)
1093 ++{
1094 ++ const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
1095 ++ struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
1096 ++ static const u8 nonce[16] = {}; /* TODO: this is insecure */
1097 ++ union {
1098 ++ u8 bytes[16];
1099 ++ __be64 pads[2];
1100 ++ } block;
1101 ++ int index;
1102 ++ u64 hash, pad;
1103 ++
1104 ++ /* Finish calculating the VHASH of the message */
1105 ++ hash = vhash_final(tctx, dctx);
1106 ++
1107 ++ /* Generate pseudorandom pad by encrypting the nonce */
1108 ++ memcpy(&block, nonce, 16);
1109 ++ index = block.bytes[15] & 1;
1110 ++ block.bytes[15] &= ~1;
1111 ++ crypto_cipher_encrypt_one(tctx->cipher, block.bytes, block.bytes);
1112 ++ pad = be64_to_cpu(block.pads[index]);
1113 ++
1114 ++ /* The VMAC is the sum of VHASH and the pseudorandom pad */
1115 ++ put_unaligned_le64(hash + pad, out);
1116 + return 0;
1117 + }
1118 +
1119 + static int vmac_init_tfm(struct crypto_tfm *tfm)
1120 + {
1121 +- struct crypto_cipher *cipher;
1122 +- struct crypto_instance *inst = (void *)tfm->__crt_alg;
1123 ++ struct crypto_instance *inst = crypto_tfm_alg_instance(tfm);
1124 + struct crypto_spawn *spawn = crypto_instance_ctx(inst);
1125 +- struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
1126 ++ struct vmac_tfm_ctx *tctx = crypto_tfm_ctx(tfm);
1127 ++ struct crypto_cipher *cipher;
1128 +
1129 + cipher = crypto_spawn_cipher(spawn);
1130 + if (IS_ERR(cipher))
1131 + return PTR_ERR(cipher);
1132 +
1133 +- ctx->child = cipher;
1134 ++ tctx->cipher = cipher;
1135 + return 0;
1136 + }
1137 +
1138 + static void vmac_exit_tfm(struct crypto_tfm *tfm)
1139 + {
1140 +- struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
1141 +- crypto_free_cipher(ctx->child);
1142 ++ struct vmac_tfm_ctx *tctx = crypto_tfm_ctx(tfm);
1143 ++
1144 ++ crypto_free_cipher(tctx->cipher);
1145 + }
1146 +
1147 + static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
1148 +@@ -655,6 +608,10 @@ static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
1149 + if (IS_ERR(alg))
1150 + return PTR_ERR(alg);
1151 +
1152 ++ err = -EINVAL;
1153 ++ if (alg->cra_blocksize != 16)
1154 ++ goto out_put_alg;
1155 ++
1156 + inst = shash_alloc_instance("vmac", alg);
1157 + err = PTR_ERR(inst);
1158 + if (IS_ERR(inst))
1159 +@@ -670,11 +627,12 @@ static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
1160 + inst->alg.base.cra_blocksize = alg->cra_blocksize;
1161 + inst->alg.base.cra_alignmask = alg->cra_alignmask;
1162 +
1163 +- inst->alg.digestsize = sizeof(vmac_t);
1164 +- inst->alg.base.cra_ctxsize = sizeof(struct vmac_ctx_t);
1165 ++ inst->alg.base.cra_ctxsize = sizeof(struct vmac_tfm_ctx);
1166 + inst->alg.base.cra_init = vmac_init_tfm;
1167 + inst->alg.base.cra_exit = vmac_exit_tfm;
1168 +
1169 ++ inst->alg.descsize = sizeof(struct vmac_desc_ctx);
1170 ++ inst->alg.digestsize = VMAC_TAG_LEN / 8;
1171 + inst->alg.init = vmac_init;
1172 + inst->alg.update = vmac_update;
1173 + inst->alg.final = vmac_final;
1174 +diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
1175 +index 572b6c7303ed..f14695e744d0 100644
1176 +--- a/drivers/acpi/apei/ghes.c
1177 ++++ b/drivers/acpi/apei/ghes.c
1178 +@@ -114,19 +114,7 @@ static DEFINE_MUTEX(ghes_list_mutex);
1179 + * from BIOS to Linux can be determined only in NMI, IRQ or timer
1180 + * handler, but general ioremap can not be used in atomic context, so
1181 + * the fixmap is used instead.
1182 +- */
1183 +-
1184 +-/*
1185 +- * Two virtual pages are used, one for IRQ/PROCESS context, the other for
1186 +- * NMI context (optionally).
1187 +- */
1188 +-#define GHES_IOREMAP_PAGES 2
1189 +-#define GHES_IOREMAP_IRQ_PAGE(base) (base)
1190 +-#define GHES_IOREMAP_NMI_PAGE(base) ((base) + PAGE_SIZE)
1191 +-
1192 +-/* virtual memory area for atomic ioremap */
1193 +-static struct vm_struct *ghes_ioremap_area;
1194 +-/*
1195 ++ *
1196 + * These 2 spinlocks are used to prevent the fixmap entries from being used
1197 + * simultaneously.
1198 + */
1199 +@@ -141,23 +129,6 @@ static atomic_t ghes_estatus_cache_alloced;
1200 +
1201 + static int ghes_panic_timeout __read_mostly = 30;
1202 +
1203 +-static int ghes_ioremap_init(void)
1204 +-{
1205 +- ghes_ioremap_area = __get_vm_area(PAGE_SIZE * GHES_IOREMAP_PAGES,
1206 +- VM_IOREMAP, VMALLOC_START, VMALLOC_END);
1207 +- if (!ghes_ioremap_area) {
1208 +- pr_err(GHES_PFX "Failed to allocate virtual memory area for atomic ioremap.\n");
1209 +- return -ENOMEM;
1210 +- }
1211 +-
1212 +- return 0;
1213 +-}
1214 +-
1215 +-static void ghes_ioremap_exit(void)
1216 +-{
1217 +- free_vm_area(ghes_ioremap_area);
1218 +-}
1219 +-
1220 + static void __iomem *ghes_ioremap_pfn_nmi(u64 pfn)
1221 + {
1222 + phys_addr_t paddr;
1223 +@@ -1247,13 +1218,9 @@ static int __init ghes_init(void)
1224 +
1225 + ghes_nmi_init_cxt();
1226 +
1227 +- rc = ghes_ioremap_init();
1228 +- if (rc)
1229 +- goto err;
1230 +-
1231 + rc = ghes_estatus_pool_init();
1232 + if (rc)
1233 +- goto err_ioremap_exit;
1234 ++ goto err;
1235 +
1236 + rc = ghes_estatus_pool_expand(GHES_ESTATUS_CACHE_AVG_SIZE *
1237 + GHES_ESTATUS_CACHE_ALLOCED_MAX);
1238 +@@ -1277,8 +1244,6 @@ static int __init ghes_init(void)
1239 + return 0;
1240 + err_pool_exit:
1241 + ghes_estatus_pool_exit();
1242 +-err_ioremap_exit:
1243 +- ghes_ioremap_exit();
1244 + err:
1245 + return rc;
1246 + }
1247 +diff --git a/drivers/clk/sunxi-ng/ccu-sun4i-a10.c b/drivers/clk/sunxi-ng/ccu-sun4i-a10.c
1248 +index 286b0049b7b6..a48fde191c0a 100644
1249 +--- a/drivers/clk/sunxi-ng/ccu-sun4i-a10.c
1250 ++++ b/drivers/clk/sunxi-ng/ccu-sun4i-a10.c
1251 +@@ -223,7 +223,7 @@ static struct ccu_mux cpu_clk = {
1252 + .hw.init = CLK_HW_INIT_PARENTS("cpu",
1253 + cpu_parents,
1254 + &ccu_mux_ops,
1255 +- CLK_IS_CRITICAL),
1256 ++ CLK_SET_RATE_PARENT | CLK_IS_CRITICAL),
1257 + }
1258 + };
1259 +
1260 +diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
1261 +index 0e2011636fbb..c53c7ac992f8 100644
1262 +--- a/drivers/firmware/qemu_fw_cfg.c
1263 ++++ b/drivers/firmware/qemu_fw_cfg.c
1264 +@@ -582,9 +582,10 @@ static int fw_cfg_sysfs_remove(struct platform_device *pdev)
1265 + {
1266 + pr_debug("fw_cfg: unloading.\n");
1267 + fw_cfg_sysfs_cache_cleanup();
1268 ++ sysfs_remove_file(fw_cfg_top_ko, &fw_cfg_rev_attr.attr);
1269 ++ fw_cfg_io_cleanup();
1270 + fw_cfg_kset_unregister_recursive(fw_cfg_fname_kset);
1271 + fw_cfg_kobj_cleanup(fw_cfg_sel_ko);
1272 +- fw_cfg_io_cleanup();
1273 + return 0;
1274 + }
1275 +
1276 +diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
1277 +index 46a2f5d9aa25..f00421dfacbd 100644
1278 +--- a/include/asm-generic/pgtable.h
1279 ++++ b/include/asm-generic/pgtable.h
1280 +@@ -991,8 +991,8 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
1281 + int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
1282 + int pud_clear_huge(pud_t *pud);
1283 + int pmd_clear_huge(pmd_t *pmd);
1284 +-int pud_free_pmd_page(pud_t *pud);
1285 +-int pmd_free_pte_page(pmd_t *pmd);
1286 ++int pud_free_pmd_page(pud_t *pud, unsigned long addr);
1287 ++int pmd_free_pte_page(pmd_t *pmd, unsigned long addr);
1288 + #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
1289 + static inline int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot)
1290 + {
1291 +@@ -1018,11 +1018,11 @@ static inline int pmd_clear_huge(pmd_t *pmd)
1292 + {
1293 + return 0;
1294 + }
1295 +-static inline int pud_free_pmd_page(pud_t *pud)
1296 ++static inline int pud_free_pmd_page(pud_t *pud, unsigned long addr)
1297 + {
1298 + return 0;
1299 + }
1300 +-static inline int pmd_free_pte_page(pmd_t *pmd)
1301 ++static inline int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
1302 + {
1303 + return 0;
1304 + }
1305 +diff --git a/include/crypto/vmac.h b/include/crypto/vmac.h
1306 +deleted file mode 100644
1307 +index 6b700c7b2fe1..000000000000
1308 +--- a/include/crypto/vmac.h
1309 ++++ /dev/null
1310 +@@ -1,63 +0,0 @@
1311 +-/*
1312 +- * Modified to interface to the Linux kernel
1313 +- * Copyright (c) 2009, Intel Corporation.
1314 +- *
1315 +- * This program is free software; you can redistribute it and/or modify it
1316 +- * under the terms and conditions of the GNU General Public License,
1317 +- * version 2, as published by the Free Software Foundation.
1318 +- *
1319 +- * This program is distributed in the hope it will be useful, but WITHOUT
1320 +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1321 +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1322 +- * more details.
1323 +- *
1324 +- * You should have received a copy of the GNU General Public License along with
1325 +- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
1326 +- * Place - Suite 330, Boston, MA 02111-1307 USA.
1327 +- */
1328 +-
1329 +-#ifndef __CRYPTO_VMAC_H
1330 +-#define __CRYPTO_VMAC_H
1331 +-
1332 +-/* --------------------------------------------------------------------------
1333 +- * VMAC and VHASH Implementation by Ted Krovetz (tdk@×××.org) and Wei Dai.
1334 +- * This implementation is herby placed in the public domain.
1335 +- * The authors offers no warranty. Use at your own risk.
1336 +- * Please send bug reports to the authors.
1337 +- * Last modified: 17 APR 08, 1700 PDT
1338 +- * ----------------------------------------------------------------------- */
1339 +-
1340 +-/*
1341 +- * User definable settings.
1342 +- */
1343 +-#define VMAC_TAG_LEN 64
1344 +-#define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */
1345 +-#define VMAC_KEY_LEN (VMAC_KEY_SIZE/8)
1346 +-#define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/
1347 +-
1348 +-/*
1349 +- * This implementation uses u32 and u64 as names for unsigned 32-
1350 +- * and 64-bit integer types. These are defined in C99 stdint.h. The
1351 +- * following may need adaptation if you are not running a C99 or
1352 +- * Microsoft C environment.
1353 +- */
1354 +-struct vmac_ctx {
1355 +- u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
1356 +- u64 polykey[2*VMAC_TAG_LEN/64];
1357 +- u64 l3key[2*VMAC_TAG_LEN/64];
1358 +- u64 polytmp[2*VMAC_TAG_LEN/64];
1359 +- u64 cached_nonce[2];
1360 +- u64 cached_aes[2];
1361 +- int first_block_processed;
1362 +-};
1363 +-
1364 +-typedef u64 vmac_t;
1365 +-
1366 +-struct vmac_ctx_t {
1367 +- struct crypto_cipher *child;
1368 +- struct vmac_ctx __vmac_ctx;
1369 +- u8 partial[VMAC_NHBYTES]; /* partial block */
1370 +- int partial_size; /* size of the partial block */
1371 +-};
1372 +-
1373 +-#endif /* __CRYPTO_VMAC_H */
1374 +diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
1375 +index d447f24df970..0812cd5408c9 100644
1376 +--- a/include/trace/events/sched.h
1377 ++++ b/include/trace/events/sched.h
1378 +@@ -116,9 +116,9 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
1379 + * RUNNING (we will not have dequeued if state != RUNNING).
1380 + */
1381 + if (preempt)
1382 +- return TASK_STATE_MAX;
1383 ++ return TASK_REPORT_MAX;
1384 +
1385 +- return __get_task_state(p);
1386 ++ return 1 << __get_task_state(p);
1387 + }
1388 + #endif /* CREATE_TRACE_POINTS */
1389 +
1390 +@@ -164,7 +164,7 @@ TRACE_EVENT(sched_switch,
1391 + { 0x40, "P" }, { 0x80, "I" }) :
1392 + "R",
1393 +
1394 +- __entry->prev_state & TASK_STATE_MAX ? "+" : "",
1395 ++ __entry->prev_state & TASK_REPORT_MAX ? "+" : "",
1396 + __entry->next_comm, __entry->next_pid, __entry->next_prio)
1397 + );
1398 +
1399 +diff --git a/lib/ioremap.c b/lib/ioremap.c
1400 +index 54e5bbaa3200..517f5853ffed 100644
1401 +--- a/lib/ioremap.c
1402 ++++ b/lib/ioremap.c
1403 +@@ -92,7 +92,7 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
1404 + if (ioremap_pmd_enabled() &&
1405 + ((next - addr) == PMD_SIZE) &&
1406 + IS_ALIGNED(phys_addr + addr, PMD_SIZE) &&
1407 +- pmd_free_pte_page(pmd)) {
1408 ++ pmd_free_pte_page(pmd, addr)) {
1409 + if (pmd_set_huge(pmd, phys_addr + addr, prot))
1410 + continue;
1411 + }
1412 +@@ -119,7 +119,7 @@ static inline int ioremap_pud_range(p4d_t *p4d, unsigned long addr,
1413 + if (ioremap_pud_enabled() &&
1414 + ((next - addr) == PUD_SIZE) &&
1415 + IS_ALIGNED(phys_addr + addr, PUD_SIZE) &&
1416 +- pud_free_pmd_page(pud)) {
1417 ++ pud_free_pmd_page(pud, addr)) {
1418 + if (pud_set_huge(pud, phys_addr + addr, prot))
1419 + continue;
1420 + }
1421 +diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
1422 +index 8112893037bd..cef3754408d4 100644
1423 +--- a/net/bluetooth/hidp/core.c
1424 ++++ b/net/bluetooth/hidp/core.c
1425 +@@ -431,8 +431,8 @@ static void hidp_del_timer(struct hidp_session *session)
1426 + del_timer(&session->timer);
1427 + }
1428 +
1429 +-static void hidp_process_report(struct hidp_session *session,
1430 +- int type, const u8 *data, int len, int intr)
1431 ++static void hidp_process_report(struct hidp_session *session, int type,
1432 ++ const u8 *data, unsigned int len, int intr)
1433 + {
1434 + if (len > HID_MAX_BUFFER_SIZE)
1435 + len = HID_MAX_BUFFER_SIZE;
1436 +diff --git a/scripts/depmod.sh b/scripts/depmod.sh
1437 +index 9831cca31240..f41b0a4b575c 100755
1438 +--- a/scripts/depmod.sh
1439 ++++ b/scripts/depmod.sh
1440 +@@ -11,10 +11,16 @@ DEPMOD=$1
1441 + KERNELRELEASE=$2
1442 + SYMBOL_PREFIX=$3
1443 +
1444 +-if ! test -r System.map -a -x "$DEPMOD"; then
1445 ++if ! test -r System.map ; then
1446 + exit 0
1447 + fi
1448 +
1449 ++if [ -z $(command -v $DEPMOD) ]; then
1450 ++ echo "'make modules_install' requires $DEPMOD. Please install it." >&2
1451 ++ echo "This is probably in the kmod package." >&2
1452 ++ exit 1
1453 ++fi
1454 ++
1455 + # older versions of depmod don't support -P <symbol-prefix>
1456 + # support was added in module-init-tools 3.13
1457 + if test -n "$SYMBOL_PREFIX"; then
1458 +diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
1459 +index 694db27b11fa..13354d6304a8 100644
1460 +--- a/sound/soc/codecs/msm8916-wcd-digital.c
1461 ++++ b/sound/soc/codecs/msm8916-wcd-digital.c
1462 +@@ -238,7 +238,7 @@ static const struct soc_enum rx_mix2_inp1_chain_enum = SOC_ENUM_SINGLE(
1463 + static const struct soc_enum rx2_mix1_inp_enum[] = {
1464 + SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B1_CTL, 0, 6, rx_mix1_text),
1465 + SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B1_CTL, 3, 6, rx_mix1_text),
1466 +- SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B1_CTL, 0, 6, rx_mix1_text),
1467 ++ SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B2_CTL, 0, 6, rx_mix1_text),
1468 + };
1469 +
1470 + /* RX2 MIX2 */
1471 +@@ -249,7 +249,7 @@ static const struct soc_enum rx2_mix2_inp1_chain_enum = SOC_ENUM_SINGLE(
1472 + static const struct soc_enum rx3_mix1_inp_enum[] = {
1473 + SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B1_CTL, 0, 6, rx_mix1_text),
1474 + SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B1_CTL, 3, 6, rx_mix1_text),
1475 +- SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B1_CTL, 0, 6, rx_mix1_text),
1476 ++ SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text),
1477 + };
1478 +
1479 + /* DEC */
1480 +diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
1481 +index 20755ecc7f9e..a02dec251afe 100644
1482 +--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
1483 ++++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
1484 +@@ -116,23 +116,19 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
1485 + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
1486 + struct snd_soc_jack *jack = &ctx->jack;
1487 +
1488 +- /**
1489 +- * TI supports 4 butons headset detection
1490 +- * KEY_MEDIA
1491 +- * KEY_VOICECOMMAND
1492 +- * KEY_VOLUMEUP
1493 +- * KEY_VOLUMEDOWN
1494 +- */
1495 +- if (ctx->ts3a227e_present)
1496 +- jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
1497 +- SND_JACK_BTN_0 | SND_JACK_BTN_1 |
1498 +- SND_JACK_BTN_2 | SND_JACK_BTN_3;
1499 +- else
1500 +- jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
1501 ++ if (ctx->ts3a227e_present) {
1502 ++ /*
1503 ++ * The jack has already been created in the
1504 ++ * cht_max98090_headset_init() function.
1505 ++ */
1506 ++ snd_soc_jack_notifier_register(jack, &cht_jack_nb);
1507 ++ return 0;
1508 ++ }
1509 ++
1510 ++ jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
1511 +
1512 + ret = snd_soc_card_jack_new(runtime->card, "Headset Jack",
1513 + jack_type, jack, NULL, 0);
1514 +-
1515 + if (ret) {
1516 + dev_err(runtime->dev, "Headset Jack creation failed %d\n", ret);
1517 + return ret;
1518 +@@ -188,6 +184,27 @@ static int cht_max98090_headset_init(struct snd_soc_component *component)
1519 + {
1520 + struct snd_soc_card *card = component->card;
1521 + struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
1522 ++ struct snd_soc_jack *jack = &ctx->jack;
1523 ++ int jack_type;
1524 ++ int ret;
1525 ++
1526 ++ /*
1527 ++ * TI supports 4 butons headset detection
1528 ++ * KEY_MEDIA
1529 ++ * KEY_VOICECOMMAND
1530 ++ * KEY_VOLUMEUP
1531 ++ * KEY_VOLUMEDOWN
1532 ++ */
1533 ++ jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
1534 ++ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
1535 ++ SND_JACK_BTN_2 | SND_JACK_BTN_3;
1536 ++
1537 ++ ret = snd_soc_card_jack_new(card, "Headset Jack", jack_type,
1538 ++ jack, NULL, 0);
1539 ++ if (ret) {
1540 ++ dev_err(card->dev, "Headset Jack creation failed %d\n", ret);
1541 ++ return ret;
1542 ++ }
1543 +
1544 + return ts3a227e_enable_jack_detect(component, &ctx->jack);
1545 + }
1546 +diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
1547 +index 2684a2ba33cd..e28edb1f7263 100644
1548 +--- a/sound/soc/sh/rcar/adg.c
1549 ++++ b/sound/soc/sh/rcar/adg.c
1550 +@@ -479,10 +479,10 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
1551 + }
1552 +
1553 + if (req_rate[0] % 48000 == 0)
1554 +- adg->flags = AUDIO_OUT_48;
1555 ++ adg->flags |= AUDIO_OUT_48;
1556 +
1557 + if (of_get_property(np, "clkout-lr-asynchronous", NULL))
1558 +- adg->flags = LRCLK_ASYNC;
1559 ++ adg->flags |= LRCLK_ASYNC;
1560 +
1561 + /*
1562 + * This driver is assuming that AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC