[PATCH 02/51] drm/i915: Don't clear drvdata in ->release
Daniel Vetter
daniel.vetter at ffwll.ch
Sat Feb 22 09:48:33 UTC 2020
On Fri, Feb 21, 2020 at 10:36 PM Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Quoting Daniel Vetter (2020-02-21 21:02:30)
> > For two reasons:
> >
> > - The driver core clears this already for us after we're unloaded in
> > __device_release_driver().
>
> Even if we abort before loading?
>
> History notes that i915_pci_remove was called with a stale pointer on
> error.
So even if there's a bug we still have the problem that clearing the
pci_drvdata in our drm_driver->release hook is way too late. You could
already have bound a new driver to the underlying device. So if driver
core doesn't clear drvdata on bind failure and we need to clear this
ourselves, then this line here could actually clear the drvdata of the
next driver instance bound to the pci device. Not that that's ever
going to happen outside of very contrived testing.
But looking at really_probe() in base/dd.c we do clear drvdata on
failure. So no idea how/why that stale drvdata came to be. Anyway
that's kinda why I cc'ed Greg, so he could confirm that this is
correct.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the dri-devel
mailing list