From 5c3647b8a30d1ba3d2bb2b43bbb7b867dbcf28d6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 24 Oct 2019 21:03:49 +0200 Subject: [PATCH] TTY: MasterPTY should fail to ioctl() if slave is gone Just fail with EIO in that case. --- Kernel/TTY/MasterPTY.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index cace566a99..efd29a7f27 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -98,6 +98,8 @@ void MasterPTY::close() int MasterPTY::ioctl(FileDescription& description, unsigned request, unsigned arg) { + if (!m_slave) + return -EIO; if (request == TIOCSWINSZ || request == TIOCGPGRP) return m_slave->ioctl(description, request, arg); return -EINVAL;