commit b312b4f0e2f9 ("iommu: arm-smmu: Preallocate memory for map only on failure") had the following two errors: 1. The return code we checking when map_sg fails and we preallocte is wrong. The check should be for 0 and not -ENOMEM. So the preallocate is never happening when map_sg fails. 2. map_sg could've have mapped certain elements in sglist and later had got failed. With proper check, we are trying to call map_sg on the same size again, which would leave to double map of previously mapped elements in sglist. Fix this by returning the actual ret code from arm_lpae_map_sg() and check it against -ENOMEM if we need to preallocate or not. Also, unmap any partial iovas that was mapped previously. Change-Id: Ifee7c0bed6b9cf1c35ebb4a03d51a1a80ab0ed58 Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org> Signed-off-by: Ruchit <ruchitmarathe@gmail.com>fourteen
parent
373f56a7bb
commit
26d3c8aa56
Loading…
Reference in new issue