]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - crypto/algif_skcipher.c
x86/msr: Add definitions for new speculation control MSRs
[mirror_ubuntu-artful-kernel.git] / crypto / algif_skcipher.c
index 43839b00fe6c42fff5f8afbc04ffdff4e61a147d..76b875c69a95c4d2a45426f65a7543a8fa618234 100644 (file)
@@ -87,8 +87,13 @@ static void skcipher_free_async_sgls(struct skcipher_async_req *sreq)
        }
        sgl = sreq->tsg;
        n = sg_nents(sgl);
-       for_each_sg(sgl, sg, n, i)
-               put_page(sg_page(sg));
+       for_each_sg(sgl, sg, n, i) {
+               struct page *page = sg_page(sg);
+
+               /* some SGs may not have a page mapped */
+               if (page && page_ref_count(page))
+                       put_page(page);
+       }
 
        kfree(sreq->tsg);
 }
@@ -139,8 +144,10 @@ static int skcipher_alloc_sgl(struct sock *sk)
                sg_init_table(sgl->sg, MAX_SGL_ENTS + 1);
                sgl->cur = 0;
 
-               if (sg)
+               if (sg) {
                        sg_chain(sg, MAX_SGL_ENTS + 1, sgl->sg);
+                       sg_unmark_end(sg + (MAX_SGL_ENTS - 1));
+               }
 
                list_add_tail(&sgl->list, &ctx->tsgl);
        }