aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r--drivers/gpu/drm/drm_fops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 13fdcd10a605..429e07d0b0f1 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -123,6 +123,7 @@ int drm_open(struct inode *inode, struct file *filp)
123 int retcode = 0; 123 int retcode = 0;
124 int need_setup = 0; 124 int need_setup = 0;
125 struct address_space *old_mapping; 125 struct address_space *old_mapping;
126 struct address_space *old_imapping;
126 127
127 minor = idr_find(&drm_minors_idr, minor_id); 128 minor = idr_find(&drm_minors_idr, minor_id);
128 if (!minor) 129 if (!minor)
@@ -137,6 +138,7 @@ int drm_open(struct inode *inode, struct file *filp)
137 if (!dev->open_count++) 138 if (!dev->open_count++)
138 need_setup = 1; 139 need_setup = 1;
139 mutex_lock(&dev->struct_mutex); 140 mutex_lock(&dev->struct_mutex);
141 old_imapping = inode->i_mapping;
140 old_mapping = dev->dev_mapping; 142 old_mapping = dev->dev_mapping;
141 if (old_mapping == NULL) 143 if (old_mapping == NULL)
142 dev->dev_mapping = &inode->i_data; 144 dev->dev_mapping = &inode->i_data;
@@ -159,8 +161,8 @@ int drm_open(struct inode *inode, struct file *filp)
159 161
160err_undo: 162err_undo:
161 mutex_lock(&dev->struct_mutex); 163 mutex_lock(&dev->struct_mutex);
162 filp->f_mapping = old_mapping; 164 filp->f_mapping = old_imapping;
163 inode->i_mapping = old_mapping; 165 inode->i_mapping = old_imapping;
164 iput(container_of(dev->dev_mapping, struct inode, i_data)); 166 iput(container_of(dev->dev_mapping, struct inode, i_data));
165 dev->dev_mapping = old_mapping; 167 dev->dev_mapping = old_mapping;
166 mutex_unlock(&dev->struct_mutex); 168 mutex_unlock(&dev->struct_mutex);