]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit - include/linux/iommu.h
iommu: Fix wrong freeing of iommu_device->dev
authorJoerg Roedel <jroedel@suse.de>
Mon, 14 Aug 2017 15:19:26 +0000 (17:19 +0200)
committerJoerg Roedel <jroedel@suse.de>
Tue, 15 Aug 2017 11:58:48 +0000 (13:58 +0200)
commit2926a2aa5c14fb2add75e6584845b1c03022235f
treeb3137193fd966c32608ffd2adedfdcec1a2671ad
parenta7990c647b35415e3dd07a077480a908678947ba
iommu: Fix wrong freeing of iommu_device->dev

The struct iommu_device has a 'struct device' embedded into
it, not as a pointer, but the whole struct. In the
conversion of the iommu drivers to use struct iommu_device
it was forgotten that the relase function for that struct
device simply calls kfree() on the pointer.

This frees memory that was never allocated and causes memory
corruption.

To fix this issue, use a pointer to struct device instead of
embedding the whole struct. This needs some updates in the
iommu sysfs code as well as the Intel VT-d and AMD IOMMU
driver.

Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Fixes: 39ab9555c241 ('iommu: Add sysfs bindings for struct iommu_device')
Cc: stable@vger.kernel.org # >= v4.11
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu_types.h
drivers/iommu/intel-iommu.c
drivers/iommu/iommu-sysfs.c
include/linux/iommu.h