Hi Laurent, Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki On 2017-09-04 12:41, Laurent Pinchart wrote: > At the moment the memory is freed at .remove() time, which can lead to memory > corruption if a user has a handle on the device (for instance an open file > handle that is then close()d). Fixing this requires moving memory free to the > drm_driver::release() handler. devm_kzalloc() goes in the wrong direction. Ah, OK, so the current way is buggy as well. How do you plan to fix that? I think this should work: struct omap_drm_private { /* First member in the private struct! */ + struct drm_device ddev; ... }; Use drm_dev_init(&priv->ddev, ...); to initialize the drm_device instead of drm_dev_alloc() then priv->ddev.dev_private = priv; in this case the drm_dev_unref() would free up our omap_drm_private, right? I think this is what other DRM drivers are doing, not all, but i915 does this at least. But by the description most of the DRM drivers are doing this wrong, right? - Péter _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel