mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
drm/udl: add a release method and delay modeset teardown
commit 9b39b01303
upstream.
If we unplug a udl device, the usb callback with deinit the
mode_config struct, however userspace will still have an open
file descriptor and a framebuffer on that device. When userspace
closes the fd, we'll oops because it'll try and look stuff up
in the object idr which we've destroyed.
This punts destroying the mode objects until release time instead.
Cc: stable@vger.kernel.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190405031715.5959-2-airlied@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
753ff72679
commit
f7a46b61d3
3 changed files with 9 additions and 1 deletions
|
@ -47,6 +47,7 @@ static struct drm_driver driver = {
|
|||
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
|
||||
.load = udl_driver_load,
|
||||
.unload = udl_driver_unload,
|
||||
.release = udl_driver_release,
|
||||
|
||||
/* gem hooks */
|
||||
.gem_free_object = udl_gem_free_object,
|
||||
|
|
|
@ -101,6 +101,7 @@ void udl_urb_completion(struct urb *urb);
|
|||
|
||||
int udl_driver_load(struct drm_device *dev, unsigned long flags);
|
||||
void udl_driver_unload(struct drm_device *dev);
|
||||
void udl_driver_release(struct drm_device *dev);
|
||||
|
||||
int udl_fbdev_init(struct drm_device *dev);
|
||||
void udl_fbdev_cleanup(struct drm_device *dev);
|
||||
|
|
|
@ -378,6 +378,12 @@ void udl_driver_unload(struct drm_device *dev)
|
|||
udl_free_urb_list(dev);
|
||||
|
||||
udl_fbdev_cleanup(dev);
|
||||
udl_modeset_cleanup(dev);
|
||||
kfree(udl);
|
||||
}
|
||||
|
||||
void udl_driver_release(struct drm_device *dev)
|
||||
{
|
||||
udl_modeset_cleanup(dev);
|
||||
drm_dev_fini(dev);
|
||||
kfree(dev);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue