Skip to contentSkip to conversation

Fix null dereference oopses for nv40 cards

PATCH New Bob Gleitsmann 1 participant 1 message Jan 13, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix null dereference oopses for nv40 cards

The problem affects nv40 cards during booting. It comes from there being two places where subdev arrays are maintained. A commit was recently added to make the two equal. However, the struct nouveau_device version ends up being referenced before it is initialized. The problem arises during the creation of the INSTMEM and THERM subdevs. '

Signed off by: Bob Gleitsmann [email protected]

drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c +2 -0
index b10a143..0f494ca 100644
@@ -23,6 +23,7 @@
  */
 
 #include <engine/graph/nv40.h>
+#include <core/device.h>
 
 #include "nv04.h"
 
@@ -38,6 +39,7 @@ nv40_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
 
 	ret = nouveau_instmem_create(parent, engine, oclass, &priv);
 	*pobject = nv_object(priv);
+	device->subdev[NVDEV_SUBDEV_INSTMEM] = *pobject;
 	if (ret)
 		return ret;
 
drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c +2 -0
index 002e51b..59b25be 100644
@@ -187,9 +187,11 @@ nv40_therm_ctor(struct nouveau_object *parent,
 {
 	struct nv40_therm_priv *priv;
 	int ret;
+	struct nouveau_device *device = nv_device(parent);
 
 	ret = nouveau_therm_create(parent, engine, oclass, &priv);
 	*pobject = nv_object(priv);
+	device->subdev[NVDEV_SUBDEV_THERM] = *pobject;
 	if (ret)
 		return ret;