[Intel-gfx] [PATCH v2] drm/i915/gvt: clean up intel_gvt.h as interface for i915 core

Zhenyu Wang zhenyuw at linux.intel.com
Thu Oct 20 08:10:17 UTC 2016


On 2016.10.20 09:12:02 +0100, Chris Wilson wrote:
> On Thu, Oct 20, 2016 at 04:02:39PM +0800, Zhenyu Wang wrote:
> >  void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
> >  {
> > -	struct intel_gvt *gvt = &dev_priv->gvt;
> > +	struct intel_gvt *gvt = to_gvt(dev_priv);
> >  
> >  	if (WARN_ON(!gvt->initialized))
> >  		return;
> > @@ -188,6 +189,8 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
> >  	intel_gvt_clean_mmio_info(gvt);
> >  	intel_gvt_free_firmware(gvt);
> >  
> > +	kfree(dev_priv->gvt);
> > +	dev_priv->gvt = NULL;
> >  	gvt->initialized = false;
> >  }
> 
> Whoops. First a NULL pointer deref then a use-after-free before coffee.
> I need coffee!
> 
> Just remove struct intel_gvt.initialized, it is leading you astray.

oops! sorry about that...

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20161020/aeee28ba/attachment.sig>


More information about the Intel-gfx mailing list