提交 854b7737 编写于 作者: C Colin Ian King 提交者: Herbert Xu

crypto: sa2ul - Fix memory leak of rxd

There are two error return paths that are not freeing rxd and causing
memory leaks.  Fix these.

Addresses-Coverity: ("Resource leak")
Fixes: 00c9211f ("crypto: sa2ul - Fix DMA mapping API usage")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 50274b01
......@@ -1146,8 +1146,10 @@ static int sa_run(struct sa_req *req)
mapped_sg->sgt.sgl = src;
mapped_sg->sgt.orig_nents = src_nents;
ret = dma_map_sgtable(ddev, &mapped_sg->sgt, dir_src, 0);
if (ret)
if (ret) {
kfree(rxd);
return ret;
}
mapped_sg->dir = dir_src;
mapped_sg->mapped = true;
......@@ -1155,8 +1157,10 @@ static int sa_run(struct sa_req *req)
mapped_sg->sgt.sgl = req->src;
mapped_sg->sgt.orig_nents = sg_nents;
ret = dma_map_sgtable(ddev, &mapped_sg->sgt, dir_src, 0);
if (ret)
if (ret) {
kfree(rxd);
return ret;
}
mapped_sg->dir = dir_src;
mapped_sg->mapped = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册