Commit 7e34e0bb authored by Tero Kristo's avatar Tero Kristo Committed by Herbert Xu

crypto: omap-crypto - fix userspace copied buffer access

In case buffers are copied from userspace, directly accessing the page
will most likely fail because it hasn't been mapped into the kernel
memory space. Fix the issue by forcing a kmap / kunmap within the
cleanup functionality.
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8dc43636
......@@ -178,11 +178,17 @@ static void omap_crypto_copy_data(struct scatterlist *src,
amt = min(src->length - srco, dst->length - dsto);
amt = min(len, amt);
srcb = sg_virt(src) + srco;
dstb = sg_virt(dst) + dsto;
srcb = kmap_atomic(sg_page(src)) + srco + src->offset;
dstb = kmap_atomic(sg_page(dst)) + dsto + dst->offset;
memcpy(dstb, srcb, amt);
if (!PageSlab(sg_page(dst)))
flush_kernel_dcache_page(sg_page(dst));
kunmap_atomic(srcb);
kunmap_atomic(dstb);
srco += amt;
dsto += amt;
len -= amt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment