aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fops.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2012-01-24 12:54:21 -0500
committerHerton Ronaldo Krzesinski <herton.krzesinski@canonical.com>2012-02-13 15:15:01 -0500
commitee728aa6aeba82d58e34c9569b200a82546eef58 (patch)
tree15418574b15893ca8f562c6e676828b7f98b55c4 /drivers/gpu/drm/drm_fops.c
parent86580cdc4d82039c2210799f10f6adfb21127724 (diff)
drm: Fix authentication kernel crash
BugLink: http://bugs.launchpad.net/bugs/926309 commit 598781d71119827b454fd75d46f84755bca6f0c6 upstream. If the master tries to authenticate a client using drm_authmagic and that client has already closed its drm file descriptor, either wilfully or because it was terminated, the call to drm_authmagic will dereference a stale pointer into kmalloc'ed memory and corrupt it. Typically this results in a hard system hang. This patch fixes that problem by removing any authentication tokens (struct drm_magic_entry) open for a file descriptor when that file descriptor is closed. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r--drivers/gpu/drm/drm_fops.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index fbd640dbf7e..c282f85c1c8 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -490,6 +490,11 @@ int drm_release(struct inode *inode, struct file *filp)
490 (long)old_encode_dev(file_priv->minor->device), 490 (long)old_encode_dev(file_priv->minor->device),
491 dev->open_count); 491 dev->open_count);
492 492
493 /* Release any auth tokens that might point to this file_priv,
494 (do that under the drm_global_mutex) */
495 if (file_priv->magic)
496 (void) drm_remove_magic(file_priv->master, file_priv->magic);
497
493 /* if the master has gone away we can't do anything with the lock */ 498 /* if the master has gone away we can't do anything with the lock */
494 if (file_priv->minor->master) 499 if (file_priv->minor->master)
495 drm_master_release(dev, filp); 500 drm_master_release(dev, filp);