summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-20 18:55:44 +0200
committerDave Airlie <airlied@redhat.com>2013-11-06 14:53:24 +1000
commitf67e946bf215f05be51f5579fcfc164c01b9c4f2 (patch)
treebdca814cfcdb52c7ea3398a09cbcc7b206ae6b74 /drivers/gpu/drm/drm_stub.c
parent865fb47f7f9aa1a1be2ce6a1d37af98f8d4a0d04 (diff)
downloadblackbird-op-linux-f67e946bf215f05be51f5579fcfc164c01b9c4f2.tar.gz
blackbird-op-linux-f67e946bf215f05be51f5579fcfc164c01b9c4f2.zip
drm: remove minor-id during unplug
Don't delay minor removal to drm_put_minor(). Otherwise, user-space can still open the minor and cause the kernel to oops. Instead, remove the minor during unplug so any new open() will fail to access this minor. Note that open() and drm_unplug_minor() are both protected by the global DRM mutex so we're fine. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r--drivers/gpu/drm/drm_stub.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index b37b0d99f262..e7c31e859b6b 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -346,6 +346,7 @@ static void drm_unplug_minor(struct drm_minor *minor)
#endif
drm_sysfs_device_remove(minor);
+ idr_remove(&drm_minors_idr, minor->index);
}
/**
@@ -365,9 +366,6 @@ static void drm_put_minor(struct drm_minor *minor)
DRM_DEBUG("release secondary minor %d\n", minor->index);
drm_unplug_minor(minor);
-
- idr_remove(&drm_minors_idr, minor->index);
-
kfree(minor);
}
OpenPOWER on IntegriCloud