summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/tty_io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 816e709afa56..082da38762fc 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -962,11 +962,14 @@ static inline ssize_t do_tty_write(
if (ret <= 0)
break;
+ written += ret;
+ if (ret > size)
+ break;
+
/* FIXME! Have Al check this! */
if (ret != size)
iov_iter_revert(from, size-ret);
- written += ret;
count -= ret;
if (!count)
break;