mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 22:25:03 +00:00
crypto: sahara - fix error handling in sahara_hw_descriptor_create()
[ Upstream commitee6e6f0a7f
] Do not call dma_unmap_sg() for scatterlists that were not mapped successfully. Fixes:5de8875281
("crypto: sahara - Add driver for SAHARA2 accelerator.") Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
4167eb9412
commit
dffc3483c8
1 changed files with 3 additions and 5 deletions
|
@ -483,13 +483,14 @@ static int sahara_hw_descriptor_create(struct sahara_dev *dev)
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
dev_err(dev->device, "couldn't map in sg\n");
|
dev_err(dev->device, "couldn't map in sg\n");
|
||||||
goto unmap_in;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dma_map_sg(dev->device, dev->out_sg, dev->nb_out_sg,
|
ret = dma_map_sg(dev->device, dev->out_sg, dev->nb_out_sg,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
dev_err(dev->device, "couldn't map out sg\n");
|
dev_err(dev->device, "couldn't map out sg\n");
|
||||||
goto unmap_out;
|
goto unmap_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create input links */
|
/* Create input links */
|
||||||
|
@ -537,9 +538,6 @@ static int sahara_hw_descriptor_create(struct sahara_dev *dev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unmap_out:
|
|
||||||
dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg,
|
|
||||||
DMA_FROM_DEVICE);
|
|
||||||
unmap_in:
|
unmap_in:
|
||||||
dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg,
|
dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
|
|
Loading…
Reference in a new issue