• Tomer Tayar's avatar
    habanalabs: Disable file operations after device is removed · ffd123fe
    Tomer Tayar authored
    A device can be removed from the PCI subsystem while a process holds the
    file descriptor opened.
    In such a case, the driver attempts to kill the process, but as it is
    still possible that the process will be alive after this step, the
    device removal will complete, and we will end up with a process object
    that points to a device object which was already released.
    
    To prevent the usage of this released device object, disable the
    following file operations for this process object, and avoid the cleanup
    steps when the file descriptor is eventually closed.
    The latter is just a best effort, as memory leak will occur.
    Signed-off-by: default avatarTomer Tayar <ttayar@habana.ai>
    Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
    Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
    ffd123fe
habanalabs_ioctl.c 19 KB