diff mbox series

[3/6] Revert "drm/ttm: Fix bo_global and mem_global kfree error"

Message ID 20190416003523.5069-4-kherbst@redhat.com (mailing list archive)
State New, archived
Headers show
Series Fix crash after reloading a driver using ttm | expand

Commit Message

Karol Herbst April 16, 2019, 12:35 a.m. UTC
This reverts commit 30f33126feca0fe16df9e9302ffc28a953e2eb37.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c     | 1 +
 drivers/gpu/drm/ttm/ttm_memory.c | 9 +++++++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 57c89161b5c6..6941562ef2fa 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1528,6 +1528,7 @@  static void ttm_bo_global_kobj_release(struct kobject *kobj)
 		container_of(kobj, struct ttm_bo_global, kobj);
 
 	__free_page(glob->dummy_read_page);
+	kfree(glob);
 }
 
 void ttm_bo_global_release(void)
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index f1567c353b54..7704e17c402f 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -219,6 +219,14 @@  static ssize_t ttm_mem_global_store(struct kobject *kobj,
 	return size;
 }
 
+static void ttm_mem_global_kobj_release(struct kobject *kobj)
+{
+	struct ttm_mem_global *glob =
+		container_of(kobj, struct ttm_mem_global, kobj);
+
+	kfree(glob);
+}
+
 static struct attribute *ttm_mem_global_attrs[] = {
 	&ttm_mem_global_lower_mem_limit,
 	NULL
@@ -230,6 +238,7 @@  static const struct sysfs_ops ttm_mem_global_ops = {
 };
 
 static struct kobj_type ttm_mem_glob_kobj_type = {
+	.release = &ttm_mem_global_kobj_release,
 	.sysfs_ops = &ttm_mem_global_ops,
 	.default_attrs = ttm_mem_global_attrs,
 };