diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-06-12 22:23:35 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-06-23 02:04:03 -0400 |
commit | bf08bcc6b7260db8eb5ef389e060e4b12bf10cae (patch) | |
tree | 807aaa99cd3c90069c40398beb3e5aa781d04edf /drivers/gpu/drm/nouveau/nouveau_object.c | |
parent | 24f246ac10ae6a6ae873045387d4501498869f74 (diff) |
drm/nouveau: fix null pointer deref on pre-nv50 chipsets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_object.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_object.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 542b451c81f1..fb57c1110d24 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -870,16 +870,22 @@ void | |||
870 | nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan) | 870 | nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan) |
871 | { | 871 | { |
872 | struct drm_device *dev = chan->dev; | 872 | struct drm_device *dev = chan->dev; |
873 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
873 | int i; | 874 | int i; |
874 | 875 | ||
875 | NV_DEBUG(dev, "ch%d\n", chan->id); | 876 | NV_DEBUG(dev, "ch%d\n", chan->id); |
876 | 877 | ||
877 | for (i = 0; i < 2; i++) { | 878 | if (dev_priv->card_type >= NV_50) { |
878 | struct nv50_display_crtc *dispc = &nv50_display(dev)->crtc[i]; | 879 | struct nv50_display *disp = nv50_display(dev); |
879 | nouveau_bo_vma_del(dispc->sem.bo, &chan->dispc_vma[i]); | 880 | |
881 | for (i = 0; i < 2; i++) { | ||
882 | struct nv50_display_crtc *dispc = &disp->crtc[i]; | ||
883 | nouveau_bo_vma_del(dispc->sem.bo, &chan->dispc_vma[i]); | ||
884 | } | ||
885 | |||
886 | nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); | ||
887 | nouveau_gpuobj_ref(NULL, &chan->vm_pd); | ||
880 | } | 888 | } |
881 | nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); | ||
882 | nouveau_gpuobj_ref(NULL, &chan->vm_pd); | ||
883 | 889 | ||
884 | if (drm_mm_initialized(&chan->ramin_heap)) | 890 | if (drm_mm_initialized(&chan->ramin_heap)) |
885 | drm_mm_takedown(&chan->ramin_heap); | 891 | drm_mm_takedown(&chan->ramin_heap); |