]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference
authorAleksandr Mishin <amishin@t-argos.ru>
Mon, 8 Apr 2024 12:58:10 +0000 (15:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2024 07:49:37 +0000 (09:49 +0200)
commit32fb2ef124c3301656ac6c789a2ef35ef69a66da
tree6344aa0a908f3319e1a0c831260525468cd1c5c2
parent35d7aa6041c96e1c554e703f489d2518090f9493
drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference

[ Upstream commit 935a92a1c400285545198ca2800a4c6c519c650a ]

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: fb43aa0acdfd ("drm: bridge: Add support for Cadence MHDP8546 DPI/DP bridge")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240408125810.21899-1-amishin@t-argos.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c