drm/nouveau: protect ramht_find() from oopsing if on channel without ramht
authorBen Skeggs <bskeggs@redhat.com>
Fri, 3 Sep 2010 00:25:02 +0000 (10:25 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 24 Sep 2010 06:23:54 +0000 (16:23 +1000)
This doesn't actually happen now, but there's a test case for an earlier
kernel where a GPU error is signalled on one of nv50's fake channels, and
the ramht lookup by the IRQ handler triggered an oops.

This adds a check for RAMHT's existance on a channel before looking up
an object handle.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_ramht.c

index de34b6bb059f5789cdcf2fd83a3dcac1506bb664..f240ba2419434182884f508f2d9551764b3fd964 100644 (file)
@@ -197,6 +197,9 @@ nouveau_ramht_find(struct nouveau_channel *chan, u32 handle)
        struct nouveau_gpuobj *gpuobj = NULL;
        unsigned long flags;
 
+       if (unlikely(!chan->ramht))
+               return NULL;
+
        spin_lock_irqsave(&ramht->lock, flags);
        list_for_each_entry(entry, &chan->ramht->entries, head) {
                if (entry->channel == chan && entry->handle == handle) {