Avoid NULL master_priv access in i915 kernel driver
authorStuart Abercrombie <sabercrombie@chromium.org>
Fri, 10 May 2013 22:11:02 +0000 (15:11 -0700)
committerChromeBot <chrome-bot@google.com>
Sat, 11 May 2013 01:15:27 +0000 (18:15 -0700)
commit3d600f4ae5d113cc8a90abce8d9ac9662c50702b
tree246c89dc6756b42667ae44108d1d35a3823aa48f
parentf16c9ce74ddbc800df6aa65fa46afbf417f92873
Avoid NULL master_priv access in i915 kernel driver

In several places, including the interrupt handler, the driver assumes
it can deref. dev->primary->master->driver_priv if dev->primary->master
is non-NULL.  This wasn't true if drm_open_helper was midway through, so
rearrange the initialization order.

It looks as if http://crbug.com/221684 was caused by this, although I
have no direct repro.  I can produce the same kernel crash by adding a
delay to drm_open_helper and unplugging the monitor at the right time.

v2: Address this in drm_open_helper instead of the various access points --
basically Stephane's fix.

BUG=chromium:221684
TEST=The monitor unplug scenario doesn't bring down Link
Change-Id: I545f79422577cfe4cdd96e430b6bc902ccb1cab3
Reviewed-on: https://gerrit.chromium.org/gerrit/50407
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stuart Abercrombie <sabercrombie@chromium.org>
Tested-by: Stuart Abercrombie <sabercrombie@chromium.org>
drivers/gpu/drm/drm_fops.c