forked from Minki/linux
drm/i915: Use the correct destructor for freeing requests on error
After allocating from the slab cache, we then need to free the request
back into the slab cache upon error (and not call kfree as that leads
to eventual memory corruption).
Fixes regression from
commit efab6d8dd1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Tue Apr 7 16:20:57 2015 +0100
drm/i915: Use a separate slab for requests
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
225c228a02
commit
9a0c1e2770
@ -2653,10 +2653,8 @@ int i915_gem_request_alloc(struct intel_engine_cs *ring,
|
|||||||
req->i915 = dev_priv;
|
req->i915 = dev_priv;
|
||||||
|
|
||||||
ret = i915_gem_get_seqno(ring->dev, &req->seqno);
|
ret = i915_gem_get_seqno(ring->dev, &req->seqno);
|
||||||
if (ret) {
|
if (ret)
|
||||||
kfree(req);
|
goto err;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
req->ring = ring;
|
req->ring = ring;
|
||||||
|
|
||||||
@ -2664,13 +2662,15 @@ int i915_gem_request_alloc(struct intel_engine_cs *ring,
|
|||||||
ret = intel_logical_ring_alloc_request_extras(req, ctx);
|
ret = intel_logical_ring_alloc_request_extras(req, ctx);
|
||||||
else
|
else
|
||||||
ret = intel_ring_alloc_request_extras(req);
|
ret = intel_ring_alloc_request_extras(req);
|
||||||
if (ret) {
|
if (ret)
|
||||||
kfree(req);
|
goto err;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ring->outstanding_lazy_request = req;
|
ring->outstanding_lazy_request = req;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err:
|
||||||
|
kmem_cache_free(dev_priv->requests, req);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct drm_i915_gem_request *
|
struct drm_i915_gem_request *
|
||||||
|
Loading…
Reference in New Issue
Block a user