Commit 36b3faeb authored by Tom Denis's avatar Tom Denis Committed by Michel Dänzer
Browse files

Avoid use-after-free in amdgpu_kernel_open_fd()



If the device cannot be opened avoid re-using busid after it has been
freed.
Signed-off-by: Tom Denis's avatarTom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König's avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (cosmetic fixups)
parent 8823c3d4
......@@ -127,13 +127,14 @@ static int amdgpu_kernel_open_fd(ScrnInfoPtr pScrn, struct pci_device *dev)
#endif
fd = drmOpen(NULL, busid);
free(busid);
if (fd == -1) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] Failed to open DRM device for %s: %s\n",
busid, strerror(errno));
free(busid);
return fd;
}
free(busid);
/* Check that what we opened was a master or a master-capable FD,
* by setting the version of the interface we'll use to talk to it.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment