summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-01 14:28:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-01 14:28:42 -0400
commitf38d2e5313f0af9d9b66c02a5d49c71deb994b85 (patch)
treeeb4749c402e929b74572ded777fbe5bede3b59e1 /lib
parentaeb35d6b74174ed08daab84e232b456bbd89d1d9 (diff)
parent8cf740ae85df69fb6376f31b42eb2ac7a138721f (diff)
downloadlinux-f38d2e5313f0af9d9b66c02a5d49c71deb994b85.tar.bz2
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes a number of regressions in the marvell cesa driver caused by the chaining work, and a regression in lib/mpi that leads to a GFP_KERNEL allocation with preemption disabled" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: marvell - Don't copy IV vectors from the _process op for ciphers lib/mpi: Fix SG miter leak crypto: marvell - Update cache with input sg only when it is unmapped crypto: marvell - Don't chain at DMA level when backlog is disabled crypto: marvell - Fix memory leaks in TDMA chain for cipher requests
Diffstat (limited to 'lib')
-rw-r--r--lib/mpi/mpicoder.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
index c6272ae2015e..5a0f75a3bf01 100644
--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -363,6 +363,9 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
lzeros = 0;
}
+ miter.consumed = lzeros;
+ sg_miter_stop(&miter);
+
nbytes -= lzeros;
nbits = nbytes * 8;
if (nbits > MAX_EXTERN_MPI_BITS) {
@@ -390,7 +393,10 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
z = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
z %= BYTES_PER_MPI_LIMB;
- for (;;) {
+ while (sg_miter_next(&miter)) {
+ buff = miter.addr;
+ len = miter.length;
+
for (x = 0; x < len; x++) {
a <<= 8;
a |= *buff++;
@@ -400,12 +406,6 @@ MPI mpi_read_raw_from_sgl(struct scatterlist *sgl, unsigned int nbytes)
}
}
z += x;
-
- if (!sg_miter_next(&miter))
- break;
-
- buff = miter.addr;
- len = miter.length;
}
return val;