diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-06-14 08:17:23 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2019-07-10 17:17:14 +0200 |
commit | 4f5368b5541a902f6596558b05f5c21a9770dd32 (patch) | |
tree | 8630efb14338199c1333ca223d1d1a3b3d6bac3c /drivers/gpu/drm/drm_drv.c | |
parent | d006a9b63d4bbb3eb1e2e616712d45acfcda7042 (diff) | |
download | linux-4f5368b5541a902f6596558b05f5c21a9770dd32.tar.gz linux-4f5368b5541a902f6596558b05f5c21a9770dd32.tar.bz2 linux-4f5368b5541a902f6596558b05f5c21a9770dd32.zip |
drm/kms: Catch mode_object lifetime errors
Only dynamic mode objects, i.e. those which are refcounted and have a free
callback, can be added while the overall drm_device is visible to
userspace. All others must be added before drm_dev_register and
removed after drm_dev_unregister.
Small issue around drivers still using the load/unload callbacks, we
need to make sure we set dev->registered so that load/unload code in
these callbacks doesn't trigger false warnings. Only a small
adjustement in drm_dev_register was needed.
Motivated by some irc discussions about object ids of dynamic objects
like blobs become invalid, and me going on a bit an audit spree.
Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190614061723.1173-1-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index fe0ce86c280f..c1671ff0f1eb 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -990,14 +990,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) if (ret) goto err_minors; - dev->registered = true; - if (dev->driver->load) { ret = dev->driver->load(dev, flags); if (ret) goto err_minors; } + dev->registered = true; + if (drm_core_check_feature(dev, DRIVER_MODESET)) drm_modeset_register_all(dev); |