[ 3.5.y.z extended stable ] Patch "drm: restore open_count if drm_setup fails" has been added to staging queue

Herton Ronaldo Krzesinski herton.krzesinski at canonical.com
Thu Dec 6 03:24:04 UTC 2012


This is a note to let you know that I have just added a patch titled

    drm: restore open_count if drm_setup fails

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Herton

------

>From db85fe160824db367b870d2028a8932ac2eb5eab Mon Sep 17 00:00:00 2001
From: Ilija Hadzic <ilijahadzic at gmail.com>
Date: Mon, 29 Oct 2012 17:35:00 +0000
Subject: [PATCH] drm: restore open_count if drm_setup fails
X-Extended-Stable: 3.5

commit 0f1cb1bd94a9c967cd4ad3de51cfdabe61eb5dcc upstream.

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 at research.bell-labs.com>
Reviewed-by: Thomas Hellstrom <thellstrom at vmware.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski at canonical.com>
---
 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 123de28..b90abff 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -139,8 +139,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.9.5





More information about the kernel-team mailing list