Re: [PATCH V2] Remove BUG_ON from n_tty_read()
From: Stanislav Kozina <hidden>
Date: 2012-08-16 07:52:55
From: Stanislav Kozina <hidden>
Date: 2012-08-16 07:52:55
Alan, What about integration of this patch? I will try to do some testing to understand how it can happen that we read from tty already closed. Thanks and regards, -Stanislav
Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL Signed-off-by: Stanislav Kozina <redacted> --- drivers/tty/n_tty.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index df21f39..6b9b5e0 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c@@ -1728,7 +1728,8 @@ static ssize_t n_tty_read(struct tty_struct*tty, struct file *file, do_it_again: - BUG_ON(!tty->read_buf); + if (WARN_ON(!tty->read_buf)) + return -EAGAIN; c = job_control(tty, file); if (c < 0)