summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorNatalia Petrova <n.petrova@fintech.ru>2023-05-12 13:33:20 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-21 15:44:12 +0200
commit0456f470fa023e9c31e0bc78e8c31eccfbea0f91 (patch)
treef57a1f5df062ab58cdf397eb70ffe530dc5e2aad /drivers/gpu
parentb1d76d16af2a2bc8946cc6fe0668b21b03d5f0ca (diff)
downloadlinux-stable-0456f470fa023e9c31e0bc78e8c31eccfbea0f91.tar.gz
linux-stable-0456f470fa023e9c31e0bc78e8c31eccfbea0f91.tar.bz2
linux-stable-0456f470fa023e9c31e0bc78e8c31eccfbea0f91.zip
drm/nouveau: add nv_encoder pointer check for NULL
[ Upstream commit 55b94bb8c42464bad3d2217f6874aa1a85664eac ] Pointer nv_encoder could be dereferenced at nouveau_connector.c in case it's equal to NULL by jumping to goto label. This patch adds a NULL-check to avoid it. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 3195c5f9784a ("drm/nouveau: set encoder for lvds") Signed-off-by: Natalia Petrova <n.petrova@fintech.ru> Reviewed-by: Lyude Paul <lyude@redhat.com> [Fixed patch title] Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230512103320.82234-1-n.petrova@fintech.ru Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 048a04701910..85a20fe2709a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -730,7 +730,8 @@ out:
#endif
nouveau_connector_set_edid(nv_connector, edid);
- nouveau_connector_set_encoder(connector, nv_encoder);
+ if (nv_encoder)
+ nouveau_connector_set_encoder(connector, nv_encoder);
return status;
}