--- /dev/null
+From 1c9609e3a8cf5997bd35205cfda1ff2218ee793b Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 19 Jan 2018 14:18:34 +0100
+Subject: ALSA: hda - Reduce the suspend time consumption for ALC256
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 1c9609e3a8cf5997bd35205cfda1ff2218ee793b upstream.
+
+ALC256 has its own quirk to override the shutup call, and it contains
+the COEF update for pulling down the headset jack control. Currently,
+the COEF update is called after clearing the headphone pin, and this
+seems triggering a stall of the codec communication, and results in a
+long delay over a second at suspend.
+
+A quick resolution is to swap the calls: at first with the COEF
+update, then clear the headphone pin.
+
+Fixes: 4a219ef8f370 ("ALSA: hda/realtek - Add ALC256 HP depop function")
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=198503
+Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3131,11 +3131,13 @@ static void alc256_shutup(struct hda_cod
+ if (hp_pin_sense)
+ msleep(85);
+
++ /* 3k pull low control for Headset jack. */
++ /* NOTE: call this before clearing the pin, otherwise codec stalls */
++ alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
++
+ snd_hda_codec_write(codec, hp_pin, 0,
+ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+- alc_update_coef_idx(codec, 0x46, 0, 3 << 12); /* 3k pull low control for Headset jack. */
+-
+ if (hp_pin_sense)
+ msleep(100);
+
--- /dev/null
+From fc8517bf627c9b834f80274a1bc9ecd39b27231b Mon Sep 17 00:00:00 2001
+From: Sabrina Dubroca <sd@queasysnail.net>
+Date: Wed, 13 Dec 2017 14:54:36 +0100
+Subject: crypto: aesni - add wrapper for generic gcm(aes)
+
+From: Sabrina Dubroca <sd@queasysnail.net>
+
+commit fc8517bf627c9b834f80274a1bc9ecd39b27231b upstream.
+
+When I added generic-gcm-aes I didn't add a wrapper like the one
+provided for rfc4106(gcm(aes)). We need to add a cryptd wrapper to fall
+back on in case the FPU is not available, otherwise we might corrupt the
+FPU state.
+
+Fixes: cce2ea8d90fe ("crypto: aesni - add generic gcm(aes)")
+Reported-by: Ilya Lesokhin <ilyal@mellanox.com>
+Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
+Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/crypto/aesni-intel_glue.c | 66 ++++++++++++++++++++++++++++++-------
+ 1 file changed, 54 insertions(+), 12 deletions(-)
+
+--- a/arch/x86/crypto/aesni-intel_glue.c
++++ b/arch/x86/crypto/aesni-intel_glue.c
+@@ -690,8 +690,8 @@ static int common_rfc4106_set_key(struct
+ rfc4106_set_hash_subkey(ctx->hash_subkey, key, key_len);
+ }
+
+-static int rfc4106_set_key(struct crypto_aead *parent, const u8 *key,
+- unsigned int key_len)
++static int gcmaes_wrapper_set_key(struct crypto_aead *parent, const u8 *key,
++ unsigned int key_len)
+ {
+ struct cryptd_aead **ctx = crypto_aead_ctx(parent);
+ struct cryptd_aead *cryptd_tfm = *ctx;
+@@ -716,8 +716,8 @@ static int common_rfc4106_set_authsize(s
+
+ /* This is the Integrity Check Value (aka the authentication tag length and can
+ * be 8, 12 or 16 bytes long. */
+-static int rfc4106_set_authsize(struct crypto_aead *parent,
+- unsigned int authsize)
++static int gcmaes_wrapper_set_authsize(struct crypto_aead *parent,
++ unsigned int authsize)
+ {
+ struct cryptd_aead **ctx = crypto_aead_ctx(parent);
+ struct cryptd_aead *cryptd_tfm = *ctx;
+@@ -929,7 +929,7 @@ static int helper_rfc4106_decrypt(struct
+ aes_ctx);
+ }
+
+-static int rfc4106_encrypt(struct aead_request *req)
++static int gcmaes_wrapper_encrypt(struct aead_request *req)
+ {
+ struct crypto_aead *tfm = crypto_aead_reqtfm(req);
+ struct cryptd_aead **ctx = crypto_aead_ctx(tfm);
+@@ -945,7 +945,7 @@ static int rfc4106_encrypt(struct aead_r
+ return crypto_aead_encrypt(req);
+ }
+
+-static int rfc4106_decrypt(struct aead_request *req)
++static int gcmaes_wrapper_decrypt(struct aead_request *req)
+ {
+ struct crypto_aead *tfm = crypto_aead_reqtfm(req);
+ struct cryptd_aead **ctx = crypto_aead_ctx(tfm);
+@@ -1127,6 +1127,30 @@ static int generic_gcmaes_decrypt(struct
+ aes_ctx);
+ }
+
++static int generic_gcmaes_init(struct crypto_aead *aead)
++{
++ struct cryptd_aead *cryptd_tfm;
++ struct cryptd_aead **ctx = crypto_aead_ctx(aead);
++
++ cryptd_tfm = cryptd_alloc_aead("__driver-generic-gcm-aes-aesni",
++ CRYPTO_ALG_INTERNAL,
++ CRYPTO_ALG_INTERNAL);
++ if (IS_ERR(cryptd_tfm))
++ return PTR_ERR(cryptd_tfm);
++
++ *ctx = cryptd_tfm;
++ crypto_aead_set_reqsize(aead, crypto_aead_reqsize(&cryptd_tfm->base));
++
++ return 0;
++}
++
++static void generic_gcmaes_exit(struct crypto_aead *aead)
++{
++ struct cryptd_aead **ctx = crypto_aead_ctx(aead);
++
++ cryptd_free_aead(*ctx);
++}
++
+ static struct aead_alg aesni_aead_algs[] = { {
+ .setkey = common_rfc4106_set_key,
+ .setauthsize = common_rfc4106_set_authsize,
+@@ -1146,10 +1170,10 @@ static struct aead_alg aesni_aead_algs[]
+ }, {
+ .init = rfc4106_init,
+ .exit = rfc4106_exit,
+- .setkey = rfc4106_set_key,
+- .setauthsize = rfc4106_set_authsize,
+- .encrypt = rfc4106_encrypt,
+- .decrypt = rfc4106_decrypt,
++ .setkey = gcmaes_wrapper_set_key,
++ .setauthsize = gcmaes_wrapper_set_authsize,
++ .encrypt = gcmaes_wrapper_encrypt,
++ .decrypt = gcmaes_wrapper_decrypt,
+ .ivsize = GCM_RFC4106_IV_SIZE,
+ .maxauthsize = 16,
+ .base = {
+@@ -1169,13 +1193,31 @@ static struct aead_alg aesni_aead_algs[]
+ .ivsize = GCM_AES_IV_SIZE,
+ .maxauthsize = 16,
+ .base = {
++ .cra_name = "__generic-gcm-aes-aesni",
++ .cra_driver_name = "__driver-generic-gcm-aes-aesni",
++ .cra_priority = 0,
++ .cra_flags = CRYPTO_ALG_INTERNAL,
++ .cra_blocksize = 1,
++ .cra_ctxsize = sizeof(struct generic_gcmaes_ctx),
++ .cra_alignmask = AESNI_ALIGN - 1,
++ .cra_module = THIS_MODULE,
++ },
++}, {
++ .init = generic_gcmaes_init,
++ .exit = generic_gcmaes_exit,
++ .setkey = gcmaes_wrapper_set_key,
++ .setauthsize = gcmaes_wrapper_set_authsize,
++ .encrypt = gcmaes_wrapper_encrypt,
++ .decrypt = gcmaes_wrapper_decrypt,
++ .ivsize = GCM_AES_IV_SIZE,
++ .maxauthsize = 16,
++ .base = {
+ .cra_name = "gcm(aes)",
+ .cra_driver_name = "generic-gcm-aesni",
+ .cra_priority = 400,
+ .cra_flags = CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 1,
+- .cra_ctxsize = sizeof(struct generic_gcmaes_ctx),
+- .cra_alignmask = AESNI_ALIGN - 1,
++ .cra_ctxsize = sizeof(struct cryptd_aead *),
+ .cra_module = THIS_MODULE,
+ },
+ } };
--- /dev/null
+From 1ecdd37e308ca149dc378cce225068cbac54e3a6 Mon Sep 17 00:00:00 2001
+From: Junaid Shahid <junaids@google.com>
+Date: Wed, 20 Dec 2017 17:08:38 -0800
+Subject: crypto: aesni - Fix out-of-bounds access of the AAD buffer in generic-gcm-aesni
+
+From: Junaid Shahid <junaids@google.com>
+
+commit 1ecdd37e308ca149dc378cce225068cbac54e3a6 upstream.
+
+The aesni_gcm_enc/dec functions can access memory after the end of
+the AAD buffer if the AAD length is not a multiple of 4 bytes.
+It didn't matter with rfc4106-gcm-aesni as in that case the AAD was
+always followed by the 8 byte IV, but that is no longer the case with
+generic-gcm-aesni. This can potentially result in accessing a page that
+is not mapped and thus causing the machine to crash. This patch fixes
+that by reading the last <16 byte block of the AAD byte-by-byte and
+optionally via an 8-byte load if the block was at least 8 bytes.
+
+Fixes: 0487ccac ("crypto: aesni - make non-AVX AES-GCM work with any aadlen")
+Signed-off-by: Junaid Shahid <junaids@google.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/crypto/aesni-intel_asm.S | 112 ++++----------------------------------
+ 1 file changed, 12 insertions(+), 100 deletions(-)
+
+--- a/arch/x86/crypto/aesni-intel_asm.S
++++ b/arch/x86/crypto/aesni-intel_asm.S
+@@ -90,30 +90,6 @@ SHIFT_MASK: .octa 0x0f0e0d0c0b0a09080706
+ ALL_F: .octa 0xffffffffffffffffffffffffffffffff
+ .octa 0x00000000000000000000000000000000
+
+-.section .rodata
+-.align 16
+-.type aad_shift_arr, @object
+-.size aad_shift_arr, 272
+-aad_shift_arr:
+- .octa 0xffffffffffffffffffffffffffffffff
+- .octa 0xffffffffffffffffffffffffffffff0C
+- .octa 0xffffffffffffffffffffffffffff0D0C
+- .octa 0xffffffffffffffffffffffffff0E0D0C
+- .octa 0xffffffffffffffffffffffff0F0E0D0C
+- .octa 0xffffffffffffffffffffff0C0B0A0908
+- .octa 0xffffffffffffffffffff0D0C0B0A0908
+- .octa 0xffffffffffffffffff0E0D0C0B0A0908
+- .octa 0xffffffffffffffff0F0E0D0C0B0A0908
+- .octa 0xffffffffffffff0C0B0A090807060504
+- .octa 0xffffffffffff0D0C0B0A090807060504
+- .octa 0xffffffffff0E0D0C0B0A090807060504
+- .octa 0xffffffff0F0E0D0C0B0A090807060504
+- .octa 0xffffff0C0B0A09080706050403020100
+- .octa 0xffff0D0C0B0A09080706050403020100
+- .octa 0xff0E0D0C0B0A09080706050403020100
+- .octa 0x0F0E0D0C0B0A09080706050403020100
+-
+-
+ .text
+
+
+@@ -304,62 +280,30 @@ _done_read_partial_block_\@:
+ XMM2 XMM3 XMM4 XMMDst TMP6 TMP7 i i_seq operation
+ MOVADQ SHUF_MASK(%rip), %xmm14
+ mov arg7, %r10 # %r10 = AAD
+- mov arg8, %r12 # %r12 = aadLen
+- mov %r12, %r11
++ mov arg8, %r11 # %r11 = aadLen
+ pxor %xmm\i, %xmm\i
+ pxor \XMM2, \XMM2
+
+ cmp $16, %r11
+- jl _get_AAD_rest8\num_initial_blocks\operation
++ jl _get_AAD_rest\num_initial_blocks\operation
+ _get_AAD_blocks\num_initial_blocks\operation:
+ movdqu (%r10), %xmm\i
+ PSHUFB_XMM %xmm14, %xmm\i # byte-reflect the AAD data
+ pxor %xmm\i, \XMM2
+ GHASH_MUL \XMM2, \TMP3, \TMP1, \TMP2, \TMP4, \TMP5, \XMM1
+ add $16, %r10
+- sub $16, %r12
+ sub $16, %r11
+ cmp $16, %r11
+ jge _get_AAD_blocks\num_initial_blocks\operation
+
+ movdqu \XMM2, %xmm\i
++
++ /* read the last <16B of AAD */
++_get_AAD_rest\num_initial_blocks\operation:
+ cmp $0, %r11
+ je _get_AAD_done\num_initial_blocks\operation
+
+- pxor %xmm\i,%xmm\i
+-
+- /* read the last <16B of AAD. since we have at least 4B of
+- data right after the AAD (the ICV, and maybe some CT), we can
+- read 4B/8B blocks safely, and then get rid of the extra stuff */
+-_get_AAD_rest8\num_initial_blocks\operation:
+- cmp $4, %r11
+- jle _get_AAD_rest4\num_initial_blocks\operation
+- movq (%r10), \TMP1
+- add $8, %r10
+- sub $8, %r11
+- pslldq $8, \TMP1
+- psrldq $8, %xmm\i
+- pxor \TMP1, %xmm\i
+- jmp _get_AAD_rest8\num_initial_blocks\operation
+-_get_AAD_rest4\num_initial_blocks\operation:
+- cmp $0, %r11
+- jle _get_AAD_rest0\num_initial_blocks\operation
+- mov (%r10), %eax
+- movq %rax, \TMP1
+- add $4, %r10
+- sub $4, %r10
+- pslldq $12, \TMP1
+- psrldq $4, %xmm\i
+- pxor \TMP1, %xmm\i
+-_get_AAD_rest0\num_initial_blocks\operation:
+- /* finalize: shift out the extra bytes we read, and align
+- left. since pslldq can only shift by an immediate, we use
+- vpshufb and an array of shuffle masks */
+- movq %r12, %r11
+- salq $4, %r11
+- movdqu aad_shift_arr(%r11), \TMP1
+- PSHUFB_XMM \TMP1, %xmm\i
+-_get_AAD_rest_final\num_initial_blocks\operation:
++ READ_PARTIAL_BLOCK %r10, %r11, \TMP1, %xmm\i
+ PSHUFB_XMM %xmm14, %xmm\i # byte-reflect the AAD data
+ pxor \XMM2, %xmm\i
+ GHASH_MUL %xmm\i, \TMP3, \TMP1, \TMP2, \TMP4, \TMP5, \XMM1
+@@ -563,62 +507,30 @@ _initial_blocks_done\num_initial_blocks\
+ XMM2 XMM3 XMM4 XMMDst TMP6 TMP7 i i_seq operation
+ MOVADQ SHUF_MASK(%rip), %xmm14
+ mov arg7, %r10 # %r10 = AAD
+- mov arg8, %r12 # %r12 = aadLen
+- mov %r12, %r11
++ mov arg8, %r11 # %r11 = aadLen
+ pxor %xmm\i, %xmm\i
+ pxor \XMM2, \XMM2
+
+ cmp $16, %r11
+- jl _get_AAD_rest8\num_initial_blocks\operation
++ jl _get_AAD_rest\num_initial_blocks\operation
+ _get_AAD_blocks\num_initial_blocks\operation:
+ movdqu (%r10), %xmm\i
+ PSHUFB_XMM %xmm14, %xmm\i # byte-reflect the AAD data
+ pxor %xmm\i, \XMM2
+ GHASH_MUL \XMM2, \TMP3, \TMP1, \TMP2, \TMP4, \TMP5, \XMM1
+ add $16, %r10
+- sub $16, %r12
+ sub $16, %r11
+ cmp $16, %r11
+ jge _get_AAD_blocks\num_initial_blocks\operation
+
+ movdqu \XMM2, %xmm\i
++
++ /* read the last <16B of AAD */
++_get_AAD_rest\num_initial_blocks\operation:
+ cmp $0, %r11
+ je _get_AAD_done\num_initial_blocks\operation
+
+- pxor %xmm\i,%xmm\i
+-
+- /* read the last <16B of AAD. since we have at least 4B of
+- data right after the AAD (the ICV, and maybe some PT), we can
+- read 4B/8B blocks safely, and then get rid of the extra stuff */
+-_get_AAD_rest8\num_initial_blocks\operation:
+- cmp $4, %r11
+- jle _get_AAD_rest4\num_initial_blocks\operation
+- movq (%r10), \TMP1
+- add $8, %r10
+- sub $8, %r11
+- pslldq $8, \TMP1
+- psrldq $8, %xmm\i
+- pxor \TMP1, %xmm\i
+- jmp _get_AAD_rest8\num_initial_blocks\operation
+-_get_AAD_rest4\num_initial_blocks\operation:
+- cmp $0, %r11
+- jle _get_AAD_rest0\num_initial_blocks\operation
+- mov (%r10), %eax
+- movq %rax, \TMP1
+- add $4, %r10
+- sub $4, %r10
+- pslldq $12, \TMP1
+- psrldq $4, %xmm\i
+- pxor \TMP1, %xmm\i
+-_get_AAD_rest0\num_initial_blocks\operation:
+- /* finalize: shift out the extra bytes we read, and align
+- left. since pslldq can only shift by an immediate, we use
+- vpshufb and an array of shuffle masks */
+- movq %r12, %r11
+- salq $4, %r11
+- movdqu aad_shift_arr(%r11), \TMP1
+- PSHUFB_XMM \TMP1, %xmm\i
+-_get_AAD_rest_final\num_initial_blocks\operation:
++ READ_PARTIAL_BLOCK %r10, %r11, \TMP1, %xmm\i
+ PSHUFB_XMM %xmm14, %xmm\i # byte-reflect the AAD data
+ pxor \XMM2, %xmm\i
+ GHASH_MUL %xmm\i, \TMP3, \TMP1, \TMP2, \TMP4, \TMP5, \XMM1
--- /dev/null
+From b20209c91e23a9bbad9cac2f80bc16b3c259e10e Mon Sep 17 00:00:00 2001
+From: Junaid Shahid <junaids@google.com>
+Date: Wed, 20 Dec 2017 17:08:37 -0800
+Subject: crypto: aesni - Fix out-of-bounds access of the data buffer in generic-gcm-aesni
+
+From: Junaid Shahid <junaids@google.com>
+
+commit b20209c91e23a9bbad9cac2f80bc16b3c259e10e upstream.
+
+The aesni_gcm_enc/dec functions can access memory before the start of
+the data buffer if the length of the data buffer is less than 16 bytes.
+This is because they perform the read via a single 16-byte load. This
+can potentially result in accessing a page that is not mapped and thus
+causing the machine to crash. This patch fixes that by reading the
+partial block byte-by-byte and optionally an via 8-byte load if the block
+was at least 8 bytes.
+
+Fixes: 0487ccac ("crypto: aesni - make non-AVX AES-GCM work with any aadlen")
+Signed-off-by: Junaid Shahid <junaids@google.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/crypto/aesni-intel_asm.S | 87 +++++++++++++++++++-------------------
+ 1 file changed, 45 insertions(+), 42 deletions(-)
+
+--- a/arch/x86/crypto/aesni-intel_asm.S
++++ b/arch/x86/crypto/aesni-intel_asm.S
+@@ -257,6 +257,37 @@ aad_shift_arr:
+ pxor \TMP1, \GH # result is in TMP1
+ .endm
+
++# Reads DLEN bytes starting at DPTR and stores in XMMDst
++# where 0 < DLEN < 16
++# Clobbers %rax, DLEN and XMM1
++.macro READ_PARTIAL_BLOCK DPTR DLEN XMM1 XMMDst
++ cmp $8, \DLEN
++ jl _read_lt8_\@
++ mov (\DPTR), %rax
++ MOVQ_R64_XMM %rax, \XMMDst
++ sub $8, \DLEN
++ jz _done_read_partial_block_\@
++ xor %eax, %eax
++_read_next_byte_\@:
++ shl $8, %rax
++ mov 7(\DPTR, \DLEN, 1), %al
++ dec \DLEN
++ jnz _read_next_byte_\@
++ MOVQ_R64_XMM %rax, \XMM1
++ pslldq $8, \XMM1
++ por \XMM1, \XMMDst
++ jmp _done_read_partial_block_\@
++_read_lt8_\@:
++ xor %eax, %eax
++_read_next_byte_lt8_\@:
++ shl $8, %rax
++ mov -1(\DPTR, \DLEN, 1), %al
++ dec \DLEN
++ jnz _read_next_byte_lt8_\@
++ MOVQ_R64_XMM %rax, \XMMDst
++_done_read_partial_block_\@:
++.endm
++
+ /*
+ * if a = number of total plaintext bytes
+ * b = floor(a/16)
+@@ -1386,14 +1417,6 @@ _esb_loop_\@:
+ *
+ * AAD Format with 64-bit Extended Sequence Number
+ *
+-* aadLen:
+-* from the definition of the spec, aadLen can only be 8 or 12 bytes.
+-* The code supports 16 too but for other sizes, the code will fail.
+-*
+-* TLen:
+-* from the definition of the spec, TLen can only be 8, 12 or 16 bytes.
+-* For other sizes, the code will fail.
+-*
+ * poly = x^128 + x^127 + x^126 + x^121 + 1
+ *
+ *****************************************************************************/
+@@ -1487,19 +1510,16 @@ _zero_cipher_left_decrypt:
+ PSHUFB_XMM %xmm10, %xmm0
+
+ ENCRYPT_SINGLE_BLOCK %xmm0, %xmm1 # E(K, Yn)
+- sub $16, %r11
+- add %r13, %r11
+- movdqu (%arg3,%r11,1), %xmm1 # receive the last <16 byte block
+- lea SHIFT_MASK+16(%rip), %r12
+- sub %r13, %r12
+-# adjust the shuffle mask pointer to be able to shift 16-%r13 bytes
+-# (%r13 is the number of bytes in plaintext mod 16)
+- movdqu (%r12), %xmm2 # get the appropriate shuffle mask
+- PSHUFB_XMM %xmm2, %xmm1 # right shift 16-%r13 butes
+
++ lea (%arg3,%r11,1), %r10
++ mov %r13, %r12
++ READ_PARTIAL_BLOCK %r10 %r12 %xmm2 %xmm1
++
++ lea ALL_F+16(%rip), %r12
++ sub %r13, %r12
+ movdqa %xmm1, %xmm2
+ pxor %xmm1, %xmm0 # Ciphertext XOR E(K, Yn)
+- movdqu ALL_F-SHIFT_MASK(%r12), %xmm1
++ movdqu (%r12), %xmm1
+ # get the appropriate mask to mask out top 16-%r13 bytes of %xmm0
+ pand %xmm1, %xmm0 # mask out top 16-%r13 bytes of %xmm0
+ pand %xmm1, %xmm2
+@@ -1508,9 +1528,6 @@ _zero_cipher_left_decrypt:
+
+ pxor %xmm2, %xmm8
+ GHASH_MUL %xmm8, %xmm13, %xmm9, %xmm10, %xmm11, %xmm5, %xmm6
+- # GHASH computation for the last <16 byte block
+- sub %r13, %r11
+- add $16, %r11
+
+ # output %r13 bytes
+ MOVQ_R64_XMM %xmm0, %rax
+@@ -1664,14 +1681,6 @@ ENDPROC(aesni_gcm_dec)
+ *
+ * AAD Format with 64-bit Extended Sequence Number
+ *
+-* aadLen:
+-* from the definition of the spec, aadLen can only be 8 or 12 bytes.
+-* The code supports 16 too but for other sizes, the code will fail.
+-*
+-* TLen:
+-* from the definition of the spec, TLen can only be 8, 12 or 16 bytes.
+-* For other sizes, the code will fail.
+-*
+ * poly = x^128 + x^127 + x^126 + x^121 + 1
+ ***************************************************************************/
+ ENTRY(aesni_gcm_enc)
+@@ -1764,19 +1773,16 @@ _zero_cipher_left_encrypt:
+ movdqa SHUF_MASK(%rip), %xmm10
+ PSHUFB_XMM %xmm10, %xmm0
+
+-
+ ENCRYPT_SINGLE_BLOCK %xmm0, %xmm1 # Encrypt(K, Yn)
+- sub $16, %r11
+- add %r13, %r11
+- movdqu (%arg3,%r11,1), %xmm1 # receive the last <16 byte blocks
+- lea SHIFT_MASK+16(%rip), %r12
++
++ lea (%arg3,%r11,1), %r10
++ mov %r13, %r12
++ READ_PARTIAL_BLOCK %r10 %r12 %xmm2 %xmm1
++
++ lea ALL_F+16(%rip), %r12
+ sub %r13, %r12
+- # adjust the shuffle mask pointer to be able to shift 16-r13 bytes
+- # (%r13 is the number of bytes in plaintext mod 16)
+- movdqu (%r12), %xmm2 # get the appropriate shuffle mask
+- PSHUFB_XMM %xmm2, %xmm1 # shift right 16-r13 byte
+ pxor %xmm1, %xmm0 # Plaintext XOR Encrypt(K, Yn)
+- movdqu ALL_F-SHIFT_MASK(%r12), %xmm1
++ movdqu (%r12), %xmm1
+ # get the appropriate mask to mask out top 16-r13 bytes of xmm0
+ pand %xmm1, %xmm0 # mask out top 16-r13 bytes of xmm0
+ movdqa SHUF_MASK(%rip), %xmm10
+@@ -1785,9 +1791,6 @@ _zero_cipher_left_encrypt:
+ pxor %xmm0, %xmm8
+ GHASH_MUL %xmm8, %xmm13, %xmm9, %xmm10, %xmm11, %xmm5, %xmm6
+ # GHASH computation for the last <16 byte block
+- sub %r13, %r11
+- add $16, %r11
+-
+ movdqa SHUF_MASK(%rip), %xmm10
+ PSHUFB_XMM %xmm10, %xmm0
+
--- /dev/null
+From 106840c41096a01079d3a2025225029c13713802 Mon Sep 17 00:00:00 2001
+From: Sabrina Dubroca <sd@queasysnail.net>
+Date: Wed, 13 Dec 2017 14:53:43 +0100
+Subject: crypto: aesni - fix typo in generic_gcmaes_decrypt
+
+From: Sabrina Dubroca <sd@queasysnail.net>
+
+commit 106840c41096a01079d3a2025225029c13713802 upstream.
+
+generic_gcmaes_decrypt needs to use generic_gcmaes_ctx, not
+aesni_rfc4106_gcm_ctx. This is actually harmless because the fields in
+struct generic_gcmaes_ctx share the layout of the same fields in
+aesni_rfc4106_gcm_ctx.
+
+Fixes: cce2ea8d90fe ("crypto: aesni - add generic gcm(aes)")
+Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
+Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/crypto/aesni-intel_glue.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/crypto/aesni-intel_glue.c
++++ b/arch/x86/crypto/aesni-intel_glue.c
+@@ -1115,7 +1115,7 @@ static int generic_gcmaes_decrypt(struct
+ {
+ __be32 counter = cpu_to_be32(1);
+ struct crypto_aead *tfm = crypto_aead_reqtfm(req);
+- struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(tfm);
++ struct generic_gcmaes_ctx *ctx = generic_gcmaes_ctx_get(tfm);
+ void *aes_ctx = &(ctx->aes_key_expanded);
+ u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN)));
+
--- /dev/null
+From 9c674e1e2f9e24fa4392167efe343749008338e0 Mon Sep 17 00:00:00 2001
+From: Stephan Mueller <smueller@chronox.de>
+Date: Thu, 18 Jan 2018 20:41:09 +0100
+Subject: crypto: aesni - handle zero length dst buffer
+
+From: Stephan Mueller <smueller@chronox.de>
+
+commit 9c674e1e2f9e24fa4392167efe343749008338e0 upstream.
+
+GCM can be invoked with a zero destination buffer. This is possible if
+the AAD and the ciphertext have zero lengths and only the tag exists in
+the source buffer (i.e. a source buffer cannot be zero). In this case,
+the GCM cipher only performs the authentication and no decryption
+operation.
+
+When the destination buffer has zero length, it is possible that no page
+is mapped to the SG pointing to the destination. In this case,
+sg_page(req->dst) is an invalid access. Therefore, page accesses should
+only be allowed if the req->dst->length is non-zero which is the
+indicator that a page must exist.
+
+This fixes a crash that can be triggered by user space via AF_ALG.
+
+Signed-off-by: Stephan Mueller <smueller@chronox.de>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/crypto/aesni-intel_glue.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/crypto/aesni-intel_glue.c
++++ b/arch/x86/crypto/aesni-intel_glue.c
+@@ -823,7 +823,7 @@ static int gcmaes_decrypt(struct aead_re
+ if (sg_is_last(req->src) &&
+ (!PageHighMem(sg_page(req->src)) ||
+ req->src->offset + req->src->length <= PAGE_SIZE) &&
+- sg_is_last(req->dst) &&
++ sg_is_last(req->dst) && req->dst->length &&
+ (!PageHighMem(sg_page(req->dst)) ||
+ req->dst->offset + req->dst->length <= PAGE_SIZE)) {
+ one_entry_in_sg = 1;
--- /dev/null
+From 46d93748e5a3628f9f553832cd64d8a59d8bafde Mon Sep 17 00:00:00 2001
+From: Corentin LABBE <clabbe.montjoie@gmail.com>
+Date: Tue, 22 Aug 2017 10:08:18 +0200
+Subject: crypto: aesni - Use GCM IV size constant
+
+From: Corentin LABBE <clabbe.montjoie@gmail.com>
+
+commit 46d93748e5a3628f9f553832cd64d8a59d8bafde upstream.
+
+This patch replace GCM IV size value by their constant name.
+
+Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/crypto/aesni-intel_glue.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/crypto/aesni-intel_glue.c
++++ b/arch/x86/crypto/aesni-intel_glue.c
+@@ -28,6 +28,7 @@
+ #include <crypto/cryptd.h>
+ #include <crypto/ctr.h>
+ #include <crypto/b128ops.h>
++#include <crypto/gcm.h>
+ #include <crypto/xts.h>
+ #include <asm/cpu_device_id.h>
+ #include <asm/fpu/api.h>
+@@ -1131,7 +1132,7 @@ static struct aead_alg aesni_aead_algs[]
+ .setauthsize = common_rfc4106_set_authsize,
+ .encrypt = helper_rfc4106_encrypt,
+ .decrypt = helper_rfc4106_decrypt,
+- .ivsize = 8,
++ .ivsize = GCM_RFC4106_IV_SIZE,
+ .maxauthsize = 16,
+ .base = {
+ .cra_name = "__gcm-aes-aesni",
+@@ -1149,7 +1150,7 @@ static struct aead_alg aesni_aead_algs[]
+ .setauthsize = rfc4106_set_authsize,
+ .encrypt = rfc4106_encrypt,
+ .decrypt = rfc4106_decrypt,
+- .ivsize = 8,
++ .ivsize = GCM_RFC4106_IV_SIZE,
+ .maxauthsize = 16,
+ .base = {
+ .cra_name = "rfc4106(gcm(aes))",
+@@ -1165,7 +1166,7 @@ static struct aead_alg aesni_aead_algs[]
+ .setauthsize = generic_gcmaes_set_authsize,
+ .encrypt = generic_gcmaes_encrypt,
+ .decrypt = generic_gcmaes_decrypt,
+- .ivsize = 12,
++ .ivsize = GCM_AES_IV_SIZE,
+ .maxauthsize = 16,
+ .base = {
+ .cra_name = "gcm(aes)",
--- /dev/null
+From bb30b8848c85e18ca7e371d0a869e94b3e383bdf Mon Sep 17 00:00:00 2001
+From: Stephan Mueller <smueller@chronox.de>
+Date: Tue, 2 Jan 2018 08:55:25 +0100
+Subject: crypto: af_alg - whitelist mask and type
+
+From: Stephan Mueller <smueller@chronox.de>
+
+commit bb30b8848c85e18ca7e371d0a869e94b3e383bdf upstream.
+
+The user space interface allows specifying the type and mask field used
+to allocate the cipher. Only a subset of the possible flags are intended
+for user space. Therefore, white-list the allowed flags.
+
+In case the user space caller uses at least one non-allowed flag, EINVAL
+is returned.
+
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: Stephan Mueller <smueller@chronox.de>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ crypto/af_alg.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/crypto/af_alg.c
++++ b/crypto/af_alg.c
+@@ -150,7 +150,7 @@ EXPORT_SYMBOL_GPL(af_alg_release_parent)
+
+ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
+ {
+- const u32 forbidden = CRYPTO_ALG_INTERNAL;
++ const u32 allowed = CRYPTO_ALG_KERN_DRIVER_ONLY;
+ struct sock *sk = sock->sk;
+ struct alg_sock *ask = alg_sk(sk);
+ struct sockaddr_alg *sa = (void *)uaddr;
+@@ -158,6 +158,10 @@ static int alg_bind(struct socket *sock,
+ void *private;
+ int err;
+
++ /* If caller uses non-allowed flag, return error. */
++ if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
++ return -EINVAL;
++
+ if (sock->state == SS_CONNECTED)
+ return -EINVAL;
+
+@@ -176,9 +180,7 @@ static int alg_bind(struct socket *sock,
+ if (IS_ERR(type))
+ return PTR_ERR(type);
+
+- private = type->bind(sa->salg_name,
+- sa->salg_feat & ~forbidden,
+- sa->salg_mask & ~forbidden);
++ private = type->bind(sa->salg_name, sa->salg_feat, sa->salg_mask);
+ if (IS_ERR(private)) {
+ module_put(type->owner);
+ return PTR_ERR(private);
--- /dev/null
+From b5b9007730ce1d90deaf25d7f678511550744bdc Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 26 Nov 2017 00:16:46 +0100
+Subject: crypto: ecdh - fix typo in KPP dependency of CRYPTO_ECDH
+
+From: Hauke Mehrtens <hauke@hauke-m.de>
+
+commit b5b9007730ce1d90deaf25d7f678511550744bdc upstream.
+
+This fixes a typo in the CRYPTO_KPP dependency of CRYPTO_ECDH.
+
+Fixes: 3c4b23901a0c ("crypto: ecdh - Add ECDH software support")
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ crypto/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/crypto/Kconfig
++++ b/crypto/Kconfig
+@@ -130,7 +130,7 @@ config CRYPTO_DH
+
+ config CRYPTO_ECDH
+ tristate "ECDH algorithm"
+- select CRYTPO_KPP
++ select CRYPTO_KPP
+ select CRYPTO_RNG_DEFAULT
+ help
+ Generic implementation of the ECDH algorithm
--- /dev/null
+From ef780324592dd639e4bfbc5b9bf8934b234b7c99 Mon Sep 17 00:00:00 2001
+From: Corentin LABBE <clabbe.montjoie@gmail.com>
+Date: Tue, 22 Aug 2017 10:08:08 +0200
+Subject: crypto: gcm - add GCM IV size constant
+
+From: Corentin LABBE <clabbe.montjoie@gmail.com>
+
+commit ef780324592dd639e4bfbc5b9bf8934b234b7c99 upstream.
+
+Many GCM users use directly GCM IV size instead of using some constant.
+
+This patch add all IV size constant used by GCM.
+
+Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/crypto/gcm.h | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- /dev/null
++++ b/include/crypto/gcm.h
+@@ -0,0 +1,8 @@
++#ifndef _CRYPTO_GCM_H
++#define _CRYPTO_GCM_H
++
++#define GCM_AES_IV_SIZE 12
++#define GCM_RFC4106_IV_SIZE 8
++#define GCM_RFC4543_IV_SIZE 8
++
++#endif
--- /dev/null
+From c957f8b3e2e54b29f53ef69decc87bbc858c9b58 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Antoine=20T=C3=A9nart?= <antoine.tenart@free-electrons.com>
+Date: Tue, 26 Dec 2017 17:21:16 +0100
+Subject: crypto: inside-secure - avoid unmapping DMA memory that was not mapped
+
+From: Antoine Tenart <antoine.tenart@free-electrons.com>
+
+commit c957f8b3e2e54b29f53ef69decc87bbc858c9b58 upstream.
+
+This patch adds a parameter in the SafeXcel ahash request structure to
+keep track of the number of SG entries mapped. This allows not to call
+dma_unmap_sg() when dma_map_sg() wasn't called in the first place. This
+also removes a warning when the debugging of the DMA-API is enabled in
+the kernel configuration: "DMA-API: device driver tries to free DMA
+memory it has not allocated".
+
+Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
+Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/crypto/inside-secure/safexcel_hash.c | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+--- a/drivers/crypto/inside-secure/safexcel_hash.c
++++ b/drivers/crypto/inside-secure/safexcel_hash.c
+@@ -33,6 +33,8 @@ struct safexcel_ahash_req {
+ bool finish;
+ bool hmac;
+
++ int nents;
++
+ u8 state_sz; /* expected sate size, only set once */
+ u32 state[SHA256_DIGEST_SIZE / sizeof(u32)];
+
+@@ -151,8 +153,10 @@ static int safexcel_handle_result(struct
+ result_sz = crypto_ahash_digestsize(ahash);
+ memcpy(sreq->state, areq->result, result_sz);
+
+- dma_unmap_sg(priv->dev, areq->src,
+- sg_nents_for_len(areq->src, areq->nbytes), DMA_TO_DEVICE);
++ if (sreq->nents) {
++ dma_unmap_sg(priv->dev, areq->src, sreq->nents, DMA_TO_DEVICE);
++ sreq->nents = 0;
++ }
+
+ safexcel_free_context(priv, async, sreq->state_sz);
+
+@@ -177,7 +181,7 @@ static int safexcel_ahash_send(struct cr
+ struct safexcel_command_desc *cdesc, *first_cdesc = NULL;
+ struct safexcel_result_desc *rdesc;
+ struct scatterlist *sg;
+- int i, nents, queued, len, cache_len, extra, n_cdesc = 0, ret = 0;
++ int i, queued, len, cache_len, extra, n_cdesc = 0, ret = 0;
+
+ queued = len = req->len - req->processed;
+ if (queued < crypto_ahash_blocksize(ahash))
+@@ -247,15 +251,15 @@ static int safexcel_ahash_send(struct cr
+ }
+
+ /* Now handle the current ahash request buffer(s) */
+- nents = dma_map_sg(priv->dev, areq->src,
+- sg_nents_for_len(areq->src, areq->nbytes),
+- DMA_TO_DEVICE);
+- if (!nents) {
++ req->nents = dma_map_sg(priv->dev, areq->src,
++ sg_nents_for_len(areq->src, areq->nbytes),
++ DMA_TO_DEVICE);
++ if (!req->nents) {
+ ret = -ENOMEM;
+ goto cdesc_rollback;
+ }
+
+- for_each_sg(areq->src, sg, nents, i) {
++ for_each_sg(areq->src, sg, req->nents, i) {
+ int sglen = sg_dma_len(sg);
+
+ /* Do not overflow the request */
--- /dev/null
+From 809778e02cd45d0625439fee67688f655627bb3c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Antoine=20T=C3=A9nart?= <antoine.tenart@free-electrons.com>
+Date: Tue, 26 Dec 2017 17:21:17 +0100
+Subject: crypto: inside-secure - fix hash when length is a multiple of a block
+
+From: Antoine Tenart <antoine.tenart@free-electrons.com>
+
+commit 809778e02cd45d0625439fee67688f655627bb3c upstream.
+
+This patch fixes the hash support in the SafeXcel driver when the update
+size is a multiple of a block size, and when a final call is made just
+after with a size of 0. In such cases the driver should cache the last
+block from the update to avoid handling 0 length data on the final call
+(that's a hardware limitation).
+
+Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
+Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/crypto/inside-secure/safexcel_hash.c | 34 +++++++++++++++++++--------
+ 1 file changed, 24 insertions(+), 10 deletions(-)
+
+--- a/drivers/crypto/inside-secure/safexcel_hash.c
++++ b/drivers/crypto/inside-secure/safexcel_hash.c
+@@ -185,17 +185,31 @@ static int safexcel_ahash_send(struct cr
+ else
+ cache_len = queued - areq->nbytes;
+
+- /*
+- * If this is not the last request and the queued data does not fit
+- * into full blocks, cache it for the next send() call.
+- */
+- extra = queued & (crypto_ahash_blocksize(ahash) - 1);
+- if (!req->last_req && extra) {
+- sg_pcopy_to_buffer(areq->src, sg_nents(areq->src),
+- req->cache_next, extra, areq->nbytes - extra);
++ if (!req->last_req) {
++ /* If this is not the last request and the queued data does not
++ * fit into full blocks, cache it for the next send() call.
++ */
++ extra = queued & (crypto_ahash_blocksize(ahash) - 1);
++ if (!extra)
++ /* If this is not the last request and the queued data
++ * is a multiple of a block, cache the last one for now.
++ */
++ extra = queued - crypto_ahash_blocksize(ahash);
+
+- queued -= extra;
+- len -= extra;
++ if (extra) {
++ sg_pcopy_to_buffer(areq->src, sg_nents(areq->src),
++ req->cache_next, extra,
++ areq->nbytes - extra);
++
++ queued -= extra;
++ len -= extra;
++
++ if (!queued) {
++ *commands = 0;
++ *results = 0;
++ return 0;
++ }
++ }
+ }
+
+ spin_lock_bh(&priv->ring[ring].egress_lock);
--- /dev/null
+From c013cee99d5a18aec8c71fee8f5f41369cd12595 Mon Sep 17 00:00:00 2001
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Date: Fri, 19 Jan 2018 12:04:33 +0000
+Subject: crypto: sha3-generic - fixes for alignment and big endian operation
+
+From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+
+commit c013cee99d5a18aec8c71fee8f5f41369cd12595 upstream.
+
+Ensure that the input is byte swabbed before injecting it into the
+SHA3 transform. Use the get_unaligned() accessor for this so that
+we don't perform unaligned access inadvertently on architectures
+that do not support that.
+
+Fixes: 53964b9ee63b7075 ("crypto: sha3 - Add SHA-3 hash algorithm")
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ crypto/sha3_generic.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/crypto/sha3_generic.c
++++ b/crypto/sha3_generic.c
+@@ -18,6 +18,7 @@
+ #include <linux/types.h>
+ #include <crypto/sha3.h>
+ #include <asm/byteorder.h>
++#include <asm/unaligned.h>
+
+ #define KECCAK_ROUNDS 24
+
+@@ -149,7 +150,7 @@ static int sha3_update(struct shash_desc
+ unsigned int i;
+
+ for (i = 0; i < sctx->rsizw; i++)
+- sctx->st[i] ^= ((u64 *) src)[i];
++ sctx->st[i] ^= get_unaligned_le64(src + 8 * i);
+ keccakf(sctx->st);
+
+ done += sctx->rsiz;
+@@ -174,7 +175,7 @@ static int sha3_final(struct shash_desc
+ sctx->buf[sctx->rsiz - 1] |= 0x80;
+
+ for (i = 0; i < sctx->rsizw; i++)
+- sctx->st[i] ^= ((u64 *) sctx->buf)[i];
++ sctx->st[i] ^= get_unaligned_le64(sctx->buf + 8 * i);
+
+ keccakf(sctx->st);
+
--- /dev/null
+From 539340f37e6d6ed4cd93e8e18c9b2e4eafd4b842 Mon Sep 17 00:00:00 2001
+From: Jesse Chan <jc@linux.com>
+Date: Mon, 20 Nov 2017 12:54:26 -0800
+Subject: gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE
+
+From: Jesse Chan <jc@linux.com>
+
+commit 539340f37e6d6ed4cd93e8e18c9b2e4eafd4b842 upstream.
+
+This change resolves a new compile-time warning
+when built as a loadable module:
+
+WARNING: modpost: missing MODULE_LICENSE() in drivers/gpio/gpio-ath79.o
+see include/linux/module.h for more information
+
+This adds the license as "GPL v2", which matches the header of the file.
+
+MODULE_DESCRIPTION is also added.
+
+Signed-off-by: Jesse Chan <jc@linux.com>
+Acked-by: Alban Bedel <albeu@free.fr>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-ath79.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/gpio/gpio-ath79.c
++++ b/drivers/gpio/gpio-ath79.c
+@@ -323,3 +323,6 @@ static struct platform_driver ath79_gpio
+ };
+
+ module_platform_driver(ath79_gpio_driver);
++
++MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support");
++MODULE_LICENSE("GPL v2");
--- /dev/null
+From 24bd3efc9d1efb5f756a7c6f807a36ddb6adc671 Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linus.walleij@linaro.org>
+Date: Mon, 22 Jan 2018 13:19:28 +0100
+Subject: gpio: Fix kernel stack leak to userspace
+
+From: Linus Walleij <linus.walleij@linaro.org>
+
+commit 24bd3efc9d1efb5f756a7c6f807a36ddb6adc671 upstream.
+
+The GPIO event descriptor was leaking kernel stack to
+userspace because we don't zero the variable before
+use. Ooops. Fix this.
+
+Reported-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
+Reviewed-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpiolib.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/gpio/gpiolib.c
++++ b/drivers/gpio/gpiolib.c
+@@ -723,6 +723,9 @@ static irqreturn_t lineevent_irq_thread(
+ struct gpioevent_data ge;
+ int ret, level;
+
++ /* Do not leak kernel stack to userspace */
++ memset(&ge, 0, sizeof(ge));
++
+ ge.timestamp = ktime_get_real_ns();
+ level = gpiod_get_value_cansleep(le->desc);
+
--- /dev/null
+From 97b03136e1b637d7a9d2274c099e44ecf23f1103 Mon Sep 17 00:00:00 2001
+From: Jesse Chan <jc@linux.com>
+Date: Mon, 20 Nov 2017 12:54:52 -0800
+Subject: gpio: iop: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
+
+From: Jesse Chan <jc@linux.com>
+
+commit 97b03136e1b637d7a9d2274c099e44ecf23f1103 upstream.
+
+This change resolves a new compile-time warning
+when built as a loadable module:
+
+WARNING: modpost: missing MODULE_LICENSE() in drivers/gpio/gpio-iop.o
+see include/linux/module.h for more information
+
+This adds the license as "GPL", which matches the header of the file.
+
+MODULE_DESCRIPTION and MODULE_AUTHOR are also added.
+
+Signed-off-by: Jesse Chan <jc@linux.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-iop.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/gpio/gpio-iop.c
++++ b/drivers/gpio/gpio-iop.c
+@@ -58,3 +58,7 @@ static int __init iop3xx_gpio_init(void)
+ return platform_driver_register(&iop3xx_gpio_driver);
+ }
+ arch_initcall(iop3xx_gpio_init);
++
++MODULE_DESCRIPTION("GPIO handling for Intel IOP3xx processors");
++MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>");
++MODULE_LICENSE("GPL");
--- /dev/null
+From b888fb6f2a278442933e3bfab70262e9a5365fb3 Mon Sep 17 00:00:00 2001
+From: Patrice Chotard <patrice.chotard@st.com>
+Date: Fri, 12 Jan 2018 13:16:08 +0100
+Subject: gpio: stmpe: i2c transfer are forbiden in atomic context
+
+From: Patrice Chotard <patrice.chotard@st.com>
+
+commit b888fb6f2a278442933e3bfab70262e9a5365fb3 upstream.
+
+Move the workaround from stmpe_gpio_irq_unmask() which is executed
+in atomic context to stmpe_gpio_irq_sync_unlock() which is not.
+
+It fixes the following issue:
+
+[ 1.500000] BUG: scheduling while atomic: swapper/1/0x00000002
+[ 1.500000] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc2-00020-gbd4301f-dirty #28
+[ 1.520000] Hardware name: STM32 (Device Tree Support)
+[ 1.520000] [<0000bfc9>] (unwind_backtrace) from [<0000b347>] (show_stack+0xb/0xc)
+[ 1.530000] [<0000b347>] (show_stack) from [<0001fc49>] (__schedule_bug+0x39/0x58)
+[ 1.530000] [<0001fc49>] (__schedule_bug) from [<00168211>] (__schedule+0x23/0x2b2)
+[ 1.550000] [<00168211>] (__schedule) from [<001684f7>] (schedule+0x57/0x64)
+[ 1.550000] [<001684f7>] (schedule) from [<0016a513>] (schedule_timeout+0x137/0x164)
+[ 1.550000] [<0016a513>] (schedule_timeout) from [<00168b91>] (wait_for_common+0x8d/0xfc)
+[ 1.570000] [<00168b91>] (wait_for_common) from [<00139753>] (stm32f4_i2c_xfer+0xe9/0xfe)
+[ 1.580000] [<00139753>] (stm32f4_i2c_xfer) from [<00138545>] (__i2c_transfer+0x111/0x148)
+[ 1.590000] [<00138545>] (__i2c_transfer) from [<001385cf>] (i2c_transfer+0x53/0x70)
+[ 1.590000] [<001385cf>] (i2c_transfer) from [<001388a5>] (i2c_smbus_xfer+0x12f/0x36e)
+[ 1.600000] [<001388a5>] (i2c_smbus_xfer) from [<00138b49>] (i2c_smbus_read_byte_data+0x1f/0x2a)
+[ 1.610000] [<00138b49>] (i2c_smbus_read_byte_data) from [<00124fdd>] (__stmpe_reg_read+0xd/0x24)
+[ 1.620000] [<00124fdd>] (__stmpe_reg_read) from [<001252b3>] (stmpe_reg_read+0x19/0x24)
+[ 1.630000] [<001252b3>] (stmpe_reg_read) from [<0002c4d1>] (unmask_irq+0x17/0x22)
+[ 1.640000] [<0002c4d1>] (unmask_irq) from [<0002c57f>] (irq_startup+0x6f/0x78)
+[ 1.650000] [<0002c57f>] (irq_startup) from [<0002b7a1>] (__setup_irq+0x319/0x47c)
+[ 1.650000] [<0002b7a1>] (__setup_irq) from [<0002bad3>] (request_threaded_irq+0x6b/0xe8)
+[ 1.660000] [<0002bad3>] (request_threaded_irq) from [<0002d0b9>] (devm_request_threaded_irq+0x3b/0x6a)
+[ 1.670000] [<0002d0b9>] (devm_request_threaded_irq) from [<001446e7>] (mmc_gpiod_request_cd_irq+0x49/0x8a)
+[ 1.680000] [<001446e7>] (mmc_gpiod_request_cd_irq) from [<0013d45d>] (mmc_start_host+0x49/0x60)
+[ 1.690000] [<0013d45d>] (mmc_start_host) from [<0013e40b>] (mmc_add_host+0x3b/0x54)
+[ 1.700000] [<0013e40b>] (mmc_add_host) from [<00148119>] (mmci_probe+0x4d1/0x60c)
+[ 1.710000] [<00148119>] (mmci_probe) from [<000f903b>] (amba_probe+0x7b/0xbe)
+[ 1.720000] [<000f903b>] (amba_probe) from [<001170e5>] (driver_probe_device+0x169/0x1f8)
+[ 1.730000] [<001170e5>] (driver_probe_device) from [<001171b7>] (__driver_attach+0x43/0x5c)
+[ 1.740000] [<001171b7>] (__driver_attach) from [<0011618d>] (bus_for_each_dev+0x3d/0x46)
+[ 1.740000] [<0011618d>] (bus_for_each_dev) from [<001165cd>] (bus_add_driver+0xcd/0x124)
+[ 1.740000] [<001165cd>] (bus_add_driver) from [<00117713>] (driver_register+0x4d/0x7a)
+[ 1.760000] [<00117713>] (driver_register) from [<001fc765>] (do_one_initcall+0xbd/0xe8)
+[ 1.770000] [<001fc765>] (do_one_initcall) from [<001fc88b>] (kernel_init_freeable+0xfb/0x134)
+[ 1.780000] [<001fc88b>] (kernel_init_freeable) from [<00167ee3>] (kernel_init+0x7/0x9c)
+[ 1.790000] [<00167ee3>] (kernel_init) from [<00009b65>] (ret_from_fork+0x11/0x2c)
+
+Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
+Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-stmpe.c | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+--- a/drivers/gpio/gpio-stmpe.c
++++ b/drivers/gpio/gpio-stmpe.c
+@@ -190,6 +190,16 @@ static void stmpe_gpio_irq_sync_unlock(s
+ };
+ int i, j;
+
++ /*
++ * STMPE1600: to be able to get IRQ from pins,
++ * a read must be done on GPMR register, or a write in
++ * GPSR or GPCR registers
++ */
++ if (stmpe->partnum == STMPE1600) {
++ stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB]);
++ stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB]);
++ }
++
+ for (i = 0; i < CACHE_NR_REGS; i++) {
+ /* STMPE801 and STMPE1600 don't have RE and FE registers */
+ if ((stmpe->partnum == STMPE801 ||
+@@ -227,21 +237,11 @@ static void stmpe_gpio_irq_unmask(struct
+ {
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(gc);
+- struct stmpe *stmpe = stmpe_gpio->stmpe;
+ int offset = d->hwirq;
+ int regoffset = offset / 8;
+ int mask = BIT(offset % 8);
+
+ stmpe_gpio->regs[REG_IE][regoffset] |= mask;
+-
+- /*
+- * STMPE1600 workaround: to be able to get IRQ from pins,
+- * a read must be done on GPMR register, or a write in
+- * GPSR or GPCR registers
+- */
+- if (stmpe->partnum == STMPE1600)
+- stmpe_reg_read(stmpe,
+- stmpe->regs[STMPE_IDX_GPMR_LSB + regoffset]);
+ }
+
+ static void stmpe_dbg_show_one(struct seq_file *s,
--- /dev/null
+From 791ae273731fa85d3332e45064dab177ae663e80 Mon Sep 17 00:00:00 2001
+From: Aaron Armstrong Skomra <skomra@gmail.com>
+Date: Thu, 7 Dec 2017 12:31:56 -0800
+Subject: HID: wacom: EKR: ensure devres groups at higher indexes are released
+
+From: Aaron Armstrong Skomra <skomra@gmail.com>
+
+commit 791ae273731fa85d3332e45064dab177ae663e80 upstream.
+
+Background: ExpressKey Remotes communicate their events via usb dongle.
+Each dongle can hold up to 5 pairings at one time and one EKR (identified
+by its serial number) can unfortunately be paired with its dongle
+more than once. The pairing takes place in a round-robin fashion.
+
+Input devices are only created once per EKR, when a new serial number
+is seen in the list of pairings. However, if a device is created for
+a "higher" paring index and subsequently a second pairing occurs at a
+lower pairing index, unpairing the remote with that serial number from
+any pairing index will currently cause a driver crash. This occurs
+infrequently, as two remotes are necessary to trigger this bug and most
+users have only one remote.
+
+As an illustration, to trigger the bug you need to have two remotes,
+and pair them in this order:
+
+1. slot 0 -> remote 1 (input device created for remote 1)
+2. slot 1 -> remote 1 (duplicate pairing - no device created)
+3. slot 2 -> remote 1 (duplicate pairing - no device created)
+4. slot 3 -> remote 1 (duplicate pairing - no device created)
+5. slot 4 -> remote 2 (input device created for remote 2)
+
+6. slot 0 -> remote 2 (1 destroyed and recreated at slot 1)
+7. slot 1 -> remote 2 (1 destroyed and recreated at slot 2)
+8. slot 2 -> remote 2 (1 destroyed and recreated at slot 3)
+9. slot 3 -> remote 2 (1 destroyed and not recreated)
+10. slot 4 -> remote 2 (2 was already in this slot so no changes)
+
+11. slot 0 -> remote 1 (The current code sees remote 2 was paired over in
+ one of the dongle slots it occupied and attempts
+ to remove all information about remote 2 [1]. It
+ calls wacom_remote_destroy_one for remote 2, but
+ the destroy function assumes the lowest index is
+ where the remote's input device was created. The
+ code "cleans up" the other remote 2 pairings
+ including the one which the input device was based
+ on, assuming they were were just duplicate
+ pairings. However, the cleanup doesn't call the
+ devres release function for the input device that
+ was created in slot 4).
+
+This issue is fixed by this commit.
+
+[1] Remote 2 should subsequently be re-created on the next packet from the
+EKR at the lowest numbered slot that it occupies (here slot 1).
+
+Fixes: f9036bd43602 ("HID: wacom: EKR: use devres groups to manage resources")
+Signed-off-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/wacom_sys.c | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+--- a/drivers/hid/wacom_sys.c
++++ b/drivers/hid/wacom_sys.c
+@@ -2340,23 +2340,23 @@ static void wacom_remote_destroy_one(str
+ int i;
+ unsigned long flags;
+
+- spin_lock_irqsave(&remote->remote_lock, flags);
+- remote->remotes[index].registered = false;
+- spin_unlock_irqrestore(&remote->remote_lock, flags);
++ for (i = 0; i < WACOM_MAX_REMOTES; i++) {
++ if (remote->remotes[i].serial == serial) {
+
+- if (remote->remotes[index].battery.battery)
+- devres_release_group(&wacom->hdev->dev,
+- &remote->remotes[index].battery.bat_desc);
++ spin_lock_irqsave(&remote->remote_lock, flags);
++ remote->remotes[i].registered = false;
++ spin_unlock_irqrestore(&remote->remote_lock, flags);
+
+- if (remote->remotes[index].group.name)
+- devres_release_group(&wacom->hdev->dev,
+- &remote->remotes[index]);
++ if (remote->remotes[i].battery.battery)
++ devres_release_group(&wacom->hdev->dev,
++ &remote->remotes[i].battery.bat_desc);
++
++ if (remote->remotes[i].group.name)
++ devres_release_group(&wacom->hdev->dev,
++ &remote->remotes[i]);
+
+- for (i = 0; i < WACOM_MAX_REMOTES; i++) {
+- if (remote->remotes[i].serial == serial) {
+ remote->remotes[i].serial = 0;
+ remote->remotes[i].group.name = NULL;
+- remote->remotes[i].registered = false;
+ remote->remotes[i].battery.battery = NULL;
+ wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN;
+ }
--- /dev/null
+From 403c0f681c1964ff1db8c2fb8de8c4067779d081 Mon Sep 17 00:00:00 2001
+From: Jason Gerecke <killertofu@gmail.com>
+Date: Tue, 26 Dec 2017 14:53:55 -0800
+Subject: HID: wacom: Fix reporting of touch toggle (WACOM_HID_WD_MUTE_DEVICE) events
+
+From: Jason Gerecke <killertofu@gmail.com>
+
+commit 403c0f681c1964ff1db8c2fb8de8c4067779d081 upstream.
+
+Touch toggle softkeys send a '1' while pressed and a '0' while released,
+requring the kernel to keep track of wether touch should be enabled or
+disabled. The code does not handle the state transitions properly,
+however. If the key is pressed repeatedly, the following four states
+of states are cycled through (assuming touch starts out enabled):
+
+Press: shared->is_touch_on => 0, SW_MUTE_DEVICE => 1
+Release: shared->is_touch_on => 0, SW_MUTE_DEVICE => 1
+Press: shared->is_touch_on => 1, SW_MUTE_DEVICE => 0
+Release: shared->is_touch_on => 1, SW_MUTE_DEVICE => 1
+
+The hardware always properly enables/disables touch when the key is
+pressed but applications that listen for SW_MUTE_DEVICE events to provide
+feedback about the state will only ever show touch as being enabled while
+the key is held, and only every-other time. This sequence occurs because
+the fallthrough WACOM_HID_WD_TOUCHONOFF case is always handled, and it
+uses the value of the *local* is_touch_on variable as the value to
+report to userspace. The local value is equal to the shared value when
+the button is pressed, but equal to zero when the button is released.
+
+Reporting the shared value to userspace fixes this problem, but the
+fallthrough case needs to update the shared value in an incompatible
+way (which is why the local variable was introduced in the first place).
+To work around this, we just handle both cases in a single block of code
+and update the shared variable as appropriate.
+
+Fixes: d793ff8187 ("HID: wacom: generic: support touch on/off softkey")
+Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
+Reviewed-by: Aaron Skomra <aaron.skomra@wacom.com>
+Tested-by: Aaron Skomra <aaron.skomra@wacom.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/wacom_wac.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/drivers/hid/wacom_wac.c
++++ b/drivers/hid/wacom_wac.c
+@@ -1924,7 +1924,6 @@ static void wacom_wac_pad_event(struct h
+ struct wacom_features *features = &wacom_wac->features;
+ unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
+ int i;
+- bool is_touch_on = value;
+ bool do_report = false;
+
+ /*
+@@ -1969,16 +1968,17 @@ static void wacom_wac_pad_event(struct h
+ break;
+
+ case WACOM_HID_WD_MUTE_DEVICE:
+- if (wacom_wac->shared->touch_input && value) {
+- wacom_wac->shared->is_touch_on = !wacom_wac->shared->is_touch_on;
+- is_touch_on = wacom_wac->shared->is_touch_on;
+- }
+-
+- /* fall through*/
+ case WACOM_HID_WD_TOUCHONOFF:
+ if (wacom_wac->shared->touch_input) {
++ bool *is_touch_on = &wacom_wac->shared->is_touch_on;
++
++ if (equivalent_usage == WACOM_HID_WD_MUTE_DEVICE && value)
++ *is_touch_on = !(*is_touch_on);
++ else if (equivalent_usage == WACOM_HID_WD_TOUCHONOFF)
++ *is_touch_on = value;
++
+ input_report_switch(wacom_wac->shared->touch_input,
+- SW_MUTE_DEVICE, !is_touch_on);
++ SW_MUTE_DEVICE, !(*is_touch_on));
+ input_sync(wacom_wac->shared->touch_input);
+ }
+ break;
--- /dev/null
+From 888f22931478a05bc81ceb7295c626e1292bf0ed Mon Sep 17 00:00:00 2001
+From: Lyude Paul <lyude@redhat.com>
+Date: Tue, 12 Dec 2017 14:31:30 -0500
+Subject: igb: Free IRQs when device is hotplugged
+
+From: Lyude Paul <lyude@redhat.com>
+
+commit 888f22931478a05bc81ceb7295c626e1292bf0ed upstream.
+
+Recently I got a Caldigit TS3 Thunderbolt 3 dock, and noticed that upon
+hotplugging my kernel would immediately crash due to igb:
+
+[ 680.825801] kernel BUG at drivers/pci/msi.c:352!
+[ 680.828388] invalid opcode: 0000 [#1] SMP
+[ 680.829194] Modules linked in: igb(O) thunderbolt i2c_algo_bit joydev vfat fat btusb btrtl btbcm btintel bluetooth ecdh_generic hp_wmi sparse_keymap rfkill wmi_bmof iTCO_wdt intel_rapl x86_pkg_temp_thermal coretemp crc32_pclmul snd_pcm rtsx_pci_ms mei_me snd_timer memstick snd pcspkr mei soundcore i2c_i801 tpm_tis psmouse shpchp wmi tpm_tis_core tpm video hp_wireless acpi_pad rtsx_pci_sdmmc mmc_core crc32c_intel serio_raw rtsx_pci mfd_core xhci_pci xhci_hcd i2c_hid i2c_core [last unloaded: igb]
+[ 680.831085] CPU: 1 PID: 78 Comm: kworker/u16:1 Tainted: G O 4.15.0-rc3Lyude-Test+ #6
+[ 680.831596] Hardware name: HP HP ZBook Studio G4/826B, BIOS P71 Ver. 01.03 06/09/2017
+[ 680.832168] Workqueue: kacpi_hotplug acpi_hotplug_work_fn
+[ 680.832687] RIP: 0010:free_msi_irqs+0x180/0x1b0
+[ 680.833271] RSP: 0018:ffffc9000030fbf0 EFLAGS: 00010286
+[ 680.833761] RAX: ffff8803405f9c00 RBX: ffff88033e3d2e40 RCX: 000000000000002c
+[ 680.834278] RDX: 0000000000000000 RSI: 00000000000000ac RDI: ffff880340be2178
+[ 680.834832] RBP: 0000000000000000 R08: ffff880340be1ff0 R09: ffff8803405f9c00
+[ 680.835342] R10: 0000000000000000 R11: 0000000000000040 R12: ffff88033d63a298
+[ 680.835822] R13: ffff88033d63a000 R14: 0000000000000060 R15: ffff880341959000
+[ 680.836332] FS: 0000000000000000(0000) GS:ffff88034f440000(0000) knlGS:0000000000000000
+[ 680.836817] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[ 680.837360] CR2: 000055e64044afdf CR3: 0000000001c09002 CR4: 00000000003606e0
+[ 680.837954] Call Trace:
+[ 680.838853] pci_disable_msix+0xce/0xf0
+[ 680.839616] igb_reset_interrupt_capability+0x5d/0x60 [igb]
+[ 680.840278] igb_remove+0x9d/0x110 [igb]
+[ 680.840764] pci_device_remove+0x36/0xb0
+[ 680.841279] device_release_driver_internal+0x157/0x220
+[ 680.841739] pci_stop_bus_device+0x7d/0xa0
+[ 680.842255] pci_stop_bus_device+0x2b/0xa0
+[ 680.842722] pci_stop_bus_device+0x3d/0xa0
+[ 680.843189] pci_stop_and_remove_bus_device+0xe/0x20
+[ 680.843627] trim_stale_devices+0xf3/0x140
+[ 680.844086] trim_stale_devices+0x94/0x140
+[ 680.844532] trim_stale_devices+0xa6/0x140
+[ 680.845031] ? get_slot_status+0x90/0xc0
+[ 680.845536] acpiphp_check_bridge.part.5+0xfe/0x140
+[ 680.846021] acpiphp_hotplug_notify+0x175/0x200
+[ 680.846581] ? free_bridge+0x100/0x100
+[ 680.847113] acpi_device_hotplug+0x8a/0x490
+[ 680.847535] acpi_hotplug_work_fn+0x1a/0x30
+[ 680.848076] process_one_work+0x182/0x3a0
+[ 680.848543] worker_thread+0x2e/0x380
+[ 680.848963] ? process_one_work+0x3a0/0x3a0
+[ 680.849373] kthread+0x111/0x130
+[ 680.849776] ? kthread_create_worker_on_cpu+0x50/0x50
+[ 680.850188] ret_from_fork+0x1f/0x30
+[ 680.850601] Code: 43 14 85 c0 0f 84 d5 fe ff ff 31 ed eb 0f 83 c5 01 39 6b 14 0f 86 c5 fe ff ff 8b 7b 10 01 ef e8 b7 e4 d2 ff 48 83 78 70 00 74 e3 <0f> 0b 49 8d b5 a0 00 00 00 e8 62 6f d3 ff e9 c7 fe ff ff 48 8b
+[ 680.851497] RIP: free_msi_irqs+0x180/0x1b0 RSP: ffffc9000030fbf0
+
+As it turns out, normally the freeing of IRQs that would fix this is called
+inside of the scope of __igb_close(). However, since the device is
+already gone by the point we try to unregister the netdevice from the
+driver due to a hotplug we end up seeing that the netif isn't present
+and thus, forget to free any of the device IRQs.
+
+So: make sure that if we're in the process of dismantling the netdev, we
+always allow __igb_close() to be called so that IRQs may be freed
+normally. Additionally, only allow igb_close() to be called from
+__igb_close() if it hasn't already been called for the given adapter.
+
+Signed-off-by: Lyude Paul <lyude@redhat.com>
+Fixes: 9474933caf21 ("igb: close/suspend race in netif_device_detach")
+Cc: Todd Fujinaka <todd.fujinaka@intel.com>
+Cc: Stephen Hemminger <stephen@networkplumber.org>
+Tested-by: Aaron Brown <aaron.f.brown@intel.com>
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -3331,7 +3331,7 @@ static int __igb_close(struct net_device
+
+ int igb_close(struct net_device *netdev)
+ {
+- if (netif_device_present(netdev))
++ if (netif_device_present(netdev) || netdev->dismantle)
+ return __igb_close(netdev, false);
+ return 0;
+ }
--- /dev/null
+From 36447456e1cca853188505f2a964dbbeacfc7a7a Mon Sep 17 00:00:00 2001
+From: Mike Rapoport <rppt@linux.vnet.ibm.com>
+Date: Wed, 17 Jan 2018 20:27:11 +0200
+Subject: ima/policy: fix parsing of fsuuid
+
+From: Mike Rapoport <rppt@linux.vnet.ibm.com>
+
+commit 36447456e1cca853188505f2a964dbbeacfc7a7a upstream.
+
+The switch to uuid_t invereted the logic of verfication that &entry->fsuuid
+is zero during parsing of "fsuuid=" rule. Instead of making sure the
+&entry->fsuuid field is not attempted to be overwritten, we bail out for
+perfectly correct rule.
+
+Fixes: 787d8c530af7 ("ima/policy: switch to use uuid_t")
+Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
+Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ security/integrity/ima/ima_policy.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/security/integrity/ima/ima_policy.c
++++ b/security/integrity/ima/ima_policy.c
+@@ -743,7 +743,7 @@ static int ima_parse_rule(char *rule, st
+ case Opt_fsuuid:
+ ima_log_string(ab, "fsuuid", args[0].from);
+
+- if (uuid_is_null(&entry->fsuuid)) {
++ if (!uuid_is_null(&entry->fsuuid)) {
+ result = -EINVAL;
+ break;
+ }
--- /dev/null
+From d822401d1c6898a4a4ee03977b78b8cec402e88a Mon Sep 17 00:00:00 2001
+From: Jesse Chan <jc@linux.com>
+Date: Mon, 20 Nov 2017 12:57:13 -0800
+Subject: mtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
+
+From: Jesse Chan <jc@linux.com>
+
+commit d822401d1c6898a4a4ee03977b78b8cec402e88a upstream.
+
+This change resolves a new compile-time warning
+when built as a loadable module:
+
+WARNING: modpost: missing MODULE_LICENSE() in drivers/mtd/nand/denali_pci.o
+see include/linux/module.h for more information
+
+This adds the license as "GPL v2", which matches the header of the file.
+
+MODULE_DESCRIPTION and MODULE_AUTHOR are also added.
+
+Signed-off-by: Jesse Chan <jc@linux.com>
+Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/nand/denali_pci.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/mtd/nand/denali_pci.c
++++ b/drivers/mtd/nand/denali_pci.c
+@@ -124,3 +124,7 @@ static struct pci_driver denali_pci_driv
+ };
+
+ module_pci_driver(denali_pci_driver);
++
++MODULE_DESCRIPTION("PCI driver for Denali NAND controller");
++MODULE_AUTHOR("Intel Corporation and its suppliers");
++MODULE_LICENSE("GPL v2");
--- /dev/null
+From 348c7cf5fcbcb68838255759d4cb45d039af36d2 Mon Sep 17 00:00:00 2001
+From: Jesse Chan <jc@linux.com>
+Date: Mon, 20 Nov 2017 12:58:27 -0800
+Subject: power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
+
+From: Jesse Chan <jc@linux.com>
+
+commit 348c7cf5fcbcb68838255759d4cb45d039af36d2 upstream.
+
+This change resolves a new compile-time warning
+when built as a loadable module:
+
+WARNING: modpost: missing MODULE_LICENSE() in drivers/power/reset/zx-reboot.o
+see include/linux/module.h for more information
+
+This adds the license as "GPL v2", which matches the header of the file.
+
+MODULE_DESCRIPTION and MODULE_AUTHOR are also added.
+
+Signed-off-by: Jesse Chan <jc@linux.com>
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/power/reset/zx-reboot.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/power/reset/zx-reboot.c
++++ b/drivers/power/reset/zx-reboot.c
+@@ -82,3 +82,7 @@ static struct platform_driver zx_reboot_
+ },
+ };
+ module_platform_driver(zx_reboot_driver);
++
++MODULE_DESCRIPTION("ZTE SoCs reset driver");
++MODULE_AUTHOR("Jun Nie <jun.nie@linaro.org>");
++MODULE_LICENSE("GPL v2");
--- /dev/null
+From c5313ae8e4e037bfaf5e56cb8d6efdb8e92ce437 Mon Sep 17 00:00:00 2001
+From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Date: Tue, 26 Dec 2017 20:34:24 -0800
+Subject: scsi: aacraid: Fix hang in kdump
+
+From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+
+commit c5313ae8e4e037bfaf5e56cb8d6efdb8e92ce437 upstream.
+
+Driver attempts to perform a device scan and device add after coming out
+of reset. At times when the kdump kernel loads and it tries to perform
+eh recovery, the device scan hangs since its commands are blocked because
+of the eh recovery. This should have shown up in normal eh recovery path
+(Should have been obvious)
+
+Remove the code that performs scanning.I can live without the rescanning
+support in the stable kernels but a hanging kdump/eh recovery needs to be
+fixed.
+
+Fixes: a2d0321dd532901e (scsi: aacraid: Reload offlined drives after controller reset)
+Reported-by: Douglas Miller <dougmill@linux.vnet.ibm.com>
+Tested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
+Fixes: a2d0321dd532901e (scsi: aacraid: Reload offlined drives after controller reset)
+Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/aacraid/aachba.c | 1 -
+ drivers/scsi/aacraid/commsup.c | 9 +--------
+ 2 files changed, 1 insertion(+), 9 deletions(-)
+
+--- a/drivers/scsi/aacraid/aachba.c
++++ b/drivers/scsi/aacraid/aachba.c
+@@ -918,7 +918,6 @@ static void setinqstr(struct aac_dev *de
+ char *cname = kmemdup(sup_adap_info->adapter_type_text,
+ sizeof(sup_adap_info->adapter_type_text),
+ GFP_ATOMIC);
+-
+ if (!cname)
+ return;
+
+--- a/drivers/scsi/aacraid/commsup.c
++++ b/drivers/scsi/aacraid/commsup.c
+@@ -1672,14 +1672,7 @@ static int _aac_reset_adapter(struct aac
+ out:
+ aac->in_reset = 0;
+ scsi_unblock_requests(host);
+- /*
+- * Issue bus rescan to catch any configuration that might have
+- * occurred
+- */
+- if (!retval) {
+- dev_info(&aac->pdev->dev, "Issuing bus rescan\n");
+- scsi_scan_host(host);
+- }
++
+ if (jafo) {
+ spin_lock_irq(host->host_lock);
+ }
--- /dev/null
+From f4e8708d3104437fd7716e957f38c265b0c509ef Mon Sep 17 00:00:00 2001
+From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Date: Tue, 26 Dec 2017 20:34:22 -0800
+Subject: scsi: aacraid: Fix udev inquiry race condition
+
+From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+
+commit f4e8708d3104437fd7716e957f38c265b0c509ef upstream.
+
+When udev requests for a devices inquiry string, it might create multiple
+threads causing a race condition on the shared inquiry resource string.
+
+Created a buffer with the string for each thread.
+
+Fixes: 3bc8070fb75b3315 ([SCSI] aacraid: SMC vendor identification)
+Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/aacraid/aachba.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+--- a/drivers/scsi/aacraid/aachba.c
++++ b/drivers/scsi/aacraid/aachba.c
+@@ -913,8 +913,16 @@ static void setinqstr(struct aac_dev *de
+ memset(str, ' ', sizeof(*str));
+
+ if (sup_adap_info->adapter_type_text[0]) {
+- char *cp = sup_adap_info->adapter_type_text;
+ int c;
++ char *cp;
++ char *cname = kmemdup(sup_adap_info->adapter_type_text,
++ sizeof(sup_adap_info->adapter_type_text),
++ GFP_ATOMIC);
++
++ if (!cname)
++ return;
++
++ cp = cname;
+ if ((cp[0] == 'A') && (cp[1] == 'O') && (cp[2] == 'C'))
+ inqstrcpy("SMC", str->vid);
+ else {
+@@ -923,7 +931,7 @@ static void setinqstr(struct aac_dev *de
+ ++cp;
+ c = *cp;
+ *cp = '\0';
+- inqstrcpy(sup_adap_info->adapter_type_text, str->vid);
++ inqstrcpy(cname, str->vid);
+ *cp = c;
+ while (*cp && *cp != ' ')
+ ++cp;
+@@ -937,8 +945,8 @@ static void setinqstr(struct aac_dev *de
+ cp[sizeof(str->pid)] = '\0';
+ }
+ inqstrcpy (cp, str->pid);
+- if (c)
+- cp[sizeof(str->pid)] = c;
++
++ kfree(cname);
+ } else {
+ struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype);
+
futex-fix-owner_dead-fixup.patch
loop-fix-concurrent-lo_open-lo_release.patch
kvm-x86-fix-cpuid-function-for-word-6-80000001_ecx.patch
+tools-gpio-fix-build-error-with-musl-libc.patch
+gpio-stmpe-i2c-transfer-are-forbiden-in-atomic-context.patch
+gpio-fix-kernel-stack-leak-to-userspace.patch
+alsa-hda-reduce-the-suspend-time-consumption-for-alc256.patch
+crypto-ecdh-fix-typo-in-kpp-dependency-of-crypto_ecdh.patch
+crypto-aesni-handle-zero-length-dst-buffer.patch
+crypto-aesni-fix-typo-in-generic_gcmaes_decrypt.patch
+crypto-gcm-add-gcm-iv-size-constant.patch
+crypto-aesni-use-gcm-iv-size-constant.patch
+crypto-aesni-add-wrapper-for-generic-gcm-aes.patch
+crypto-aesni-fix-out-of-bounds-access-of-the-data-buffer-in-generic-gcm-aesni.patch
+crypto-aesni-fix-out-of-bounds-access-of-the-aad-buffer-in-generic-gcm-aesni.patch
+crypto-inside-secure-fix-hash-when-length-is-a-multiple-of-a-block.patch
+crypto-inside-secure-avoid-unmapping-dma-memory-that-was-not-mapped.patch
+crypto-sha3-generic-fixes-for-alignment-and-big-endian-operation.patch
+crypto-af_alg-whitelist-mask-and-type.patch
+hid-wacom-ekr-ensure-devres-groups-at-higher-indexes-are-released.patch
+hid-wacom-fix-reporting-of-touch-toggle-wacom_hid_wd_mute_device-events.patch
+power-reset-zx-reboot-add-missing-module_description-author-license.patch
+gpio-iop-add-missing-module_description-author-license.patch
+gpio-ath79-add-missing-module_description-license.patch
+mtd-nand-denali_pci-add-missing-module_description-author-license.patch
+igb-free-irqs-when-device-is-hotplugged.patch
+ima-policy-fix-parsing-of-fsuuid.patch
+scsi-aacraid-fix-udev-inquiry-race-condition.patch
+scsi-aacraid-fix-hang-in-kdump.patch
+vfs-handle-lazytime-in-do_mount.patch
--- /dev/null
+From 1696784eb7b52b13b62d160c028ef2c2c981d4f2 Mon Sep 17 00:00:00 2001
+From: Joel Stanley <joel@jms.id.au>
+Date: Thu, 21 Dec 2017 11:11:31 +1030
+Subject: tools/gpio: Fix build error with musl libc
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Joel Stanley <joel@jms.id.au>
+
+commit 1696784eb7b52b13b62d160c028ef2c2c981d4f2 upstream.
+
+The GPIO tools build fails when using a buildroot toolchain that uses musl
+as it's C library:
+
+arm-broomstick-linux-musleabi-gcc -Wp,-MD,./.gpio-event-mon.o.d \
+ -Wp,-MT,gpio-event-mon.o -O2 -Wall -g -D_GNU_SOURCE \
+ -Iinclude -D"BUILD_STR(s)=#s" -c -o gpio-event-mon.o gpio-event-mon.c
+gpio-event-mon.c:30:6: error: unknown type name ‘u_int32_t’; did you mean ‘uint32_t’?
+ u_int32_t handleflags,
+ ^~~~~~~~~
+ uint32_t
+
+The glibc headers installed on my laptop include sys/types.h in
+unistd.h, but it appears that musl does not.
+
+Fixes: 97f69747d8b1 ("tools/gpio: add the gpio-event-mon tool")
+Signed-off-by: Joel Stanley <joel@jms.id.au>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/gpio/gpio-event-mon.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/tools/gpio/gpio-event-mon.c
++++ b/tools/gpio/gpio-event-mon.c
+@@ -23,6 +23,7 @@
+ #include <getopt.h>
+ #include <inttypes.h>
+ #include <sys/ioctl.h>
++#include <sys/types.h>
+ #include <linux/gpio.h>
+
+ int monitor_device(const char *device_name,
--- /dev/null
+From d7ee946942bdd12394809305e3df05aa4c8b7b8f Mon Sep 17 00:00:00 2001
+From: Markus Trippelsdorf <markus@trippelsdorf.de>
+Date: Wed, 11 Oct 2017 07:01:31 +0200
+Subject: VFS: Handle lazytime in do_mount()
+
+From: Markus Trippelsdorf <markus@trippelsdorf.de>
+
+commit d7ee946942bdd12394809305e3df05aa4c8b7b8f upstream.
+
+Since commit e462ec50cb5fa ("VFS: Differentiate mount flags (MS_*) from
+internal superblock flags") the lazytime mount option doesn't get passed
+on anymore.
+
+Fix the issue by handling the option in do_mount().
+
+Reviewed-by: Lukas Czerner <lczerner@redhat.com>
+Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Cc: Holger Hoffstätte <holger@applied-asynchrony.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/namespace.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/namespace.c
++++ b/fs/namespace.c
+@@ -2826,6 +2826,7 @@ long do_mount(const char *dev_name, cons
+ SB_DIRSYNC |
+ SB_SILENT |
+ SB_POSIXACL |
++ SB_LAZYTIME |
+ SB_I_VERSION);
+
+ if (flags & MS_REMOUNT)