From: Shawn Lin Date: Wed, 24 Aug 2016 02:23:51 +0000 (+0800) Subject: iommu/ipmmu-vmsa: Fix wrong error handle of ipmmu_add_device X-Git-Tag: v4.9-rc1~44^2^5 X-Git-Url: http://git.cascardo.info/?a=commitdiff_plain;ds=sidebyside;h=b1e2afca635bb01f93ecd8112c265b980f1abc08;p=cascardo%2Flinux.git iommu/ipmmu-vmsa: Fix wrong error handle of ipmmu_add_device Let's fix the error handle of ipmmu_add_device when failing to find utlbs, otherwise we take a risk of pontential memleak. Signed-off-by: Shawn Lin Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 2fdbac67a77f..ace331da6459 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -636,7 +636,7 @@ static int ipmmu_add_device(struct device *dev) spin_unlock(&ipmmu_devices_lock); if (ret < 0) - return -ENODEV; + goto error; for (i = 0; i < num_utlbs; ++i) { if (utlbs[i] >= mmu->num_utlbs) {