iommu: Fix a leak in iommu_insert_resv_region
authorEric Auger <eric.auger@redhat.com>
Mon, 3 Jun 2019 06:53:30 +0000 (08:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:06 +0000 (09:14 +0200)
commit79644b600850bc0102dbb44dca66069dc48441d8
treeca13779392d2e822deb4fb80a69f1d45db440c26
parentf2a4624be8f3d592389c9c5524377f0ae15fc5f7
iommu: Fix a leak in iommu_insert_resv_region

[ Upstream commit ad0834dedaa15c3a176f783c0373f836e44b4700 ]

In case we expand an existing region, we unlink
this latter and insert the larger one. In
that case we should free the original region after
the insertion. Also we can immediately return.

Fixes: 6c65fb318e8b ("iommu: iommu_get_group_resv_regions")

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/iommu.c