All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm: restore open_count if drm_setup fails
@ 2012-10-29 17:35 Ilija Hadzic
  2012-10-29 17:35 ` [PATCH 2/2] drm: set dev_mapping before calling drm_open_helper Ilija Hadzic
  2012-10-30 13:51 ` [PATCH 1/2] drm: restore open_count if drm_setup fails Thomas Hellstrom
  0 siblings, 2 replies; 4+ messages in thread
From: Ilija Hadzic @ 2012-10-29 17:35 UTC (permalink / raw)
  To: dri-devel; +Cc: stable

If drm_setup (called at first open) fails, the whole
open call has failed, so we should not keep the
open_count incremented.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/drm_fops.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 7ef1b67..af68eca 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -135,8 +135,11 @@ int drm_open(struct inode *inode, struct file *filp)
 	retcode = drm_open_helper(inode, filp, dev);
 	if (!retcode) {
 		atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
-		if (!dev->open_count++)
+		if (!dev->open_count++) {
 			retcode = drm_setup(dev);
+			if (retcode)
+				dev->open_count--;
+		}
 	}
 	if (!retcode) {
 		mutex_lock(&dev->struct_mutex);
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-30 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-29 17:35 [PATCH 1/2] drm: restore open_count if drm_setup fails Ilija Hadzic
2012-10-29 17:35 ` [PATCH 2/2] drm: set dev_mapping before calling drm_open_helper Ilija Hadzic
2012-10-30 13:54   ` Thomas Hellstrom
2012-10-30 13:51 ` [PATCH 1/2] drm: restore open_count if drm_setup fails Thomas Hellstrom

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.