[PATCH] iommu: fix the release function of iommu_class

From: Sebastian Ott
Date: Fri Aug 11 2017 - 13:04:00 EST


The release function of iommu_class must not only free the device
structure it gets called with but the whole structure the device
is embedded in - struct iommu_device.

Signed-off-by: Sebastian Ott <sebott@xxxxxxxxxxxxxxxxxx>
---
drivers/iommu/iommu-sysfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu-sysfs.c b/drivers/iommu/iommu-sysfs.c
index c58351e..b65a501 100644
--- a/drivers/iommu/iommu-sysfs.c
+++ b/drivers/iommu/iommu-sysfs.c
@@ -34,7 +34,9 @@ static const struct attribute_group *iommu_dev_groups[] = {

static void iommu_release_device(struct device *dev)
{
- kfree(dev);
+ struct iommu_device *iommu = container_of(dev, struct iommu_device, dev);
+
+ kfree(iommu);
}

static struct class iommu_class = {
--
2.5.5