提交 f3de082c 编写于 作者: L Linus Torvalds

Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto fix from Herbert Xu:
 "This fixes a boot failure on some platforms when crypto self test is
  enabled along with the new acomp interface"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: testmgr - Use heap buffer for acomp test input
...@@ -1461,16 +1461,25 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, ...@@ -1461,16 +1461,25 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
for (i = 0; i < ctcount; i++) { for (i = 0; i < ctcount; i++) {
unsigned int dlen = COMP_BUF_SIZE; unsigned int dlen = COMP_BUF_SIZE;
int ilen = ctemplate[i].inlen; int ilen = ctemplate[i].inlen;
void *input_vec;
input_vec = kmalloc(ilen, GFP_KERNEL);
if (!input_vec) {
ret = -ENOMEM;
goto out;
}
memcpy(input_vec, ctemplate[i].input, ilen);
memset(output, 0, dlen); memset(output, 0, dlen);
init_completion(&result.completion); init_completion(&result.completion);
sg_init_one(&src, ctemplate[i].input, ilen); sg_init_one(&src, input_vec, ilen);
sg_init_one(&dst, output, dlen); sg_init_one(&dst, output, dlen);
req = acomp_request_alloc(tfm); req = acomp_request_alloc(tfm);
if (!req) { if (!req) {
pr_err("alg: acomp: request alloc failed for %s\n", pr_err("alg: acomp: request alloc failed for %s\n",
algo); algo);
kfree(input_vec);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -1483,6 +1492,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, ...@@ -1483,6 +1492,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
if (ret) { if (ret) {
pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n", pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n",
i + 1, algo, -ret); i + 1, algo, -ret);
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
goto out; goto out;
} }
...@@ -1491,6 +1501,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, ...@@ -1491,6 +1501,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n", pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n",
i + 1, algo, req->dlen); i + 1, algo, req->dlen);
ret = -EINVAL; ret = -EINVAL;
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
goto out; goto out;
} }
...@@ -1500,26 +1511,37 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, ...@@ -1500,26 +1511,37 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
i + 1, algo); i + 1, algo);
hexdump(output, req->dlen); hexdump(output, req->dlen);
ret = -EINVAL; ret = -EINVAL;
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
goto out; goto out;
} }
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
} }
for (i = 0; i < dtcount; i++) { for (i = 0; i < dtcount; i++) {
unsigned int dlen = COMP_BUF_SIZE; unsigned int dlen = COMP_BUF_SIZE;
int ilen = dtemplate[i].inlen; int ilen = dtemplate[i].inlen;
void *input_vec;
input_vec = kmalloc(ilen, GFP_KERNEL);
if (!input_vec) {
ret = -ENOMEM;
goto out;
}
memcpy(input_vec, dtemplate[i].input, ilen);
memset(output, 0, dlen); memset(output, 0, dlen);
init_completion(&result.completion); init_completion(&result.completion);
sg_init_one(&src, dtemplate[i].input, ilen); sg_init_one(&src, input_vec, ilen);
sg_init_one(&dst, output, dlen); sg_init_one(&dst, output, dlen);
req = acomp_request_alloc(tfm); req = acomp_request_alloc(tfm);
if (!req) { if (!req) {
pr_err("alg: acomp: request alloc failed for %s\n", pr_err("alg: acomp: request alloc failed for %s\n",
algo); algo);
kfree(input_vec);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -1532,6 +1554,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, ...@@ -1532,6 +1554,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
if (ret) { if (ret) {
pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n", pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n",
i + 1, algo, -ret); i + 1, algo, -ret);
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
goto out; goto out;
} }
...@@ -1540,6 +1563,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, ...@@ -1540,6 +1563,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
pr_err("alg: acomp: Decompression test %d failed for %s: output len = %d\n", pr_err("alg: acomp: Decompression test %d failed for %s: output len = %d\n",
i + 1, algo, req->dlen); i + 1, algo, req->dlen);
ret = -EINVAL; ret = -EINVAL;
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
goto out; goto out;
} }
...@@ -1549,10 +1573,12 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, ...@@ -1549,10 +1573,12 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
i + 1, algo); i + 1, algo);
hexdump(output, req->dlen); hexdump(output, req->dlen);
ret = -EINVAL; ret = -EINVAL;
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
goto out; goto out;
} }
kfree(input_vec);
acomp_request_free(req); acomp_request_free(req);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册