From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stanislav Kozina Subject: Re: [PATCH V2] Remove BUG_ON from n_tty_read() Date: Thu, 16 Aug 2012 09:52:44 +0200 Message-ID: <502CA6CC.1080806@redhat.com> References: <4FE886C6.7090606@redhat.com> <20120626152159.2a34dcaf@pyramind.ukuu.org.uk> <50094C8E.5010308@redhat.com> <20120720161123.58fc9703@pyramind.ukuu.org.uk> <50221C30.20607@redhat.com> <20120808100019.6ca011a9@pyramind.ukuu.org.uk> <502256E8.5040300@redhat.com> <5022779F.8060309@redhat.com> <20120808162725.713e7a61@pyramind.ukuu.org.uk> <50239DFA.1090004@redhat.com> <5024E7B2.4030205@redhat.com> <50251CF5.5050709@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com ([209.132.183.28]:62932 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755762Ab2HPHwz (ORCPT ); Thu, 16 Aug 2012 03:52:55 -0400 In-Reply-To: <50251CF5.5050709@redhat.com> Sender: linux-serial-owner@vger.kernel.org List-Id: linux-serial@vger.kernel.org To: Alan Cox Cc: Greg Kroah-Hartman , linux-serial@vger.kernel.org, Stanislaw Gruszka 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 > --- > 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)