linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Kozina <skozina@redhat.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: 大林 <yourdarling1999@sina.com>,
	linux-serial <linux-serial@vger.kernel.org>
Subject: Re: n_tty_read panic
Date: Mon, 30 Jul 2012 12:41:57 +0200	[thread overview]
Message-ID: <501664F5.5010705@redhat.com> (raw)
In-Reply-To: <20120725124416.474bed6b@pyramind.ukuu.org.uk>

Seems that tty->read_buf == NULL at the very beginning of n_tty_read():

1723 do_it_again:
1724
1725         BUG_ON(!tty->read_buf);

tty->read_buf access needs tty->read_lock to be held, correct? So 
perhaps the patch would be:

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index ee1c268..9decb1c 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1728,7 +1728,11 @@ static ssize_t n_tty_read(struct tty_struct *tty, 
struct file *file,

  do_it_again:

+#ifdef CONFIG_BUG
+       spin_lock_irqsave(&tty->read_lock, flags);
         BUG_ON(!tty->read_buf);
+       spin_unlock_irqrestore(&tty->read_lock, flags);
+#endif

         c = job_control(tty, file);
         if (c < 0)

Regards,
-Stanislav Kozina

> On Wed, 25 Jul 2012 09:47:09 +0800
> "大林"<yourdarling1999@sina.com>  wrote:
>
>> Hello.
>>
>> Here's a kernel panic caused by n_tty_read, linux kernel version is 2.6.38.8.
>>
>>
>> There are many discussions on the subject, this bug solved yet? Where can I download the patch?
> Thats a different trace to the others I've seen. Several races have been
> fixed, there are certainly a couple of others left to sort eventually. I
> don't believe anyone is currently working on them (and indeed until the
> rest of the locking and lock splitting work is done it's difficult to see
> how any useful progress could be made here). Patches are however welcome.
>
> Alan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-serial" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2012-07-30 10:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25  1:47 n_tty_read panic 大林
2012-07-25 11:44 ` Alan Cox
2012-07-30 10:41   ` Stanislav Kozina [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=501664F5.5010705@redhat.com \
    --to=skozina@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-serial@vger.kernel.org \
    --cc=yourdarling1999@sina.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).