iommu/vt-d: Fix sysfs leak in alloc_iommu()
authorRolf Eike Beer <eb@emlix.com>
Tue, 25 May 2021 07:08:02 +0000 (15:08 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 07:00:27 +0000 (09:00 +0200)
commitf01134321d04f47c718bb41b799bcdeda27873d2
tree8a6e742f52d789906b12c5476f95332bfc96f62e
parentf9890652185b72b8de9ebeb4406037640b6e1b53
iommu/vt-d: Fix sysfs leak in alloc_iommu()

commit 0ee74d5a48635c848c20f152d0d488bf84641304 upstream.

iommu_device_sysfs_add() is called before, so is has to be cleaned on subsequent
errors.

Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")
Cc: stable@vger.kernel.org # 4.11.x
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/17411490.HIIP88n32C@mobilepool36.emlix.com
Link: https://lore.kernel.org/r/20210525070802.361755-2-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/intel/dmar.c