summaryrefslogtreecommitdiff
path: root/crypto/api.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/api.c')
-rw-r--r--crypto/api.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/api.c b/crypto/api.c
index 394169a8577..f55856b2199 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -168,6 +168,12 @@ int crypto_register_alg(struct crypto_alg *alg)
{
int ret = 0;
struct crypto_alg *q;
+
+ if (alg->cra_alignmask & (alg->cra_alignmask + 1))
+ return -EINVAL;
+
+ if (alg->cra_alignmask > PAGE_SIZE)
+ return -EINVAL;
down_write(&crypto_alg_sem);