]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: qat - Prevent dma mapping zero length assoc data
authorTadeusz Struk <tadeusz.struk@intel.com>
Tue, 14 Oct 2014 01:24:26 +0000 (18:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2014 17:23:09 +0000 (09:23 -0800)
commit 923a6e5e5f171317ac8bb462ac4b814fa7880d3c upstream.

Do not attempt to dma map associated data if it is zero length.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Tested-by: Nikolay Aleksandrov <nikolay@redhat.com>
Reviewed-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/qat/qat_common/qat_algs.c

index 59df488729559d4cd2b627e1f27a4cf31a444066..5b158ca898378b2b837bd424d6563f9b2e4deb0e 100644 (file)
@@ -650,6 +650,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,
                goto err;
 
        for_each_sg(assoc, sg, assoc_n, i) {
+               if (!sg->length)
+                       continue;
                bufl->bufers[bufs].addr = dma_map_single(dev,
                                                         sg_virt(sg),
                                                         sg->length,