From 3e56d32ccc46df571ca68fbed66ea5fc48b81c85 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 23 Feb 2018 08:46:11 +0100 Subject: [PATCH] 4.9-stable patches added patches: arm-8743-1-bl_switcher-add-module_license-tag.patch arm64-dts-add-cooling-cells-to-cpu-nodes.patch asoc-ux500-add-module_license-tag.patch crypto-hash-annotate-algorithms-taking-optional-key.patch crypto-hash-prevent-using-keyed-hashes-without-setting-key.patch video-fbdev-mmp-add-module_license.patch --- ...1-bl_switcher-add-module_license-tag.patch | 33 ++ ...4-dts-add-cooling-cells-to-cpu-nodes.patch | 46 +++ .../asoc-ux500-add-module_license-tag.patch | 48 +++ ...otate-algorithms-taking-optional-key.patch | 222 +++++++++++ ...ing-keyed-hashes-without-setting-key.patch | 370 ++++++++++++++++++ queue-4.9/series | 6 + .../video-fbdev-mmp-add-module_license.patch | 41 ++ 7 files changed, 766 insertions(+) create mode 100644 queue-4.9/arm-8743-1-bl_switcher-add-module_license-tag.patch create mode 100644 queue-4.9/arm64-dts-add-cooling-cells-to-cpu-nodes.patch create mode 100644 queue-4.9/asoc-ux500-add-module_license-tag.patch create mode 100644 queue-4.9/crypto-hash-annotate-algorithms-taking-optional-key.patch create mode 100644 queue-4.9/crypto-hash-prevent-using-keyed-hashes-without-setting-key.patch create mode 100644 queue-4.9/video-fbdev-mmp-add-module_license.patch diff --git a/queue-4.9/arm-8743-1-bl_switcher-add-module_license-tag.patch b/queue-4.9/arm-8743-1-bl_switcher-add-module_license-tag.patch new file mode 100644 index 00000000000..b045774c034 --- /dev/null +++ b/queue-4.9/arm-8743-1-bl_switcher-add-module_license-tag.patch @@ -0,0 +1,33 @@ +From a21b4c10c7bf5b58112afa20d6fa829e8d74e3e6 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 10 Jan 2018 17:53:18 +0100 +Subject: ARM: 8743/1: bL_switcher: add MODULE_LICENSE tag + +From: Arnd Bergmann + +commit a21b4c10c7bf5b58112afa20d6fa829e8d74e3e6 upstream. + +Without this tag, we get a build warning: + +WARNING: modpost: missing MODULE_LICENSE() in arch/arm/common/bL_switcher_dummy_if.o + +For completeness, I'm also adding author and description fields. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Russell King +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/common/bL_switcher_dummy_if.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/arm/common/bL_switcher_dummy_if.c ++++ b/arch/arm/common/bL_switcher_dummy_if.c +@@ -57,3 +57,7 @@ static struct miscdevice bL_switcher_dev + &bL_switcher_fops + }; + module_misc_device(bL_switcher_device); ++ ++MODULE_AUTHOR("Nicolas Pitre "); ++MODULE_LICENSE("GPL v2"); ++MODULE_DESCRIPTION("big.LITTLE switcher dummy user interface"); diff --git a/queue-4.9/arm64-dts-add-cooling-cells-to-cpu-nodes.patch b/queue-4.9/arm64-dts-add-cooling-cells-to-cpu-nodes.patch new file mode 100644 index 00000000000..9a118b42834 --- /dev/null +++ b/queue-4.9/arm64-dts-add-cooling-cells-to-cpu-nodes.patch @@ -0,0 +1,46 @@ +From acbf76ee05067c3942852019993f7beb69a0f45f Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 10 Jan 2018 22:06:48 +0100 +Subject: arm64: dts: add #cooling-cells to CPU nodes + +From: Arnd Bergmann + +commit acbf76ee05067c3942852019993f7beb69a0f45f upstream. + +dtc complains about the lack of #coolin-cells properties for the +CPU nodes that are referred to as "cooling-device": + +arch/arm64/boot/dts/mediatek/mt8173-evb.dtb: Warning (cooling_device_property): Missing property '#cooling-cells' in node /cpus/cpu@0 or bad phandle (referred from /thermal-zones/cpu_thermal/cooling-maps/map@0:cooling-device[0]) +arch/arm64/boot/dts/mediatek/mt8173-evb.dtb: Warning (cooling_device_property): Missing property '#cooling-cells' in node /cpus/cpu@100 or bad phandle (referred from /thermal-zones/cpu_thermal/cooling-maps/map@1:cooling-device[0]) + +Apparently this property must be '<2>' to match the binding. + +Signed-off-by: Arnd Bergmann +Tested-by: Chunfeng Yun +Signed-off-by: Olof Johansson +[arnd: backported to 4.15] +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/boot/dts/mediatek/mt8173.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi +@@ -73,6 +73,7 @@ + reg = <0x000>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; ++ #cooling-cells = <2>; + }; + + cpu1: cpu@1 { +@@ -89,6 +90,7 @@ + reg = <0x100>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; ++ #cooling-cells = <2>; + }; + + cpu3: cpu@101 { diff --git a/queue-4.9/asoc-ux500-add-module_license-tag.patch b/queue-4.9/asoc-ux500-add-module_license-tag.patch new file mode 100644 index 00000000000..5df549bfae2 --- /dev/null +++ b/queue-4.9/asoc-ux500-add-module_license-tag.patch @@ -0,0 +1,48 @@ +From 1783c9d7cb7bc3181b9271665959b87280d98d8e Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 10 Jan 2018 17:34:45 +0100 +Subject: ASoC: ux500: add MODULE_LICENSE tag + +From: Arnd Bergmann + +commit 1783c9d7cb7bc3181b9271665959b87280d98d8e upstream. + +This adds MODULE_LICENSE/AUTHOR/DESCRIPTION tags to the ux500 +platform drivers, to avoid these build warnings: + +WARNING: modpost: missing MODULE_LICENSE() in sound/soc/ux500/snd-soc-ux500-plat-dma.o +WARNING: modpost: missing MODULE_LICENSE() in sound/soc/ux500/snd-soc-ux500-mach-mop500.o + +The company no longer exists, so the email addresses of the authors +don't work any more, but I've added them anyway for consistency. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/ux500/mop500.c | 4 ++++ + sound/soc/ux500/ux500_pcm.c | 5 +++++ + 2 files changed, 9 insertions(+) + +--- a/sound/soc/ux500/mop500.c ++++ b/sound/soc/ux500/mop500.c +@@ -164,3 +164,7 @@ static struct platform_driver snd_soc_mo + }; + + module_platform_driver(snd_soc_mop500_driver); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_DESCRIPTION("ASoC MOP500 board driver"); ++MODULE_AUTHOR("Ola Lilja"); +--- a/sound/soc/ux500/ux500_pcm.c ++++ b/sound/soc/ux500/ux500_pcm.c +@@ -165,3 +165,8 @@ int ux500_pcm_unregister_platform(struct + return 0; + } + EXPORT_SYMBOL_GPL(ux500_pcm_unregister_platform); ++ ++MODULE_AUTHOR("Ola Lilja"); ++MODULE_AUTHOR("Roger Nilsson"); ++MODULE_DESCRIPTION("ASoC UX500 driver"); ++MODULE_LICENSE("GPL v2"); diff --git a/queue-4.9/crypto-hash-annotate-algorithms-taking-optional-key.patch b/queue-4.9/crypto-hash-annotate-algorithms-taking-optional-key.patch new file mode 100644 index 00000000000..225f0ffd079 --- /dev/null +++ b/queue-4.9/crypto-hash-annotate-algorithms-taking-optional-key.patch @@ -0,0 +1,222 @@ +From a208fa8f33031b9e0aba44c7d1b7e68eb0cbd29e Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Wed, 3 Jan 2018 11:16:26 -0800 +Subject: crypto: hash - annotate algorithms taking optional key + +From: Eric Biggers + +commit a208fa8f33031b9e0aba44c7d1b7e68eb0cbd29e upstream. + +We need to consistently enforce that keyed hashes cannot be used without +setting the key. To do this we need a reliable way to determine whether +a given hash algorithm is keyed or not. AF_ALG currently does this by +checking for the presence of a ->setkey() method. However, this is +actually slightly broken because the CRC-32 algorithms implement +->setkey() but can also be used without a key. (The CRC-32 "key" is not +actually a cryptographic key but rather represents the initial state. +If not overridden, then a default initial state is used.) + +Prepare to fix this by introducing a flag CRYPTO_ALG_OPTIONAL_KEY which +indicates that the algorithm has a ->setkey() method, but it is not +required to be called. Then set it on all the CRC-32 algorithms. + +The same also applies to the Adler-32 implementation in Lustre. + +Also, the cryptd and mcryptd templates have to pass through the flag +from their underlying algorithm. + +Cc: stable@vger.kernel.org +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + + +--- + arch/arm64/crypto/crc32-arm64.c | 2 ++ + arch/powerpc/crypto/crc32c-vpmsum_glue.c | 1 + + arch/s390/crypto/crc32-vx.c | 3 +++ + arch/sparc/crypto/crc32c_glue.c | 1 + + arch/x86/crypto/crc32-pclmul_glue.c | 1 + + arch/x86/crypto/crc32c-intel_glue.c | 1 + + crypto/crc32_generic.c | 1 + + crypto/crc32c_generic.c | 1 + + crypto/cryptd.c | 7 +++---- + crypto/mcryptd.c | 7 +++---- + drivers/crypto/bfin_crc.c | 3 ++- + drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c | 1 + + include/linux/crypto.h | 6 ++++++ + 13 files changed, 26 insertions(+), 9 deletions(-) + +--- a/arch/arm64/crypto/crc32-arm64.c ++++ b/arch/arm64/crypto/crc32-arm64.c +@@ -232,6 +232,7 @@ static struct shash_alg crc32_alg = { + .cra_name = "crc32", + .cra_driver_name = "crc32-arm64-hw", + .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_alignmask = 0, + .cra_ctxsize = sizeof(struct chksum_ctx), +@@ -253,6 +254,7 @@ static struct shash_alg crc32c_alg = { + .cra_name = "crc32c", + .cra_driver_name = "crc32c-arm64-hw", + .cra_priority = 300, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_alignmask = 0, + .cra_ctxsize = sizeof(struct chksum_ctx), +--- a/arch/powerpc/crypto/crc32c-vpmsum_glue.c ++++ b/arch/powerpc/crypto/crc32c-vpmsum_glue.c +@@ -141,6 +141,7 @@ static struct shash_alg alg = { + .cra_name = "crc32c", + .cra_driver_name = "crc32c-vpmsum", + .cra_priority = 200, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_ctxsize = sizeof(u32), + .cra_module = THIS_MODULE, +--- a/arch/s390/crypto/crc32-vx.c ++++ b/arch/s390/crypto/crc32-vx.c +@@ -238,6 +238,7 @@ static struct shash_alg crc32_vx_algs[] + .cra_name = "crc32", + .cra_driver_name = "crc32-vx", + .cra_priority = 200, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CRC32_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct crc_ctx), + .cra_module = THIS_MODULE, +@@ -258,6 +259,7 @@ static struct shash_alg crc32_vx_algs[] + .cra_name = "crc32be", + .cra_driver_name = "crc32be-vx", + .cra_priority = 200, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CRC32_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct crc_ctx), + .cra_module = THIS_MODULE, +@@ -278,6 +280,7 @@ static struct shash_alg crc32_vx_algs[] + .cra_name = "crc32c", + .cra_driver_name = "crc32c-vx", + .cra_priority = 200, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CRC32_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct crc_ctx), + .cra_module = THIS_MODULE, +--- a/arch/sparc/crypto/crc32c_glue.c ++++ b/arch/sparc/crypto/crc32c_glue.c +@@ -133,6 +133,7 @@ static struct shash_alg alg = { + .cra_name = "crc32c", + .cra_driver_name = "crc32c-sparc64", + .cra_priority = SPARC_CR_OPCODE_PRIORITY, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_ctxsize = sizeof(u32), + .cra_alignmask = 7, +--- a/arch/x86/crypto/crc32-pclmul_glue.c ++++ b/arch/x86/crypto/crc32-pclmul_glue.c +@@ -162,6 +162,7 @@ static struct shash_alg alg = { + .cra_name = "crc32", + .cra_driver_name = "crc32-pclmul", + .cra_priority = 200, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_ctxsize = sizeof(u32), + .cra_module = THIS_MODULE, +--- a/arch/x86/crypto/crc32c-intel_glue.c ++++ b/arch/x86/crypto/crc32c-intel_glue.c +@@ -239,6 +239,7 @@ static struct shash_alg alg = { + .cra_name = "crc32c", + .cra_driver_name = "crc32c-intel", + .cra_priority = 200, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_ctxsize = sizeof(u32), + .cra_module = THIS_MODULE, +--- a/crypto/crc32_generic.c ++++ b/crypto/crc32_generic.c +@@ -133,6 +133,7 @@ static struct shash_alg alg = { + .cra_name = "crc32", + .cra_driver_name = "crc32-generic", + .cra_priority = 100, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_ctxsize = sizeof(u32), + .cra_module = THIS_MODULE, +--- a/crypto/crc32c_generic.c ++++ b/crypto/crc32c_generic.c +@@ -146,6 +146,7 @@ static struct shash_alg alg = { + .cra_name = "crc32c", + .cra_driver_name = "crc32c-generic", + .cra_priority = 100, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_alignmask = 3, + .cra_ctxsize = sizeof(struct chksum_ctx), +--- a/crypto/cryptd.c ++++ b/crypto/cryptd.c +@@ -673,10 +673,9 @@ static int cryptd_create_hash(struct cry + if (err) + goto out_free_inst; + +- type = CRYPTO_ALG_ASYNC; +- if (alg->cra_flags & CRYPTO_ALG_INTERNAL) +- type |= CRYPTO_ALG_INTERNAL; +- inst->alg.halg.base.cra_flags = type; ++ inst->alg.halg.base.cra_flags = CRYPTO_ALG_ASYNC | ++ (alg->cra_flags & (CRYPTO_ALG_INTERNAL | ++ CRYPTO_ALG_OPTIONAL_KEY)); + + inst->alg.halg.digestsize = salg->digestsize; + inst->alg.halg.statesize = salg->statesize; +--- a/crypto/mcryptd.c ++++ b/crypto/mcryptd.c +@@ -516,10 +516,9 @@ static int mcryptd_create_hash(struct cr + if (err) + goto out_free_inst; + +- type = CRYPTO_ALG_ASYNC; +- if (alg->cra_flags & CRYPTO_ALG_INTERNAL) +- type |= CRYPTO_ALG_INTERNAL; +- inst->alg.halg.base.cra_flags = type; ++ inst->alg.halg.base.cra_flags = CRYPTO_ALG_ASYNC | ++ (alg->cra_flags & (CRYPTO_ALG_INTERNAL | ++ CRYPTO_ALG_OPTIONAL_KEY)); + + inst->alg.halg.digestsize = halg->digestsize; + inst->alg.halg.statesize = halg->statesize; +--- a/drivers/crypto/bfin_crc.c ++++ b/drivers/crypto/bfin_crc.c +@@ -494,7 +494,8 @@ static struct ahash_alg algs = { + .cra_driver_name = DRIVER_NAME, + .cra_priority = 100, + .cra_flags = CRYPTO_ALG_TYPE_AHASH | +- CRYPTO_ALG_ASYNC, ++ CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct bfin_crypto_crc_ctx), + .cra_alignmask = 3, +--- a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c ++++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto-adler.c +@@ -119,6 +119,7 @@ static struct shash_alg alg = { + .cra_name = "adler32", + .cra_driver_name = "adler32-zlib", + .cra_priority = 100, ++ .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .cra_blocksize = CHKSUM_BLOCK_SIZE, + .cra_ctxsize = sizeof(u32), + .cra_module = THIS_MODULE, +--- a/include/linux/crypto.h ++++ b/include/linux/crypto.h +@@ -103,6 +103,12 @@ + #define CRYPTO_ALG_INTERNAL 0x00002000 + + /* ++ * Set if the algorithm has a ->setkey() method but can be used without ++ * calling it first, i.e. there is a default key. ++ */ ++#define CRYPTO_ALG_OPTIONAL_KEY 0x00004000 ++ ++/* + * Transform masks and values (for crt_flags). + */ + #define CRYPTO_TFM_REQ_MASK 0x000fff00 diff --git a/queue-4.9/crypto-hash-prevent-using-keyed-hashes-without-setting-key.patch b/queue-4.9/crypto-hash-prevent-using-keyed-hashes-without-setting-key.patch new file mode 100644 index 00000000000..643c61b609e --- /dev/null +++ b/queue-4.9/crypto-hash-prevent-using-keyed-hashes-without-setting-key.patch @@ -0,0 +1,370 @@ +From 9fa68f620041be04720d0cbfb1bd3ddfc6310b24 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Wed, 3 Jan 2018 11:16:27 -0800 +Subject: crypto: hash - prevent using keyed hashes without setting key + +From: Eric Biggers + +commit 9fa68f620041be04720d0cbfb1bd3ddfc6310b24 upstream. + +Currently, almost none of the keyed hash algorithms check whether a key +has been set before proceeding. Some algorithms are okay with this and +will effectively just use a key of all 0's or some other bogus default. +However, others will severely break, as demonstrated using +"hmac(sha3-512-generic)", the unkeyed use of which causes a kernel crash +via a (potentially exploitable) stack buffer overflow. + +A while ago, this problem was solved for AF_ALG by pairing each hash +transform with a 'has_key' bool. However, there are still other places +in the kernel where userspace can specify an arbitrary hash algorithm by +name, and the kernel uses it as unkeyed hash without checking whether it +is really unkeyed. Examples of this include: + + - KEYCTL_DH_COMPUTE, via the KDF extension + - dm-verity + - dm-crypt, via the ESSIV support + - dm-integrity, via the "internal hash" mode with no key given + - drbd (Distributed Replicated Block Device) + +This bug is especially bad for KEYCTL_DH_COMPUTE as that requires no +privileges to call. + +Fix the bug for all users by adding a flag CRYPTO_TFM_NEED_KEY to the +->crt_flags of each hash transform that indicates whether the transform +still needs to be keyed or not. Then, make the hash init, import, and +digest functions return -ENOKEY if the key is still needed. + +The new flag also replaces the 'has_key' bool which algif_hash was +previously using, thereby simplifying the algif_hash implementation. + +Reported-by: syzbot +Cc: stable@vger.kernel.org +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + + +--- + crypto/ahash.c | 22 ++++++++++++++++---- + crypto/algif_hash.c | 52 ++++++++++--------------------------------------- + crypto/shash.c | 25 +++++++++++++++++++---- + include/crypto/hash.h | 34 ++++++++++++++++++++++---------- + include/linux/crypto.h | 2 + + 5 files changed, 75 insertions(+), 60 deletions(-) + +--- a/crypto/ahash.c ++++ b/crypto/ahash.c +@@ -192,11 +192,18 @@ int crypto_ahash_setkey(struct crypto_ah + unsigned int keylen) + { + unsigned long alignmask = crypto_ahash_alignmask(tfm); ++ int err; + + if ((unsigned long)key & alignmask) +- return ahash_setkey_unaligned(tfm, key, keylen); ++ err = ahash_setkey_unaligned(tfm, key, keylen); ++ else ++ err = tfm->setkey(tfm, key, keylen); ++ ++ if (err) ++ return err; + +- return tfm->setkey(tfm, key, keylen); ++ crypto_ahash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); ++ return 0; + } + EXPORT_SYMBOL_GPL(crypto_ahash_setkey); + +@@ -369,7 +376,12 @@ EXPORT_SYMBOL_GPL(crypto_ahash_finup); + + int crypto_ahash_digest(struct ahash_request *req) + { +- return crypto_ahash_op(req, crypto_ahash_reqtfm(req)->digest); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ ++ if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) ++ return -ENOKEY; ++ ++ return crypto_ahash_op(req, tfm->digest); + } + EXPORT_SYMBOL_GPL(crypto_ahash_digest); + +@@ -455,7 +467,6 @@ static int crypto_ahash_init_tfm(struct + struct ahash_alg *alg = crypto_ahash_alg(hash); + + hash->setkey = ahash_nosetkey; +- hash->has_setkey = false; + hash->export = ahash_no_export; + hash->import = ahash_no_import; + +@@ -470,7 +481,8 @@ static int crypto_ahash_init_tfm(struct + + if (alg->setkey) { + hash->setkey = alg->setkey; +- hash->has_setkey = true; ++ if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) ++ crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY); + } + if (alg->export) + hash->export = alg->export; +--- a/crypto/algif_hash.c ++++ b/crypto/algif_hash.c +@@ -34,11 +34,6 @@ struct hash_ctx { + struct ahash_request req; + }; + +-struct algif_hash_tfm { +- struct crypto_ahash *hash; +- bool has_key; +-}; +- + static int hash_alloc_result(struct sock *sk, struct hash_ctx *ctx) + { + unsigned ds; +@@ -308,7 +303,7 @@ static int hash_check_key(struct socket + int err = 0; + struct sock *psk; + struct alg_sock *pask; +- struct algif_hash_tfm *tfm; ++ struct crypto_ahash *tfm; + struct sock *sk = sock->sk; + struct alg_sock *ask = alg_sk(sk); + +@@ -322,7 +317,7 @@ static int hash_check_key(struct socket + + err = -ENOKEY; + lock_sock_nested(psk, SINGLE_DEPTH_NESTING); +- if (!tfm->has_key) ++ if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) + goto unlock; + + if (!pask->refcnt++) +@@ -413,41 +408,17 @@ static struct proto_ops algif_hash_ops_n + + static void *hash_bind(const char *name, u32 type, u32 mask) + { +- struct algif_hash_tfm *tfm; +- struct crypto_ahash *hash; +- +- tfm = kzalloc(sizeof(*tfm), GFP_KERNEL); +- if (!tfm) +- return ERR_PTR(-ENOMEM); +- +- hash = crypto_alloc_ahash(name, type, mask); +- if (IS_ERR(hash)) { +- kfree(tfm); +- return ERR_CAST(hash); +- } +- +- tfm->hash = hash; +- +- return tfm; ++ return crypto_alloc_ahash(name, type, mask); + } + + static void hash_release(void *private) + { +- struct algif_hash_tfm *tfm = private; +- +- crypto_free_ahash(tfm->hash); +- kfree(tfm); ++ crypto_free_ahash(private); + } + + static int hash_setkey(void *private, const u8 *key, unsigned int keylen) + { +- struct algif_hash_tfm *tfm = private; +- int err; +- +- err = crypto_ahash_setkey(tfm->hash, key, keylen); +- tfm->has_key = !err; +- +- return err; ++ return crypto_ahash_setkey(private, key, keylen); + } + + static void hash_sock_destruct(struct sock *sk) +@@ -462,11 +433,10 @@ static void hash_sock_destruct(struct so + + static int hash_accept_parent_nokey(void *private, struct sock *sk) + { +- struct hash_ctx *ctx; ++ struct crypto_ahash *tfm = private; + struct alg_sock *ask = alg_sk(sk); +- struct algif_hash_tfm *tfm = private; +- struct crypto_ahash *hash = tfm->hash; +- unsigned len = sizeof(*ctx) + crypto_ahash_reqsize(hash); ++ struct hash_ctx *ctx; ++ unsigned int len = sizeof(*ctx) + crypto_ahash_reqsize(tfm); + + ctx = sock_kmalloc(sk, len, GFP_KERNEL); + if (!ctx) +@@ -479,7 +449,7 @@ static int hash_accept_parent_nokey(void + + ask->private = ctx; + +- ahash_request_set_tfm(&ctx->req, hash); ++ ahash_request_set_tfm(&ctx->req, tfm); + ahash_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG, + af_alg_complete, &ctx->completion); + +@@ -490,9 +460,9 @@ static int hash_accept_parent_nokey(void + + static int hash_accept_parent(void *private, struct sock *sk) + { +- struct algif_hash_tfm *tfm = private; ++ struct crypto_ahash *tfm = private; + +- if (!tfm->has_key && crypto_ahash_has_setkey(tfm->hash)) ++ if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) + return -ENOKEY; + + return hash_accept_parent_nokey(private, sk); +--- a/crypto/shash.c ++++ b/crypto/shash.c +@@ -57,11 +57,18 @@ int crypto_shash_setkey(struct crypto_sh + { + struct shash_alg *shash = crypto_shash_alg(tfm); + unsigned long alignmask = crypto_shash_alignmask(tfm); ++ int err; + + if ((unsigned long)key & alignmask) +- return shash_setkey_unaligned(tfm, key, keylen); ++ err = shash_setkey_unaligned(tfm, key, keylen); ++ else ++ err = shash->setkey(tfm, key, keylen); ++ ++ if (err) ++ return err; + +- return shash->setkey(tfm, key, keylen); ++ crypto_shash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); ++ return 0; + } + EXPORT_SYMBOL_GPL(crypto_shash_setkey); + +@@ -180,6 +187,9 @@ int crypto_shash_digest(struct shash_des + struct shash_alg *shash = crypto_shash_alg(tfm); + unsigned long alignmask = crypto_shash_alignmask(tfm); + ++ if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) ++ return -ENOKEY; ++ + if (((unsigned long)data | (unsigned long)out) & alignmask) + return shash_digest_unaligned(desc, data, len, out); + +@@ -359,7 +369,8 @@ int crypto_init_shash_ops_async(struct c + crt->digest = shash_async_digest; + crt->setkey = shash_async_setkey; + +- crt->has_setkey = alg->setkey != shash_no_setkey; ++ crypto_ahash_set_flags(crt, crypto_shash_get_flags(shash) & ++ CRYPTO_TFM_NEED_KEY); + + if (alg->export) + crt->export = shash_async_export; +@@ -374,8 +385,14 @@ int crypto_init_shash_ops_async(struct c + static int crypto_shash_init_tfm(struct crypto_tfm *tfm) + { + struct crypto_shash *hash = __crypto_shash_cast(tfm); ++ struct shash_alg *alg = crypto_shash_alg(hash); ++ ++ hash->descsize = alg->descsize; ++ ++ if (crypto_shash_alg_has_setkey(alg) && ++ !(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) ++ crypto_shash_set_flags(hash, CRYPTO_TFM_NEED_KEY); + +- hash->descsize = crypto_shash_alg(hash)->descsize; + return 0; + } + +--- a/include/crypto/hash.h ++++ b/include/crypto/hash.h +@@ -205,7 +205,6 @@ struct crypto_ahash { + unsigned int keylen); + + unsigned int reqsize; +- bool has_setkey; + struct crypto_tfm base; + }; + +@@ -399,11 +398,6 @@ static inline void *ahash_request_ctx(st + int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key, + unsigned int keylen); + +-static inline bool crypto_ahash_has_setkey(struct crypto_ahash *tfm) +-{ +- return tfm->has_setkey; +-} +- + /** + * crypto_ahash_finup() - update and finalize message digest + * @req: reference to the ahash_request handle that holds all information +@@ -475,7 +469,12 @@ static inline int crypto_ahash_export(st + */ + static inline int crypto_ahash_import(struct ahash_request *req, const void *in) + { +- return crypto_ahash_reqtfm(req)->import(req, in); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ ++ if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) ++ return -ENOKEY; ++ ++ return tfm->import(req, in); + } + + /** +@@ -492,7 +491,12 @@ static inline int crypto_ahash_import(st + */ + static inline int crypto_ahash_init(struct ahash_request *req) + { +- return crypto_ahash_reqtfm(req)->init(req); ++ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ++ ++ if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) ++ return -ENOKEY; ++ ++ return tfm->init(req); + } + + /** +@@ -845,7 +849,12 @@ static inline int crypto_shash_export(st + */ + static inline int crypto_shash_import(struct shash_desc *desc, const void *in) + { +- return crypto_shash_alg(desc->tfm)->import(desc, in); ++ struct crypto_shash *tfm = desc->tfm; ++ ++ if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) ++ return -ENOKEY; ++ ++ return crypto_shash_alg(tfm)->import(desc, in); + } + + /** +@@ -861,7 +870,12 @@ static inline int crypto_shash_import(st + */ + static inline int crypto_shash_init(struct shash_desc *desc) + { +- return crypto_shash_alg(desc->tfm)->init(desc); ++ struct crypto_shash *tfm = desc->tfm; ++ ++ if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) ++ return -ENOKEY; ++ ++ return crypto_shash_alg(tfm)->init(desc); + } + + /** +--- a/include/linux/crypto.h ++++ b/include/linux/crypto.h +@@ -111,6 +111,8 @@ + /* + * Transform masks and values (for crt_flags). + */ ++#define CRYPTO_TFM_NEED_KEY 0x00000001 ++ + #define CRYPTO_TFM_REQ_MASK 0x000fff00 + #define CRYPTO_TFM_RES_MASK 0xfff00000 + diff --git a/queue-4.9/series b/queue-4.9/series index 85716a93846..e423bc634ba 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -27,3 +27,9 @@ netfilter-xt_cgroup-initialize-info-priv-in-cgroup_mt_check_v1.patch netfilter-xt_rateest-acquire-xt_rateest_mutex-for-hash-insert.patch rds-tcp-atomically-purge-entries-from-rds_tcp_conn_list-during-netns-delete.patch net-avoid-skb_warn_bad_offload-on-is_err.patch +crypto-hash-annotate-algorithms-taking-optional-key.patch +crypto-hash-prevent-using-keyed-hashes-without-setting-key.patch +asoc-ux500-add-module_license-tag.patch +video-fbdev-mmp-add-module_license.patch +arm-8743-1-bl_switcher-add-module_license-tag.patch +arm64-dts-add-cooling-cells-to-cpu-nodes.patch diff --git a/queue-4.9/video-fbdev-mmp-add-module_license.patch b/queue-4.9/video-fbdev-mmp-add-module_license.patch new file mode 100644 index 00000000000..e24cfa8ff5b --- /dev/null +++ b/queue-4.9/video-fbdev-mmp-add-module_license.patch @@ -0,0 +1,41 @@ +From c1530ac5a3ce93a1f02adabc4508b5fbf862dfe2 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 15 Jan 2018 17:04:22 +0100 +Subject: video: fbdev/mmp: add MODULE_LICENSE + +From: Arnd Bergmann + +commit c1530ac5a3ce93a1f02adabc4508b5fbf862dfe2 upstream. + +Kbuild complains about the lack of a license tag in this driver: + +WARNING: modpost: missing MODULE_LICENSE() in drivers/video/fbdev/mmp/mmp_disp.o + +This adds the license, author and description tags. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Bartlomiej Zolnierkiewicz +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/video/fbdev/mmp/core.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/video/fbdev/mmp/core.c ++++ b/drivers/video/fbdev/mmp/core.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include