Skip to content

Commit

Permalink
drm/nouveau/mxm: fix null deref on load
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
imirkin authored and torvalds committed Jan 20, 2014
1 parent 4d93540 commit 72de182
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/nouveau/core/subdev/mxm/nv50.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ mxm_match_dcb(struct nouveau_mxm *mxm, u8 *data, void *info)
static int
mxm_dcb_sanitise_entry(struct nouveau_bios *bios, void *data, int idx, u16 pdcb)
{
struct nouveau_mxm *mxm = nouveau_mxm(bios);
struct nouveau_mxm *mxm = data;
struct context ctx = { .outp = (u32 *)(bios->data + pdcb) };
u8 type, i2cidx, link, ver, len;
u8 *conn;
Expand Down Expand Up @@ -199,7 +199,7 @@ mxm_dcb_sanitise(struct nouveau_mxm *mxm)
return;
}

dcb_outp_foreach(bios, NULL, mxm_dcb_sanitise_entry);
dcb_outp_foreach(bios, mxm, mxm_dcb_sanitise_entry);
mxms_foreach(mxm, 0x01, mxm_show_unmatched, NULL);
}

Expand Down

0 comments on commit 72de182

Please sign in to comment.