diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2015-03-10 02:46:08 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-04-14 03:00:49 -0400 |
commit | df16896b866a056da3c275cf416f6f4cc47934bd (patch) | |
tree | 0de2d391eee6fc2ade05bdaeedbdcfdb9558a7d6 /drivers/gpu | |
parent | b03eaa4d3428ebbc5e32e3595be6027e7d99942b (diff) |
drm/nouveau/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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c index fcba72eb74a3..dd0994d9ebfc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | |||
@@ -148,7 +148,7 @@ gk20a_instobj_dtor_dma(struct gk20a_instobj_priv *_node) | |||
148 | struct gk20a_instmem_priv *priv = (void *)nvkm_instmem(node); | 148 | struct gk20a_instmem_priv *priv = (void *)nvkm_instmem(node); |
149 | struct device *dev = nv_device_base(nv_device(priv)); | 149 | struct device *dev = nv_device_base(nv_device(priv)); |
150 | 150 | ||
151 | if (unlikely(!node->handle)) | 151 | if (unlikely(!node->cpuaddr)) |
152 | return; | 152 | return; |
153 | 153 | ||
154 | dma_free_attrs(dev, _node->mem->size << PAGE_SHIFT, node->cpuaddr, | 154 | dma_free_attrs(dev, _node->mem->size << PAGE_SHIFT, node->cpuaddr, |