All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Xiong <james.xiong@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, "Xiong, James" <james.xiong@intel.com>
Subject: [PATCH 1/1] change the order to cleanup drm_property_blob after drm_crtc
Date: Wed, 13 Apr 2016 11:09:06 -0700	[thread overview]
Message-ID: <1460570946-19126-1-git-send-email-james.xiong@intel.com> (raw)

From: "Xiong, James" <james.xiong@intel.com>

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.

Signed-off-by: Xiong, James <james.xiong@intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 30fea23..c93576a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-04-13 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 18:09 James Xiong [this message]
2016-04-20 23:04 ` [PATCH 1/1] change the order to cleanup drm_property_blob after drm_crtc Xiong, James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460570946-19126-1-git-send-email-james.xiong@intel.com \
    --to=james.xiong@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.