projects
/
platform
/
kernel
/
linux-rpi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initramfs: break loop when decompression finishes
[platform/kernel/linux-rpi.git]
/
crypto
/
scompress.c
diff --git
a/crypto/scompress.c
b/crypto/scompress.c
index
24138b4
..
b108a30
100644
(file)
--- a/
crypto/scompress.c
+++ b/
crypto/scompress.c
@@
-117,6
+117,7
@@
static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
struct crypto_scomp *scomp = *tfm_ctx;
void **ctx = acomp_request_ctx(req);
struct scomp_scratch *scratch;
struct crypto_scomp *scomp = *tfm_ctx;
void **ctx = acomp_request_ctx(req);
struct scomp_scratch *scratch;
+ unsigned int dlen;
int ret;
if (!req->src || !req->slen || req->slen > SCOMP_SCRATCH_SIZE)
int ret;
if (!req->src || !req->slen || req->slen > SCOMP_SCRATCH_SIZE)
@@
-128,6
+129,8
@@
static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
if (!req->dlen || req->dlen > SCOMP_SCRATCH_SIZE)
req->dlen = SCOMP_SCRATCH_SIZE;
if (!req->dlen || req->dlen > SCOMP_SCRATCH_SIZE)
req->dlen = SCOMP_SCRATCH_SIZE;
+ dlen = req->dlen;
+
scratch = raw_cpu_ptr(&scomp_scratch);
spin_lock(&scratch->lock);
scratch = raw_cpu_ptr(&scomp_scratch);
spin_lock(&scratch->lock);
@@
-145,6
+148,9
@@
static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
ret = -ENOMEM;
goto out;
}
ret = -ENOMEM;
goto out;
}
+ } else if (req->dlen > dlen) {
+ ret = -ENOSPC;
+ goto out;
}
scatterwalk_map_and_copy(scratch->dst, req->dst, 0, req->dlen,
1);
}
scatterwalk_map_and_copy(scratch->dst, req->dst, 0, req->dlen,
1);
@@
-240,7
+246,7
@@
static const struct crypto_type crypto_scomp_type = {
#ifdef CONFIG_PROC_FS
.show = crypto_scomp_show,
#endif
#ifdef CONFIG_PROC_FS
.show = crypto_scomp_show,
#endif
-#if
def CONFIG_CRYPTO_USER
+#if
IS_ENABLED(CONFIG_CRYPTO_USER)
.report = crypto_scomp_report,
#endif
#ifdef CONFIG_CRYPTO_STATS
.report = crypto_scomp_report,
#endif
#ifdef CONFIG_CRYPTO_STATS