pstore revert for v6.0-rc8
- Revert crypto acomp migration (Guilherme G. Piccoli) -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmM3CssWHGtlZXNjb29r QGNocm9taXVtLm9yZwAKCRCJcvTf3G3AJl75D/42DaeB92odK/3XG9cI1Frp4YS0 vcTIecUeheNrTf4okUjeL0kQjUJgDQLWYNxZU6O3ljNM3lItDegV14Ij4tiPJlNK pOg8e+ddnWmhTB6c1BrLwVIjPDUnJmhqd1L2G6D/1djlcQU2TzN/amjBE4PQYrC4 Kyqn8nmrVt5CgCvkV4PPDuIiyeGx808bFu+rK13J6BZYDH4mTZWqky25+wFuresn HNBQ0Xh7otaeeIMdbdohaitANlr7xHpUOLDuHnQaZ9Od1wJdFqNFpQ0sYDwvsqhY aTyNAAkZig9xMp10Sr6lCDfT/ZHkHDtSNOqn30iwPrFX83QVbbnaQhRsN7EK8Caz v7dx2HDjP5MxkYetT+3qPW4waScc5/s7dJNXoK/3E3oWrKoFRwx2CrmZUEuHmjHC S1M/kG+MoizxGAWbtvB93XbxXJlULdgmv1VKQyBjZRZ9JVBP7AnQmstljKjK0yn2 o/pgTFRduiTj7+N9iU7h7GxHNLXJm0YHwCZw1QhORc1dg14jbMkNEu6GN6ZNfuvg ADYs2tRN7YA7oGjACaCNAEuGxjY5/quvPAdYHdwankXBj8S8O2/BCxa02mbrPevC 7p32nwzRtUz4G+bjJr4N/RGO1q/Qzn5IcZnzOxGUVn5TC729JxkfRUFrb/m0l0PP PgfmGgNjSQ4KDaYIMQ== =KoAn -----END PGP SIGNATURE----- Merge tag 'pstore-v6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux Pull pstore revert from Kees Cook: "A misbehavior with some compression backends in pstore was just discovered due to the recent crypto acomp migration. Since we're so close to release, it seems better to just simply revert it, and we can figure out what's going on without leaving it broken for a release. - Revert crypto acomp migration (Guilherme G. Piccoli)" * tag 'pstore-v6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: Revert "pstore: migrate to crypto acomp interface"
This commit is contained in:
commit
d649d2c49b
@ -28,14 +28,11 @@
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include <crypto/acompress.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/*
|
||||
@ -93,8 +90,7 @@ module_param(compress, charp, 0444);
|
||||
MODULE_PARM_DESC(compress, "compression to use");
|
||||
|
||||
/* Compression parameters */
|
||||
static struct crypto_acomp *tfm;
|
||||
static struct acomp_req *creq;
|
||||
static struct crypto_comp *tfm;
|
||||
|
||||
struct pstore_zbackend {
|
||||
int (*zbufsize)(size_t size);
|
||||
@ -272,21 +268,12 @@ static const struct pstore_zbackend zbackends[] = {
|
||||
static int pstore_compress(const void *in, void *out,
|
||||
unsigned int inlen, unsigned int outlen)
|
||||
{
|
||||
struct scatterlist src, dst;
|
||||
int ret;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_PSTORE_COMPRESS))
|
||||
return -EINVAL;
|
||||
|
||||
sg_init_table(&src, 1);
|
||||
sg_set_buf(&src, in, inlen);
|
||||
|
||||
sg_init_table(&dst, 1);
|
||||
sg_set_buf(&dst, out, outlen);
|
||||
|
||||
acomp_request_set_params(creq, &src, &dst, inlen, outlen);
|
||||
|
||||
ret = crypto_acomp_compress(creq);
|
||||
ret = crypto_comp_compress(tfm, in, inlen, out, &outlen);
|
||||
if (ret) {
|
||||
pr_err("crypto_comp_compress failed, ret = %d!\n", ret);
|
||||
return ret;
|
||||
@ -297,7 +284,7 @@ static int pstore_compress(const void *in, void *out,
|
||||
|
||||
static void allocate_buf_for_compression(void)
|
||||
{
|
||||
struct crypto_acomp *acomp;
|
||||
struct crypto_comp *ctx;
|
||||
int size;
|
||||
char *buf;
|
||||
|
||||
@ -309,7 +296,7 @@ static void allocate_buf_for_compression(void)
|
||||
if (!psinfo || tfm)
|
||||
return;
|
||||
|
||||
if (!crypto_has_acomp(zbackend->name, 0, CRYPTO_ALG_ASYNC)) {
|
||||
if (!crypto_has_comp(zbackend->name, 0, 0)) {
|
||||
pr_err("Unknown compression: %s\n", zbackend->name);
|
||||
return;
|
||||
}
|
||||
@ -328,24 +315,16 @@ static void allocate_buf_for_compression(void)
|
||||
return;
|
||||
}
|
||||
|
||||
acomp = crypto_alloc_acomp(zbackend->name, 0, CRYPTO_ALG_ASYNC);
|
||||
if (IS_ERR_OR_NULL(acomp)) {
|
||||
ctx = crypto_alloc_comp(zbackend->name, 0, 0);
|
||||
if (IS_ERR_OR_NULL(ctx)) {
|
||||
kfree(buf);
|
||||
pr_err("crypto_alloc_comp('%s') failed: %ld\n", zbackend->name,
|
||||
PTR_ERR(acomp));
|
||||
return;
|
||||
}
|
||||
|
||||
creq = acomp_request_alloc(acomp);
|
||||
if (!creq) {
|
||||
crypto_free_acomp(acomp);
|
||||
kfree(buf);
|
||||
pr_err("acomp_request_alloc('%s') failed\n", zbackend->name);
|
||||
PTR_ERR(ctx));
|
||||
return;
|
||||
}
|
||||
|
||||
/* A non-NULL big_oops_buf indicates compression is available. */
|
||||
tfm = acomp;
|
||||
tfm = ctx;
|
||||
big_oops_buf_sz = size;
|
||||
big_oops_buf = buf;
|
||||
|
||||
@ -355,8 +334,7 @@ static void allocate_buf_for_compression(void)
|
||||
static void free_buf_for_compression(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_PSTORE_COMPRESS) && tfm) {
|
||||
acomp_request_free(creq);
|
||||
crypto_free_acomp(tfm);
|
||||
crypto_free_comp(tfm);
|
||||
tfm = NULL;
|
||||
}
|
||||
kfree(big_oops_buf);
|
||||
@ -693,8 +671,6 @@ static void decompress_record(struct pstore_record *record)
|
||||
int ret;
|
||||
int unzipped_len;
|
||||
char *unzipped, *workspace;
|
||||
struct acomp_req *dreq;
|
||||
struct scatterlist src, dst;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_PSTORE_COMPRESS) || !record->compressed)
|
||||
return;
|
||||
@ -718,30 +694,16 @@ static void decompress_record(struct pstore_record *record)
|
||||
if (!workspace)
|
||||
return;
|
||||
|
||||
dreq = acomp_request_alloc(tfm);
|
||||
if (!dreq) {
|
||||
kfree(workspace);
|
||||
return;
|
||||
}
|
||||
|
||||
sg_init_table(&src, 1);
|
||||
sg_set_buf(&src, record->buf, record->size);
|
||||
|
||||
sg_init_table(&dst, 1);
|
||||
sg_set_buf(&dst, workspace, unzipped_len);
|
||||
|
||||
acomp_request_set_params(dreq, &src, &dst, record->size, unzipped_len);
|
||||
|
||||
/* After decompression "unzipped_len" is almost certainly smaller. */
|
||||
ret = crypto_acomp_decompress(dreq);
|
||||
ret = crypto_comp_decompress(tfm, record->buf, record->size,
|
||||
workspace, &unzipped_len);
|
||||
if (ret) {
|
||||
pr_err("crypto_acomp_decompress failed, ret = %d!\n", ret);
|
||||
pr_err("crypto_comp_decompress failed, ret = %d!\n", ret);
|
||||
kfree(workspace);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Append ECC notice to decompressed buffer. */
|
||||
unzipped_len = dreq->dlen;
|
||||
memcpy(workspace + unzipped_len, record->buf + record->size,
|
||||
record->ecc_notice_size);
|
||||
|
||||
@ -749,7 +711,6 @@ static void decompress_record(struct pstore_record *record)
|
||||
unzipped = kmemdup(workspace, unzipped_len + record->ecc_notice_size,
|
||||
GFP_KERNEL);
|
||||
kfree(workspace);
|
||||
acomp_request_free(dreq);
|
||||
if (!unzipped)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user