diff options
author | Daniel Martin <consume.noise@gmail.com> | 2017-11-20 10:47:41 +0100 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2018-03-02 12:02:43 +0100 |
commit | 10054b6c3d9a755b30abb43020121b9631fa296d (patch) | |
tree | daccc414802dcf483b8d22539a7a8565ca58df61 | |
parent | fb58e06acd6c6bd59de2dbdadbca27eb1dd0025b (diff) |
modesetting: Reset output_id if drmModeGetConnector failed
If drmModeGetConnector() fails in drmmode_output_detect(), we have to
reset the output_id to -1 too.
Yet another spot leading to a potential NULL dereference when handling
the mode_output member as output_id was != -1. Though, this case should
be very hard to hit.
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
(Ported from xserver commit 6804875662363764683a86c1614e4cf3cc70a20a)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 98d2039..a90fdb6 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1378,8 +1378,10 @@ static xf86OutputStatus drmmode_output_detect(xf86OutputPtr output) drmmode_output->mode_output = drmModeGetConnector(pAMDGPUEnt->fd, drmmode_output->output_id); - if (!drmmode_output->mode_output) + if (!drmmode_output->mode_output) { + drmmode_output->output_id = -1; return XF86OutputStatusDisconnected; + } switch (drmmode_output->mode_output->connection) { case DRM_MODE_CONNECTED: |