summaryrefslogtreecommitdiff
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2018-01-29 15:54:46 +0100
committerJuergen Gross <jgross@suse.com>2018-01-29 15:54:46 +0100
commitfe8cbbbc0e68dad845f72ad75c8099b88f7ff049 (patch)
tree2bf17da93b86508fe2f66e87f39897a1d4b403dc /crypto/algapi.c
parent40248a5f572a9ee5602fb61b33ddcc7de3b4cf5b (diff)
parent21864b027d847a6d91903a5ba219770403ba8aad (diff)
downloadlinux-crypto-fe8cbbbc0e68dad845f72ad75c8099b88f7ff049.tar.gz
linux-crypto-fe8cbbbc0e68dad845f72ad75c8099b88f7ff049.zip
Merge branch 'master' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index aa699ff6..9a636f96 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -167,6 +167,18 @@ void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list,
spawn->alg = NULL;
spawns = &inst->alg.cra_users;
+
+ /*
+ * We may encounter an unregistered instance here, since
+ * an instance's spawns are set up prior to the instance
+ * being registered. An unregistered instance will have
+ * NULL ->cra_users.next, since ->cra_users isn't
+ * properly initialized until registration. But an
+ * unregistered instance cannot have any users, so treat
+ * it the same as ->cra_users being empty.
+ */
+ if (spawns->next == NULL)
+ break;
}
} while ((spawns = crypto_more_spawns(alg, &stack, &top,
&secondary_spawns)));
@@ -897,9 +909,11 @@ int crypto_enqueue_request(struct crypto_queue *queue,
int err = -EINPROGRESS;
if (unlikely(queue->qlen >= queue->max_qlen)) {
- err = -EBUSY;
- if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) {
+ err = -ENOSPC;
goto out;
+ }
+ err = -EBUSY;
if (queue->backlog == &queue->list)
queue->backlog = &request->list;
}