mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Currently we check the pty path received from xenstore with access(); if it indicates that the pty is not accessible, we loop around and wait for a new path to appear in xenstore. This has several issues: * If a path has been written to xenstore, it can be assumed that that pty should already be accessible to xenconsole, and hence any error that occurs while trying to open it should be fatal and not ignored * If access() indicates no access to the pty, the memory allocated for the path is leaked when going around the loop again * The accessibility of the pty could change between the access() and open() calls, leading to a TOCTOU race (this is what Coverity is complaining about). By removing the explicit access() check and just erroring out whenever open() fails, we fix all these issues. Coverity-ID: 1056047 Signed-off-by: Matthew Daley <mattd@bugfuzz.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>