Skip to content

Commit 9a0c1e2

Browse files
ickledanvet
authored andcommitted
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 efab6d8 Author: Chris Wilson <[email protected]> Date: Tue Apr 7 16:20:57 2015 +0100 drm/i915: Use a separate slab for requests Signed-off-by: Chris Wilson <[email protected]> Cc: Daniel Vetter <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent 225c228 commit 9a0c1e2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,24 +2653,24 @@ int i915_gem_request_alloc(struct intel_engine_cs *ring,
26532653
req->i915 = dev_priv;
26542654

26552655
ret = i915_gem_get_seqno(ring->dev, &req->seqno);
2656-
if (ret) {
2657-
kfree(req);
2658-
return ret;
2659-
}
2656+
if (ret)
2657+
goto err;
26602658

26612659
req->ring = ring;
26622660

26632661
if (i915.enable_execlists)
26642662
ret = intel_logical_ring_alloc_request_extras(req, ctx);
26652663
else
26662664
ret = intel_ring_alloc_request_extras(req);
2667-
if (ret) {
2668-
kfree(req);
2669-
return ret;
2670-
}
2665+
if (ret)
2666+
goto err;
26712667

26722668
ring->outstanding_lazy_request = req;
26732669
return 0;
2670+
2671+
err:
2672+
kmem_cache_free(dev_priv->requests, req);
2673+
return ret;
26742674
}
26752675

26762676
struct drm_i915_gem_request *

0 commit comments

Comments
 (0)