Skip to content

Commit 72de182

Browse files
imirkintorvalds
authored andcommitted
drm/nouveau/mxm: fix null deref on load
Since commit 61b365a ("drm/nouveau: populate master subdev pointer only when fully constructed"), the nouveau_mxm(bios) call will return NULL, since it's still being called from the constructor. Instead, pass the mxm pointer via the unused data field. See https://bugs.freedesktop.org/show_bug.cgi?id=73791 Reported-by: Andreas Reis <[email protected]> Tested-by: Andreas Reis <[email protected]> Signed-off-by: Ilia Mirkin <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Dave Airlie <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 4d93540 commit 72de182

File tree

1 file changed

+2
-2
lines changed
  • drivers/gpu/drm/nouveau/core/subdev/mxm

1 file changed

+2
-2
lines changed

drivers/gpu/drm/nouveau/core/subdev/mxm/nv50.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ mxm_match_dcb(struct nouveau_mxm *mxm, u8 *data, void *info)
100100
static int
101101
mxm_dcb_sanitise_entry(struct nouveau_bios *bios, void *data, int idx, u16 pdcb)
102102
{
103-
struct nouveau_mxm *mxm = nouveau_mxm(bios);
103+
struct nouveau_mxm *mxm = data;
104104
struct context ctx = { .outp = (u32 *)(bios->data + pdcb) };
105105
u8 type, i2cidx, link, ver, len;
106106
u8 *conn;
@@ -199,7 +199,7 @@ mxm_dcb_sanitise(struct nouveau_mxm *mxm)
199199
return;
200200
}
201201

202-
dcb_outp_foreach(bios, NULL, mxm_dcb_sanitise_entry);
202+
dcb_outp_foreach(bios, mxm, mxm_dcb_sanitise_entry);
203203
mxms_foreach(mxm, 0x01, mxm_show_unmatched, NULL);
204204
}
205205

0 commit comments

Comments
 (0)