[PATCH v2] drm: Do not call drm_dev_unregister twice on drm_unplug_dev

Daniel Vetter daniel at ffwll.ch
Mon May 29 19:04:07 UTC 2017


On Mon, May 29, 2017 at 09:02:38PM +0200, Daniel Vetter wrote:
> On Sun, May 28, 2017 at 07:16:55PM +0200, Hans de Goede wrote:
> > Since commit a39be606f99d ("drm: Do a full device unregister when
> > unplugging") drm_unplug_dev has been calling drm_dev_unregister followed
> > by a drm_put_dev when open_count reaches 0. This drm_put_dev calls
> > drm_dev_unregister again. Since drm_dev_unregister is not protected
> > against being called multiple times this leads to havoc.
> > 
> > This commit fixes this by calling drm_dev_unref instead of drm_put_dev.
> > 
> > Fixes: a39be606f99d ("drm: Do a full device unregister when unplugging")
> > Cc: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Marco Diego Aurélio Mesquita <marcodiegomesquita at gmail.com>
> > Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita at gmail.com>
> > Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> > ---
> > Note I don't have any USB display devices at hand for testing atm so
> > this patch has only been compile tested.
> > ---
> > Changes in v2:
> > -Remove unnecessary mutex changes
> 
> Offending patch is in 4.8 ... do we need cc: stable? Does this need a
> bugreport link?

One more: When fixing a regression pls cc author/reviewer of the offending
patch, for the learning. Adding Chris.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list