summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2015-03-10 15:46:08 +0900
committerBen Skeggs <bskeggs@redhat.com>2015-04-13 15:53:45 +1000
commit6ff98b6e43ae85663bbe17372ed631d87210dc1a (patch)
treec14119aeb83e5a67dbb1ac20b2a4aee497eaf9c1
parent596a72768a551695ac7ba34b113727b2c379cc97 (diff)
downloadnouveau-6ff98b6e43ae85663bbe17372ed631d87210dc1a.tar.gz
instmem/gk20a: fix crash during error path
If a memory allocation fails when using the DMA allocator, gk20a_instobj_dtor_dma() will be called on the failed instmem object. At this time, node->handle might not be NULL despite the call to dma_alloc_attrs() having failed. node->cpuaddr is the right member to check for such a failure, so use it instead. Reported-by: Vince Hsu <vinceh@nvidia.com> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drm/nouveau/nvkm/subdev/instmem/gk20a.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drm/nouveau/nvkm/subdev/instmem/gk20a.c
index fcba72eb7..dd0994d9e 100644
--- a/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -148,7 +148,7 @@ gk20a_instobj_dtor_dma(struct gk20a_instobj_priv *_node)
struct gk20a_instmem_priv *priv = (void *)nvkm_instmem(node);
struct device *dev = nv_device_base(nv_device(priv));
- if (unlikely(!node->handle))
+ if (unlikely(!node->cpuaddr))
return;
dma_free_attrs(dev, _node->mem->size << PAGE_SHIFT, node->cpuaddr,