Subject: CVE-2021-47177: iommu/vt-d: Fix sysfs leak in alloc_iommu()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

iommu/vt-d: Fix sysfs leak in alloc_iommu()

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

The Linux kernel CVE team has assigned CVE-2021-47177 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.11 with commit 39ab9555c241 and fixed in 4.14.235 with commit 22da9f497838
	Issue introduced in 4.11 with commit 39ab9555c241 and fixed in 4.19.193 with commit 2ec5e9bb6b05
	Issue introduced in 4.11 with commit 39ab9555c241 and fixed in 5.4.124 with commit 044bbe8b92ab
	Issue introduced in 4.11 with commit 39ab9555c241 and fixed in 5.10.42 with commit f01134321d04
	Issue introduced in 4.11 with commit 39ab9555c241 and fixed in 5.12.9 with commit ca466561eef3
	Issue introduced in 4.11 with commit 39ab9555c241 and fixed in 5.13 with commit 0ee74d5a4863

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-47177
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/iommu/intel/dmar.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/22da9f4978381a99f1abaeaf6c9b83be6ab5ddd8
	https://git.kernel.org/stable/c/2ec5e9bb6b0560c90d315559c28a99723c80b996
	https://git.kernel.org/stable/c/044bbe8b92ab4e542de7f6c93c88ea65cccd8e29
	https://git.kernel.org/stable/c/f01134321d04f47c718bb41b799bcdeda27873d2
	https://git.kernel.org/stable/c/ca466561eef36d1ec657673e3944eb6340bddb5b
	https://git.kernel.org/stable/c/0ee74d5a48635c848c20f152d0d488bf84641304