Skip to contentSkip to conversation

change the order to cleanup drm_property_blob after drm_crtc

PATCH In review James Xiong 1 participant 2 messages Apr 13, 2016 – Apr 20, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 change the order to cleanup drm_property_blob after drm_crtc

From: "Xiong, James" <[email protected]>

Previously drm_mode_config_cleanup freed drm_property_blob first, then the drm_crtc which triggered unref calls to its associated drm_propery_blob, and could potentially cause memory corruption.

---
 drivers/gpu/drm/drm_crtc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_crtc.c +5 -5
index 30fea23..c93576a 100644
@@ -5950,11 +5950,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
 		drm_property_destroy(dev, property);
 	}
 
-	list_for_each_entry_safe(blob, bt, &dev->mode_config.property_blob_list,
-				 head_global) {
-		drm_property_unreference_blob(blob);
-	}
-
 	/*
 	 * Single-threaded teardown context, so it's not required to grab the
 	 * fb_lock to protect against concurrent fb_list access. Contrary, it
@@ -5977,6 +5972,11 @@ void drm_mode_config_cleanup(struct drm_device *dev)
 		crtc->funcs->destroy(crtc);
 	}
 
+	list_for_each_entry_safe(blob, bt, &dev->mode_config.property_blob_list,
+				head_global) {
+		drm_property_unreference_blob(blob);
+	}
+
 	ida_destroy(&dev->mode_config.connector_ida);
 	idr_destroy(&dev->mode_config.tile_idr);
 	idr_destroy(&dev->mode_config.crtc_idr);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Could someone please take a look and see if the change makes sense at all?

Thanks,
James

-----Original Message-----
From: Xiong, James
Sent: Wednesday, April 13, 2016 11:09 AM
To: [email protected]
Cc: [email protected]; Xiong, James <[email protected]>
Subject: [PATCH 1/1] change the order to cleanup drm_property_blob after drm_crtc

From: "Xiong, James" <[email protected]>

Previously drm_mode_config_cleanup freed drm_property_blob first, then the drm_crtc which triggered unref calls to its associated drm_propery_blob, and could potentially cause memory corruption.

---
 drivers/gpu/drm/drm_crtc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_crtc.c +0 -5
@@ -5950,11 +5950,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
 		drm_property_destroy(dev, property);
 	}
 
-	list_for_each_entry_safe(blob, bt, &dev->mode_config.property_blob_list,
-				 head_global) {
-		drm_property_unreference_blob(blob);
-	}
-
 	/*
 	 * Single-threaded teardown context, so it's not required to grab the
 	 * fb_lock to protect against concurrent fb_list access. Contrary, it @@ -5977,6 +5972,11 @@ void drm_mode_config_cleanup(struct drm_device *dev)

crtc->funcs->destroy(crtc);
}

+ list_for_each_entry_safe(blob, bt, &dev->mode_config.property_blob_list,
+ head_global) {
+ drm_property_unreference_blob(blob);
+ }
+
ida_destroy(&dev->mode_config.connector_ida); idr_destroy(&dev->mode_config.tile_idr); idr_destroy(&dev->mode_config.crtc_idr);
--
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx