Skip to content

Commit

Permalink
gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_c…
Browse files Browse the repository at this point in the history
…onnector_set_property()

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>
  • Loading branch information
Jia-Ju Bai authored and Alex Deucher committed Aug 2, 2019
1 parent e3bf125 commit f3eb9b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/radeon/radeon_connectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ static int radeon_connector_set_property(struct drm_connector *connector, struct

radeon_encoder->output_csc = val;

if (connector->encoder->crtc) {
if (connector->encoder && connector->encoder->crtc) {
struct drm_crtc *crtc = connector->encoder->crtc;
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);

Expand Down

0 comments on commit f3eb9b8

Please sign in to comment.