In certain platforms like DRA7xx having memory > 2GB with LPAE enabled
has a constraint that DMA can be done with the initial 2GB and marks it
as ZONE_DMA. But openssl when used with cryptodev does not make sure that
input buffer is DMA capable. So, adding a check to verify if the input
buffer is capable of DMA.

Signed-off-by: Tero Kristo <t-kri...@ti.com>
Reported-by: Aparna Balasubramanian <apar...@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvu...@ti.com>
---
 drivers/crypto/omap-sham.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 86b89ac..ce398b7 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -759,6 +759,13 @@ static int omap_sham_align_sgs(struct scatterlist *sg,
        while (nbytes > 0 && sg_tmp) {
                n++;
 
+#ifdef CONFIG_ZONE_DMA
+               if (page_zonenum(sg_page(sg_tmp)) != ZONE_DMA) {
+                       aligned = false;
+                       break;
+               }
+#endif
+
                if (offset < sg_tmp->length) {
                        if (!IS_ALIGNED(offset + sg_tmp->offset, 4)) {
                                aligned = false;
-- 
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Reply via email to