gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_pro...
authorJia-Ju Bai <baijiaju1990@gmail.com>
Mon, 29 Jul 2019 08:36:44 +0000 (16:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2019 16:53:09 +0000 (18:53 +0200)
commit59a8932a1fb63abb00a9e2cb6781d031d45b7c99
tree4a295f0b9f731a92cc2e1acc957fe99cbe18c2b0
parent96aed711d302f50162c4a25762e2fde6bf189396
gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_property()

[ Upstream commit f3eb9b8f67bc28783eddc142ad805ebdc53d6339 ]

In radeon_connector_set_property(), there is an if statement on line 743
to check whether connector->encoder is NULL:
    if (connector->encoder)

When connector->encoder is NULL, it is used on line 755:
    if (connector->encoder->crtc)

Thus, a possible null-pointer dereference may occur.

To fix this bug, connector->encoder is checked before being used.

This bug is found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/radeon/radeon_connectors.c