From 500ccf6878f1f9e41c1830fde6b2e717cfa5423b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 14 Feb 2016 13:59:31 -0800 Subject: [PATCH] 4.4-stable patches added patches: ahci-intel-dnv-device-ids-sata.patch crypto-af_alg-allow-af_af_alg_release_parent-to-be-called-on-nokey-path.patch crypto-af_alg-forbid-bind-2-when-nokey-child-sockets-are-present.patch crypto-algif_hash-fix-race-condition-in-hash_check_key.patch crypto-algif_hash-remove-custom-release-parent-function.patch crypto-algif_skcipher-fix-race-condition-in-skcipher_check_key.patch crypto-algif_skcipher-load-tx-sg-list-after-waiting.patch crypto-algif_skcipher-remove-custom-release-parent-function.patch crypto-algif_skcipher-sendmsg-sg-marking-is-off-by-one.patch crypto-caam-make-write-transactions-bufferable-on-ppc-platforms.patch crypto-chacha20-ssse3-align-stack-pointer-to-64-bytes.patch crypto-crc32c-fix-crc32c-soft-dependency.patch crypto-shash-fix-has_key-setting.patch libata-disable-forced-ports_impl-for-ahci-1.3.patch --- .../ahci-intel-dnv-device-ids-sata.patch | 48 ++++++++++ ...se_parent-to-be-called-on-nokey-path.patch | 63 +++++++++++++ ...when-nokey-child-sockets-are-present.patch | 67 ++++++++++++++ ...fix-race-condition-in-hash_check_key.patch | 57 ++++++++++++ ...emove-custom-release-parent-function.patch | 88 +++++++++++++++++++ ...race-condition-in-skcipher_check_key.patch | 57 ++++++++++++ ...cipher-load-tx-sg-list-after-waiting.patch | 51 +++++++++++ ...emove-custom-release-parent-function.patch | 88 +++++++++++++++++++ ...her-sendmsg-sg-marking-is-off-by-one.patch | 33 +++++++ ...sactions-bufferable-on-ppc-platforms.patch | 42 +++++++++ ...sse3-align-stack-pointer-to-64-bytes.patch | 42 +++++++++ ...to-crc32c-fix-crc32c-soft-dependency.patch | 43 +++++++++ .../crypto-shash-fix-has_key-setting.patch | 40 +++++++++ ...sable-forced-ports_impl-for-ahci-1.3.patch | 40 +++++++++ queue-4.4/series | 14 +++ 15 files changed, 773 insertions(+) create mode 100644 queue-4.4/ahci-intel-dnv-device-ids-sata.patch create mode 100644 queue-4.4/crypto-af_alg-allow-af_af_alg_release_parent-to-be-called-on-nokey-path.patch create mode 100644 queue-4.4/crypto-af_alg-forbid-bind-2-when-nokey-child-sockets-are-present.patch create mode 100644 queue-4.4/crypto-algif_hash-fix-race-condition-in-hash_check_key.patch create mode 100644 queue-4.4/crypto-algif_hash-remove-custom-release-parent-function.patch create mode 100644 queue-4.4/crypto-algif_skcipher-fix-race-condition-in-skcipher_check_key.patch create mode 100644 queue-4.4/crypto-algif_skcipher-load-tx-sg-list-after-waiting.patch create mode 100644 queue-4.4/crypto-algif_skcipher-remove-custom-release-parent-function.patch create mode 100644 queue-4.4/crypto-algif_skcipher-sendmsg-sg-marking-is-off-by-one.patch create mode 100644 queue-4.4/crypto-caam-make-write-transactions-bufferable-on-ppc-platforms.patch create mode 100644 queue-4.4/crypto-chacha20-ssse3-align-stack-pointer-to-64-bytes.patch create mode 100644 queue-4.4/crypto-crc32c-fix-crc32c-soft-dependency.patch create mode 100644 queue-4.4/crypto-shash-fix-has_key-setting.patch create mode 100644 queue-4.4/libata-disable-forced-ports_impl-for-ahci-1.3.patch diff --git a/queue-4.4/ahci-intel-dnv-device-ids-sata.patch b/queue-4.4/ahci-intel-dnv-device-ids-sata.patch new file mode 100644 index 00000000000..73ccedd1f18 --- /dev/null +++ b/queue-4.4/ahci-intel-dnv-device-ids-sata.patch @@ -0,0 +1,48 @@ +From 342decff2b846b46fa61eb5ee40986fab79a9a32 Mon Sep 17 00:00:00 2001 +From: Alexandra Yates +Date: Fri, 5 Feb 2016 15:27:49 -0800 +Subject: ahci: Intel DNV device IDs SATA + +From: Alexandra Yates + +commit 342decff2b846b46fa61eb5ee40986fab79a9a32 upstream. + +Adding Intel codename DNV platform device IDs for SATA. + +Signed-off-by: Alexandra Yates +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/ahci.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/ata/ahci.c ++++ b/drivers/ata/ahci.c +@@ -264,6 +264,26 @@ static const struct pci_device_id ahci_p + { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ + { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ + { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b0), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b1), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b2), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b3), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b4), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b5), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b6), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19b7), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19bE), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19bF), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c0), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c1), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c2), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c3), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c4), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c5), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c6), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19c7), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */ ++ { PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */ + { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ + { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ + { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ diff --git a/queue-4.4/crypto-af_alg-allow-af_af_alg_release_parent-to-be-called-on-nokey-path.patch b/queue-4.4/crypto-af_alg-allow-af_af_alg_release_parent-to-be-called-on-nokey-path.patch new file mode 100644 index 00000000000..775b7546f1d --- /dev/null +++ b/queue-4.4/crypto-af_alg-allow-af_af_alg_release_parent-to-be-called-on-nokey-path.patch @@ -0,0 +1,63 @@ +From 6a935170a980024dd29199e9dbb5c4da4767a1b9 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Wed, 13 Jan 2016 14:59:03 +0800 +Subject: crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path + +From: Herbert Xu + +commit 6a935170a980024dd29199e9dbb5c4da4767a1b9 upstream. + +This patch allows af_alg_release_parent to be called even for +nokey sockets. + +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/af_alg.c | 9 ++++++++- + include/crypto/if_alg.h | 1 + + 2 files changed, 9 insertions(+), 1 deletion(-) + +--- a/crypto/af_alg.c ++++ b/crypto/af_alg.c +@@ -133,6 +133,12 @@ void af_alg_release_parent(struct sock * + bool last; + + sk = ask->parent; ++ ++ if (ask->nokey_refcnt && !ask->refcnt) { ++ sock_put(sk); ++ return; ++ } ++ + ask = alg_sk(sk); + + lock_sock(sk); +@@ -268,8 +274,8 @@ int af_alg_accept(struct sock *sk, struc + struct alg_sock *ask = alg_sk(sk); + const struct af_alg_type *type; + struct sock *sk2; ++ unsigned int nokey; + int err; +- bool nokey; + + lock_sock(sk); + type = ask->type; +@@ -302,6 +308,7 @@ int af_alg_accept(struct sock *sk, struc + sock_hold(sk); + alg_sk(sk2)->parent = sk; + alg_sk(sk2)->type = type; ++ alg_sk(sk2)->nokey_refcnt = nokey; + + newsock->ops = type->ops; + newsock->state = SS_CONNECTED; +--- a/include/crypto/if_alg.h ++++ b/include/crypto/if_alg.h +@@ -31,6 +31,7 @@ struct alg_sock { + struct sock *parent; + + unsigned int refcnt; ++ unsigned int nokey_refcnt; + + const struct af_alg_type *type; + void *private; diff --git a/queue-4.4/crypto-af_alg-forbid-bind-2-when-nokey-child-sockets-are-present.patch b/queue-4.4/crypto-af_alg-forbid-bind-2-when-nokey-child-sockets-are-present.patch new file mode 100644 index 00000000000..f35a6c0d89f --- /dev/null +++ b/queue-4.4/crypto-af_alg-forbid-bind-2-when-nokey-child-sockets-are-present.patch @@ -0,0 +1,67 @@ +From a6a48c565f6f112c6983e2a02b1602189ed6e26e Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Wed, 13 Jan 2016 15:03:32 +0800 +Subject: crypto: af_alg - Forbid bind(2) when nokey child sockets are present + +From: Herbert Xu + +commit a6a48c565f6f112c6983e2a02b1602189ed6e26e upstream. + +This patch forbids the calling of bind(2) when there are child +sockets created by accept(2) in existence, even if they are created +on the nokey path. + +This is needed as those child sockets have references to the tfm +object which bind(2) will destroy. + +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/af_alg.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +--- a/crypto/af_alg.c ++++ b/crypto/af_alg.c +@@ -130,19 +130,16 @@ EXPORT_SYMBOL_GPL(af_alg_release); + void af_alg_release_parent(struct sock *sk) + { + struct alg_sock *ask = alg_sk(sk); +- bool last; ++ unsigned int nokey = ask->nokey_refcnt; ++ bool last = nokey && !ask->refcnt; + + sk = ask->parent; +- +- if (ask->nokey_refcnt && !ask->refcnt) { +- sock_put(sk); +- return; +- } +- + ask = alg_sk(sk); + + lock_sock(sk); +- last = !--ask->refcnt; ++ ask->nokey_refcnt -= nokey; ++ if (!last) ++ last = !--ask->refcnt; + release_sock(sk); + + if (last) +@@ -188,7 +185,7 @@ static int alg_bind(struct socket *sock, + + err = -EBUSY; + lock_sock(sk); +- if (ask->refcnt) ++ if (ask->refcnt | ask->nokey_refcnt) + goto unlock; + + swap(ask->type, type); +@@ -306,6 +303,7 @@ int af_alg_accept(struct sock *sk, struc + + if (nokey || !ask->refcnt++) + sock_hold(sk); ++ ask->nokey_refcnt += nokey; + alg_sk(sk2)->parent = sk; + alg_sk(sk2)->type = type; + alg_sk(sk2)->nokey_refcnt = nokey; diff --git a/queue-4.4/crypto-algif_hash-fix-race-condition-in-hash_check_key.patch b/queue-4.4/crypto-algif_hash-fix-race-condition-in-hash_check_key.patch new file mode 100644 index 00000000000..89687340070 --- /dev/null +++ b/queue-4.4/crypto-algif_hash-fix-race-condition-in-hash_check_key.patch @@ -0,0 +1,57 @@ +From ad46d7e33219218605ea619e32553daf4f346b9f Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Fri, 15 Jan 2016 22:01:08 +0800 +Subject: crypto: algif_hash - Fix race condition in hash_check_key + +From: Herbert Xu + +commit ad46d7e33219218605ea619e32553daf4f346b9f upstream. + +We need to lock the child socket in hash_check_key as otherwise +two simultaneous calls can cause the parent socket to be freed. + +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_hash.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/crypto/algif_hash.c ++++ b/crypto/algif_hash.c +@@ -242,22 +242,23 @@ static struct proto_ops algif_hash_ops = + + static int hash_check_key(struct socket *sock) + { +- int err; ++ int err = 0; + struct sock *psk; + struct alg_sock *pask; + struct algif_hash_tfm *tfm; + struct sock *sk = sock->sk; + struct alg_sock *ask = alg_sk(sk); + ++ lock_sock(sk); + if (ask->refcnt) +- return 0; ++ goto unlock_child; + + psk = ask->parent; + pask = alg_sk(ask->parent); + tfm = pask->private; + + err = -ENOKEY; +- lock_sock(psk); ++ lock_sock_nested(psk, SINGLE_DEPTH_NESTING); + if (!tfm->has_key) + goto unlock; + +@@ -271,6 +272,8 @@ static int hash_check_key(struct socket + + unlock: + release_sock(psk); ++unlock_child: ++ release_sock(sk); + + return err; + } diff --git a/queue-4.4/crypto-algif_hash-remove-custom-release-parent-function.patch b/queue-4.4/crypto-algif_hash-remove-custom-release-parent-function.patch new file mode 100644 index 00000000000..cf5dd34f43a --- /dev/null +++ b/queue-4.4/crypto-algif_hash-remove-custom-release-parent-function.patch @@ -0,0 +1,88 @@ +From f1d84af1835846a5a2b827382c5848faf2bb0e75 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Wed, 13 Jan 2016 15:00:36 +0800 +Subject: crypto: algif_hash - Remove custom release parent function + +From: Herbert Xu + +commit f1d84af1835846a5a2b827382c5848faf2bb0e75 upstream. + +This patch removes the custom release parent function as the +generic af_alg_release_parent now works for nokey sockets too. + +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_hash.c | 43 +++---------------------------------------- + 1 file changed, 3 insertions(+), 40 deletions(-) + +--- a/crypto/algif_hash.c ++++ b/crypto/algif_hash.c +@@ -384,7 +384,7 @@ static int hash_setkey(void *private, co + return err; + } + +-static void hash_sock_destruct_common(struct sock *sk) ++static void hash_sock_destruct(struct sock *sk) + { + struct alg_sock *ask = alg_sk(sk); + struct hash_ctx *ctx = ask->private; +@@ -392,33 +392,10 @@ static void hash_sock_destruct_common(st + sock_kzfree_s(sk, ctx->result, + crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req))); + sock_kfree_s(sk, ctx, ctx->len); +-} +- +-static void hash_sock_destruct(struct sock *sk) +-{ +- hash_sock_destruct_common(sk); +- af_alg_release_parent(sk); +-} +- +-static void hash_release_parent_nokey(struct sock *sk) +-{ +- struct alg_sock *ask = alg_sk(sk); +- +- if (!ask->refcnt) { +- sock_put(ask->parent); +- return; +- } +- + af_alg_release_parent(sk); + } + +-static void hash_sock_destruct_nokey(struct sock *sk) +-{ +- hash_sock_destruct_common(sk); +- hash_release_parent_nokey(sk); +-} +- +-static int hash_accept_parent_common(void *private, struct sock *sk) ++static int hash_accept_parent_nokey(void *private, struct sock *sk) + { + struct hash_ctx *ctx; + struct alg_sock *ask = alg_sk(sk); +@@ -461,21 +438,7 @@ static int hash_accept_parent(void *priv + if (!tfm->has_key && crypto_ahash_has_setkey(tfm->hash)) + return -ENOKEY; + +- return hash_accept_parent_common(private, sk); +-} +- +-static int hash_accept_parent_nokey(void *private, struct sock *sk) +-{ +- int err; +- +- err = hash_accept_parent_common(private, sk); +- if (err) +- goto out; +- +- sk->sk_destruct = hash_sock_destruct_nokey; +- +-out: +- return err; ++ return hash_accept_parent_nokey(private, sk); + } + + static const struct af_alg_type algif_type_hash = { diff --git a/queue-4.4/crypto-algif_skcipher-fix-race-condition-in-skcipher_check_key.patch b/queue-4.4/crypto-algif_skcipher-fix-race-condition-in-skcipher_check_key.patch new file mode 100644 index 00000000000..5104a2760a6 --- /dev/null +++ b/queue-4.4/crypto-algif_skcipher-fix-race-condition-in-skcipher_check_key.patch @@ -0,0 +1,57 @@ +From 1822793a523e5d5730b19cc21160ff1717421bc8 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Fri, 15 Jan 2016 22:02:20 +0800 +Subject: crypto: algif_skcipher - Fix race condition in skcipher_check_key + +From: Herbert Xu + +commit 1822793a523e5d5730b19cc21160ff1717421bc8 upstream. + +We need to lock the child socket in skcipher_check_key as otherwise +two simultaneous calls can cause the parent socket to be freed. + +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_skcipher.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/crypto/algif_skcipher.c ++++ b/crypto/algif_skcipher.c +@@ -755,22 +755,23 @@ static struct proto_ops algif_skcipher_o + + static int skcipher_check_key(struct socket *sock) + { +- int err; ++ int err = 0; + struct sock *psk; + struct alg_sock *pask; + struct skcipher_tfm *tfm; + struct sock *sk = sock->sk; + struct alg_sock *ask = alg_sk(sk); + ++ lock_sock(sk); + if (ask->refcnt) +- return 0; ++ goto unlock_child; + + psk = ask->parent; + pask = alg_sk(ask->parent); + tfm = pask->private; + + err = -ENOKEY; +- lock_sock(psk); ++ lock_sock_nested(psk, SINGLE_DEPTH_NESTING); + if (!tfm->has_key) + goto unlock; + +@@ -784,6 +785,8 @@ static int skcipher_check_key(struct soc + + unlock: + release_sock(psk); ++unlock_child: ++ release_sock(sk); + + return err; + } diff --git a/queue-4.4/crypto-algif_skcipher-load-tx-sg-list-after-waiting.patch b/queue-4.4/crypto-algif_skcipher-load-tx-sg-list-after-waiting.patch new file mode 100644 index 00000000000..658d394a4a7 --- /dev/null +++ b/queue-4.4/crypto-algif_skcipher-load-tx-sg-list-after-waiting.patch @@ -0,0 +1,51 @@ +From 4f0414e54e4d1893c6f08260693f8ef84c929293 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Mon, 18 Jan 2016 18:46:10 +0800 +Subject: crypto: algif_skcipher - Load TX SG list after waiting + +From: Herbert Xu + +commit 4f0414e54e4d1893c6f08260693f8ef84c929293 upstream. + +We need to load the TX SG list in sendmsg(2) after waiting for +incoming data, not before. + +Reported-by: Dmitry Vyukov +Signed-off-by: Herbert Xu +Tested-by: Dmitry Vyukov +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_skcipher.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/crypto/algif_skcipher.c ++++ b/crypto/algif_skcipher.c +@@ -647,13 +647,6 @@ static int skcipher_recvmsg_sync(struct + + lock_sock(sk); + while (msg_data_left(msg)) { +- sgl = list_first_entry(&ctx->tsgl, +- struct skcipher_sg_list, list); +- sg = sgl->sg; +- +- while (!sg->length) +- sg++; +- + if (!ctx->used) { + err = skcipher_wait_for_data(sk, flags); + if (err) +@@ -674,6 +667,13 @@ static int skcipher_recvmsg_sync(struct + if (!used) + goto free; + ++ sgl = list_first_entry(&ctx->tsgl, ++ struct skcipher_sg_list, list); ++ sg = sgl->sg; ++ ++ while (!sg->length) ++ sg++; ++ + skcipher_request_set_crypt(&ctx->req, sg, ctx->rsgl.sg, used, + ctx->iv); + diff --git a/queue-4.4/crypto-algif_skcipher-remove-custom-release-parent-function.patch b/queue-4.4/crypto-algif_skcipher-remove-custom-release-parent-function.patch new file mode 100644 index 00000000000..b6495fe8741 --- /dev/null +++ b/queue-4.4/crypto-algif_skcipher-remove-custom-release-parent-function.patch @@ -0,0 +1,88 @@ +From d7b65aee1e7b4c87922b0232eaba56a8a143a4a0 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Wed, 13 Jan 2016 15:01:06 +0800 +Subject: crypto: algif_skcipher - Remove custom release parent function + +From: Herbert Xu + +commit d7b65aee1e7b4c87922b0232eaba56a8a143a4a0 upstream. + +This patch removes the custom release parent function as the +generic af_alg_release_parent now works for nokey sockets too. + +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_skcipher.c | 43 +++---------------------------------------- + 1 file changed, 3 insertions(+), 40 deletions(-) + +--- a/crypto/algif_skcipher.c ++++ b/crypto/algif_skcipher.c +@@ -895,7 +895,7 @@ static void skcipher_wait(struct sock *s + msleep(100); + } + +-static void skcipher_sock_destruct_common(struct sock *sk) ++static void skcipher_sock_destruct(struct sock *sk) + { + struct alg_sock *ask = alg_sk(sk); + struct skcipher_ctx *ctx = ask->private; +@@ -907,33 +907,10 @@ static void skcipher_sock_destruct_commo + skcipher_free_sgl(sk); + sock_kzfree_s(sk, ctx->iv, crypto_skcipher_ivsize(tfm)); + sock_kfree_s(sk, ctx, ctx->len); +-} +- +-static void skcipher_sock_destruct(struct sock *sk) +-{ +- skcipher_sock_destruct_common(sk); +- af_alg_release_parent(sk); +-} +- +-static void skcipher_release_parent_nokey(struct sock *sk) +-{ +- struct alg_sock *ask = alg_sk(sk); +- +- if (!ask->refcnt) { +- sock_put(ask->parent); +- return; +- } +- + af_alg_release_parent(sk); + } + +-static void skcipher_sock_destruct_nokey(struct sock *sk) +-{ +- skcipher_sock_destruct_common(sk); +- skcipher_release_parent_nokey(sk); +-} +- +-static int skcipher_accept_parent_common(void *private, struct sock *sk) ++static int skcipher_accept_parent_nokey(void *private, struct sock *sk) + { + struct skcipher_ctx *ctx; + struct alg_sock *ask = alg_sk(sk); +@@ -981,21 +958,7 @@ static int skcipher_accept_parent(void * + if (!tfm->has_key && crypto_skcipher_has_setkey(tfm->skcipher)) + return -ENOKEY; + +- return skcipher_accept_parent_common(private, sk); +-} +- +-static int skcipher_accept_parent_nokey(void *private, struct sock *sk) +-{ +- int err; +- +- err = skcipher_accept_parent_common(private, sk); +- if (err) +- goto out; +- +- sk->sk_destruct = skcipher_sock_destruct_nokey; +- +-out: +- return err; ++ return skcipher_accept_parent_nokey(private, sk); + } + + static const struct af_alg_type algif_type_skcipher = { diff --git a/queue-4.4/crypto-algif_skcipher-sendmsg-sg-marking-is-off-by-one.patch b/queue-4.4/crypto-algif_skcipher-sendmsg-sg-marking-is-off-by-one.patch new file mode 100644 index 00000000000..8bbc599365b --- /dev/null +++ b/queue-4.4/crypto-algif_skcipher-sendmsg-sg-marking-is-off-by-one.patch @@ -0,0 +1,33 @@ +From 202736d99b7f29279db9da61587f11a08a04a9c6 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Tue, 19 Jan 2016 21:23:57 +0800 +Subject: crypto: algif_skcipher - sendmsg SG marking is off by one + +From: Herbert Xu + +commit 202736d99b7f29279db9da61587f11a08a04a9c6 upstream. + +We mark the end of the SG list in sendmsg and sendpage and unmark +it on the next send call. Unfortunately the unmarking in sendmsg +is off-by-one, leading to an SG list that is too short. + +Fixes: 0f477b655a52 ("crypto: algif - Mark sgl end at the end of data") +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_skcipher.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/crypto/algif_skcipher.c ++++ b/crypto/algif_skcipher.c +@@ -392,7 +392,8 @@ static int skcipher_sendmsg(struct socke + + sgl = list_entry(ctx->tsgl.prev, struct skcipher_sg_list, list); + sg = sgl->sg; +- sg_unmark_end(sg + sgl->cur); ++ if (sgl->cur) ++ sg_unmark_end(sg + sgl->cur - 1); + do { + i = sgl->cur; + plen = min_t(int, len, PAGE_SIZE); diff --git a/queue-4.4/crypto-caam-make-write-transactions-bufferable-on-ppc-platforms.patch b/queue-4.4/crypto-caam-make-write-transactions-bufferable-on-ppc-platforms.patch new file mode 100644 index 00000000000..3f83853f940 --- /dev/null +++ b/queue-4.4/crypto-caam-make-write-transactions-bufferable-on-ppc-platforms.patch @@ -0,0 +1,42 @@ +From e7a7104e432c0db8469ca3568daf4f1d1afe3e73 Mon Sep 17 00:00:00 2001 +From: Horia Geant? +Date: Tue, 12 Jan 2016 17:59:29 +0200 +Subject: crypto: caam - make write transactions bufferable on PPC platforms + +From: Horia Geant? + +commit e7a7104e432c0db8469ca3568daf4f1d1afe3e73 upstream. + +Previous change (see "Fixes" tag) to the MCFGR register +clears AWCACHE[0] ("bufferable" AXI3 attribute) (which is "1" at POR). + +This makes all writes non-bufferable, causing a ~ 5% performance drop +for PPC-based platforms. + +Rework previous change such that MCFGR[AWCACHE]=4'b0011 +(bufferable + cacheable) for all platforms. +Note: For ARM-based platforms, AWCACHE[0] is ignored +by the interconnect IP. + +Fixes: f10967495144 ("crypto: caam - fix snooping for write transactions") +Signed-off-by: Horia Geant? +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/caam/ctrl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/crypto/caam/ctrl.c ++++ b/drivers/crypto/caam/ctrl.c +@@ -534,8 +534,8 @@ static int caam_probe(struct platform_de + * long pointers in master configuration register + */ + clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK, MCFGR_AWCACHE_CACH | +- MCFGR_WDENABLE | (sizeof(dma_addr_t) == sizeof(u64) ? +- MCFGR_LONG_PTR : 0)); ++ MCFGR_AWCACHE_BUFF | MCFGR_WDENABLE | ++ (sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0)); + + /* + * Read the Compile Time paramters and SCFGR to determine diff --git a/queue-4.4/crypto-chacha20-ssse3-align-stack-pointer-to-64-bytes.patch b/queue-4.4/crypto-chacha20-ssse3-align-stack-pointer-to-64-bytes.patch new file mode 100644 index 00000000000..01c39386018 --- /dev/null +++ b/queue-4.4/crypto-chacha20-ssse3-align-stack-pointer-to-64-bytes.patch @@ -0,0 +1,42 @@ +From cbe09bd51bf23b42c3a94c5fb6815e1397c5fc3f Mon Sep 17 00:00:00 2001 +From: Eli Cooper +Date: Fri, 22 Jan 2016 00:24:08 +0800 +Subject: crypto: chacha20-ssse3 - Align stack pointer to 64 bytes + +From: Eli Cooper + +commit cbe09bd51bf23b42c3a94c5fb6815e1397c5fc3f upstream. + +This aligns the stack pointer in chacha20_4block_xor_ssse3 to 64 bytes. +Fixes general protection faults and potential kernel panics. + +Signed-off-by: Eli Cooper +Acked-by: Martin Willi +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/crypto/chacha20-ssse3-x86_64.S | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/arch/x86/crypto/chacha20-ssse3-x86_64.S ++++ b/arch/x86/crypto/chacha20-ssse3-x86_64.S +@@ -157,7 +157,9 @@ ENTRY(chacha20_4block_xor_ssse3) + # done with the slightly better performing SSSE3 byte shuffling, + # 7/12-bit word rotation uses traditional shift+OR. + +- sub $0x40,%rsp ++ mov %rsp,%r11 ++ sub $0x80,%rsp ++ and $~63,%rsp + + # x0..15[0-3] = s0..3[0..3] + movq 0x00(%rdi),%xmm1 +@@ -620,6 +622,6 @@ ENTRY(chacha20_4block_xor_ssse3) + pxor %xmm1,%xmm15 + movdqu %xmm15,0xf0(%rsi) + +- add $0x40,%rsp ++ mov %r11,%rsp + ret + ENDPROC(chacha20_4block_xor_ssse3) diff --git a/queue-4.4/crypto-crc32c-fix-crc32c-soft-dependency.patch b/queue-4.4/crypto-crc32c-fix-crc32c-soft-dependency.patch new file mode 100644 index 00000000000..788d6810d7e --- /dev/null +++ b/queue-4.4/crypto-crc32c-fix-crc32c-soft-dependency.patch @@ -0,0 +1,43 @@ +From fd7f6727102a1ccf6b4c1dfcc631f9b546526b26 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Mon, 18 Jan 2016 17:06:05 +0100 +Subject: crypto: crc32c - Fix crc32c soft dependency + +From: Jean Delvare + +commit fd7f6727102a1ccf6b4c1dfcc631f9b546526b26 upstream. + +I don't think it makes sense for a module to have a soft dependency +on itself. This seems quite cyclic by nature and I can't see what +purpose it could serve. + +OTOH libcrc32c calls crypto_alloc_shash("crc32c", 0, 0) so it pretty +much assumes that some incarnation of the "crc32c" hash algorithm has +been loaded. Therefore it makes sense to have the soft dependency +there (as crc-t10dif does.) + +Cc: Tim Chen +Cc: "David S. Miller" +Signed-off-by: Jean Delvare +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/crc32c_generic.c | 1 - + lib/libcrc32c.c | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +--- a/crypto/crc32c_generic.c ++++ b/crypto/crc32c_generic.c +@@ -172,4 +172,3 @@ MODULE_DESCRIPTION("CRC32c (Castagnoli) + MODULE_LICENSE("GPL"); + MODULE_ALIAS_CRYPTO("crc32c"); + MODULE_ALIAS_CRYPTO("crc32c-generic"); +-MODULE_SOFTDEP("pre: crc32c"); +--- a/lib/libcrc32c.c ++++ b/lib/libcrc32c.c +@@ -74,3 +74,4 @@ module_exit(libcrc32c_mod_fini); + MODULE_AUTHOR("Clay Haapala "); + MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations"); + MODULE_LICENSE("GPL"); ++MODULE_SOFTDEP("pre: crc32c"); diff --git a/queue-4.4/crypto-shash-fix-has_key-setting.patch b/queue-4.4/crypto-shash-fix-has_key-setting.patch new file mode 100644 index 00000000000..449181b2a3b --- /dev/null +++ b/queue-4.4/crypto-shash-fix-has_key-setting.patch @@ -0,0 +1,40 @@ +From 00420a65fa2beb3206090ead86942484df2275f3 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Wed, 27 Jan 2016 00:16:37 +0800 +Subject: crypto: shash - Fix has_key setting + +From: Herbert Xu + +commit 00420a65fa2beb3206090ead86942484df2275f3 upstream. + +The has_key logic is wrong for shash algorithms as they always +have a setkey function. So we should instead be testing against +shash_no_setkey. + +Fixes: a5596d633278 ("crypto: hash - Add crypto_ahash_has_setkey") +Reported-by: Stephan Mueller +Signed-off-by: Herbert Xu +Tested-by: Stephan Mueller +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/shash.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/crypto/shash.c ++++ b/crypto/shash.c +@@ -354,11 +354,10 @@ int crypto_init_shash_ops_async(struct c + crt->final = shash_async_final; + crt->finup = shash_async_finup; + crt->digest = shash_async_digest; ++ crt->setkey = shash_async_setkey; ++ ++ crt->has_setkey = alg->setkey != shash_no_setkey; + +- if (alg->setkey) { +- crt->setkey = shash_async_setkey; +- crt->has_setkey = true; +- } + if (alg->export) + crt->export = shash_async_export; + if (alg->import) diff --git a/queue-4.4/libata-disable-forced-ports_impl-for-ahci-1.3.patch b/queue-4.4/libata-disable-forced-ports_impl-for-ahci-1.3.patch new file mode 100644 index 00000000000..4ebc8d44e8a --- /dev/null +++ b/queue-4.4/libata-disable-forced-ports_impl-for-ahci-1.3.patch @@ -0,0 +1,40 @@ +From 566d1827df2ef0cbe921d3d6946ac3007b1a6938 Mon Sep 17 00:00:00 2001 +From: Tejun Heo +Date: Fri, 15 Jan 2016 15:13:05 -0500 +Subject: libata: disable forced PORTS_IMPL for >= AHCI 1.3 + +From: Tejun Heo + +commit 566d1827df2ef0cbe921d3d6946ac3007b1a6938 upstream. + +Some early controllers incorrectly reported zero ports in PORTS_IMPL +register and the ahci driver fabricates PORTS_IMPL from the number of +ports in those cases. This hasn't mattered but with the new nvme +controllers there are cases where zero PORTS_IMPL is valid and should +be honored. + +Disable the workaround for >= AHCI 1.3. + +Signed-off-by: Tejun Heo +Reported-by: Andy Lutomirski +Link: http://lkml.kernel.org/g/CALCETrU7yMvXEDhjAUShoHEhDwifJGapdw--BKxsP0jmjKGmRw@mail.gmail.com +Cc: Sergei Shtylyov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ata/libahci.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/ata/libahci.c ++++ b/drivers/ata/libahci.c +@@ -495,8 +495,8 @@ void ahci_save_initial_config(struct dev + } + } + +- /* fabricate port_map from cap.nr_ports */ +- if (!port_map) { ++ /* fabricate port_map from cap.nr_ports for < AHCI 1.3 */ ++ if (!port_map && vers < 0x10300) { + port_map = (1 << ahci_nr_ports(cap)) - 1; + dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map); + diff --git a/queue-4.4/series b/queue-4.4/series index b59116270d2..6df059ba0df 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -86,3 +86,17 @@ crypto-hash-add-crypto_ahash_has_setkey.patch crypto-algif_hash-require-setkey-before-accept-2.patch crypto-skcipher-add-crypto_skcipher_has_setkey.patch crypto-algif_skcipher-add-key-check-exception-for-cipher_null.patch +libata-disable-forced-ports_impl-for-ahci-1.3.patch +ahci-intel-dnv-device-ids-sata.patch +crypto-af_alg-allow-af_af_alg_release_parent-to-be-called-on-nokey-path.patch +crypto-algif_hash-remove-custom-release-parent-function.patch +crypto-algif_skcipher-remove-custom-release-parent-function.patch +crypto-af_alg-forbid-bind-2-when-nokey-child-sockets-are-present.patch +crypto-algif_hash-fix-race-condition-in-hash_check_key.patch +crypto-algif_skcipher-fix-race-condition-in-skcipher_check_key.patch +crypto-crc32c-fix-crc32c-soft-dependency.patch +crypto-algif_skcipher-load-tx-sg-list-after-waiting.patch +crypto-algif_skcipher-sendmsg-sg-marking-is-off-by-one.patch +crypto-caam-make-write-transactions-bufferable-on-ppc-platforms.patch +crypto-chacha20-ssse3-align-stack-pointer-to-64-bytes.patch +crypto-shash-fix-has_key-setting.patch -- 2.47.3