diff options
-rw-r--r-- | drivers/gpu/drm/drm_auth.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 5 | ||||
-rw-r--r-- | include/drm/drmP.h | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c index 3f46772f0cb2..ba23790450e9 100644 --- a/drivers/gpu/drm/drm_auth.c +++ b/drivers/gpu/drm/drm_auth.c | |||
@@ -101,7 +101,7 @@ static int drm_add_magic(struct drm_master *master, struct drm_file *priv, | |||
101 | * Searches and unlinks the entry in drm_device::magiclist with the magic | 101 | * Searches and unlinks the entry in drm_device::magiclist with the magic |
102 | * number hash key, while holding the drm_device::struct_mutex lock. | 102 | * number hash key, while holding the drm_device::struct_mutex lock. |
103 | */ | 103 | */ |
104 | static int drm_remove_magic(struct drm_master *master, drm_magic_t magic) | 104 | int drm_remove_magic(struct drm_master *master, drm_magic_t magic) |
105 | { | 105 | { |
106 | struct drm_magic_entry *pt; | 106 | struct drm_magic_entry *pt; |
107 | struct drm_hash_item *hash; | 107 | struct drm_hash_item *hash; |
@@ -136,6 +136,8 @@ static int drm_remove_magic(struct drm_master *master, drm_magic_t magic) | |||
136 | * If there is a magic number in drm_file::magic then use it, otherwise | 136 | * If there is a magic number in drm_file::magic then use it, otherwise |
137 | * searches an unique non-zero magic number and add it associating it with \p | 137 | * searches an unique non-zero magic number and add it associating it with \p |
138 | * file_priv. | 138 | * file_priv. |
139 | * This ioctl needs protection by the drm_global_mutex, which protects | ||
140 | * struct drm_file::magic and struct drm_magic_entry::priv. | ||
139 | */ | 141 | */ |
140 | int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) | 142 | int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) |
141 | { | 143 | { |
@@ -173,6 +175,8 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
173 | * \return zero if authentication successed, or a negative number otherwise. | 175 | * \return zero if authentication successed, or a negative number otherwise. |
174 | * | 176 | * |
175 | * Checks if \p file_priv is associated with the magic number passed in \arg. | 177 | * Checks if \p file_priv is associated with the magic number passed in \arg. |
178 | * This ioctl needs protection by the drm_global_mutex, which protects | ||
179 | * struct drm_file::magic and struct drm_magic_entry::priv. | ||
176 | */ | 180 | */ |
177 | int drm_authmagic(struct drm_device *dev, void *data, | 181 | int drm_authmagic(struct drm_device *dev, void *data, |
178 | struct drm_file *file_priv) | 182 | struct drm_file *file_priv) |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index c00cf154cc0b..6263b0147598 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -487,6 +487,11 @@ int drm_release(struct inode *inode, struct file *filp) | |||
487 | (long)old_encode_dev(file_priv->minor->device), | 487 | (long)old_encode_dev(file_priv->minor->device), |
488 | dev->open_count); | 488 | dev->open_count); |
489 | 489 | ||
490 | /* Release any auth tokens that might point to this file_priv, | ||
491 | (do that under the drm_global_mutex) */ | ||
492 | if (file_priv->magic) | ||
493 | (void) drm_remove_magic(file_priv->master, file_priv->magic); | ||
494 | |||
490 | /* if the master has gone away we can't do anything with the lock */ | 495 | /* if the master has gone away we can't do anything with the lock */ |
491 | if (file_priv->minor->master) | 496 | if (file_priv->minor->master) |
492 | drm_master_release(dev, filp); | 497 | drm_master_release(dev, filp); |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 76caa67c22e2..92f0981b5fb8 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1328,6 +1328,7 @@ extern int drm_getmagic(struct drm_device *dev, void *data, | |||
1328 | struct drm_file *file_priv); | 1328 | struct drm_file *file_priv); |
1329 | extern int drm_authmagic(struct drm_device *dev, void *data, | 1329 | extern int drm_authmagic(struct drm_device *dev, void *data, |
1330 | struct drm_file *file_priv); | 1330 | struct drm_file *file_priv); |
1331 | extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic); | ||
1331 | 1332 | ||
1332 | /* Cache management (drm_cache.c) */ | 1333 | /* Cache management (drm_cache.c) */ |
1333 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); | 1334 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |