Skip to content

Commit 935a92a

Browse files
Aleksandr Mishinrobertfoss
authored andcommitted
drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference
In cdns_mhdp_atomic_enable(), the return value of drm_mode_duplicate() is assigned to mhdp_state->current_mode, and there is a dereference of it in drm_mode_set_name(), which will lead to a NULL pointer dereference on failure of drm_mode_duplicate(). Fix this bug add a check of mhdp_state->current_mode. Fixes: fb43aa0 ("drm: bridge: Add support for Cadence MHDP8546 DPI/DP bridge") Signed-off-by: Aleksandr Mishin <[email protected]> Reviewed-by: Robert Foss <[email protected]> Signed-off-by: Robert Foss <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 325af1b commit 935a92a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,6 +2059,9 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge,
20592059
mhdp_state = to_cdns_mhdp_bridge_state(new_state);
20602060

20612061
mhdp_state->current_mode = drm_mode_duplicate(bridge->dev, mode);
2062+
if (!mhdp_state->current_mode)
2063+
return;
2064+
20622065
drm_mode_set_name(mhdp_state->current_mode);
20632066

20642067
dev_dbg(mhdp->dev, "%s: Enabling mode %s\n", __func__, mode->name);

0 commit comments

Comments
 (0)