[Nouveau] [PATCH v4 34/37] mc: fix NULL pointer access in libnouveau

Karol Herbst nouveau at karolherbst.de
Mon Apr 18 19:14:08 UTC 2016


Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
---
 drm/nouveau/nvkm/subdev/mc/base.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drm/nouveau/nvkm/subdev/mc/base.c b/drm/nouveau/nvkm/subdev/mc/base.c
index aa394af..88bc1cc 100644
--- a/drm/nouveau/nvkm/subdev/mc/base.c
+++ b/drm/nouveau/nvkm/subdev/mc/base.c
@@ -90,10 +90,15 @@ nvkm_mc_intr(struct nvkm_mc *mc, bool *handled)
 void
 nvkm_mc_reset(struct nvkm_mc *mc, enum nvkm_devidx devidx)
 {
-	struct nvkm_device *device = mc->subdev.device;
+	struct nvkm_device *device;
 	const struct nvkm_mc_map *map;
 	u64 pmc_enable;
 
+	if (!mc)
+		return;
+
+	device = mc->subdev.device;
+
 	if (!(pmc_enable = nvkm_top_reset(device->top, devidx))) {
 		for (map = mc->func->reset; map && map->stat; map++) {
 			if (map->unit == devidx) {
-- 
2.8.1



More information about the Nouveau mailing list