drm/nouveau/disp/nv50-: prevent oops when no channel method map provided
authorBen Skeggs <bskeggs@redhat.com>
Tue, 28 Jan 2020 04:39:26 +0000 (14:39 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Feb 2020 14:42:39 +0000 (15:42 +0100)
[ Upstream commit 0e6176c6d286316e9431b4f695940cfac4ffe6c2 ]

The implementations for most channel types contains a map of methods to
priv registers in order to provide debugging info when a disp exception
has been raised.

This info is missing from the implementation of PIO channels as they're
rather simplistic already, however, if an exception is raised by one of
them, we'd end up triggering a NULL-pointer deref.  Not ideal...

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206299
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c

index 9d90d8b4b7e65398bd91c903cebf6ee046375825..f5a8db1bb8b7271c0407460b835e328807771af1 100644 (file)
@@ -72,6 +72,8 @@ nv50_disp_chan_mthd(struct nv50_disp_chan *chan, int debug)
 
        if (debug > subdev->debug)
                return;
+       if (!mthd)
+               return;
 
        for (i = 0; (list = mthd->data[i].mthd) != NULL; i++) {
                u32 base = chan->head * mthd->addr;