public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Pavan Savoy <pavan_savoy@sify.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: locks inside receive_buf
Date: Tue, 05 Apr 2011 09:04:31 -0400	[thread overview]
Message-ID: <1302008671.17430.10.camel@frodo> (raw)
In-Reply-To: <BANLkTik5MGz9YgU0oh30ZUesv+c3QEB+rA@mail.gmail.com>

On Tue, 2011-04-05 at 16:43 +0530, Pavan Savoy wrote:

> > The program counter is at st_int_recv+0x2a0 when this happened, so that
> > function is probably where you accessed some structure that was not
> > initialized.
> >
> >        foo->bar
> >
> > if foo is NULL, you'll get that error.
> >
> >> LR is at schedule+0x414/0x4e8
> >
> > LR is Link Register, or where this function was called from.
> >
> > Now why is the scheduler calling your function, I have no idea.
> 
> Well this is exactly the problem I have and hence the question
> regarding sleep in tty's receive_buf function.
> 
> the function called st_recv or st_int_recv() is basically my line
> discipline's receive_buf function - which happens like zillions of
> times properly with tty->disc_data being populated with what I
> need....
> 
> However on a corner case - when I perform some operation - which has
> absolutely NO relation to TTY (at most may be console is using 1 uart)
> - Everything breaks loose...

Well, if this corner case that you perform causes the corruption, I
think they are related. What corner case do you do?

> 
> If I bump into a NULL pointer it is because the tty->disc_data is NULL ....
> However my check for tty->disc_data being NULL also is fine - i.e when
> I do get this error - my disc_data is NOT null ... But not sure what
> (which data) is NULL ??

How are you checking for NULL?

	if (data == NULL)

may not work as the error shows:

"Unable to handle kernel NULL pointer dereference at virtual address 0000001a"

Where data (or what ever it was using) was 0x1a not 0. We consider NULL
anything less that a page size. Because of something just like this. You
have a structure pointer that is NULL, accessing the element may not be
NULL.

> 
> So now back to the question - What cannot I do inside tty's receive_buf ?

I don't know, but it may not be the issue. Something else may be broken.

Perhaps you can't schedule, which means you can't use something like a
mutex. But if that was the issue, the scheduler itself would give you a
nasty warning that you are scheduling in non-schedulable context.

-- Steve



  reply	other threads:[~2011-04-05 13:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30 12:21 locks inside receive_buf Pavan Savoy
2011-03-31 10:25 ` Alan Cox
2011-03-31 11:18   ` Pavan Savoy
2011-03-31 14:33     ` Steven Rostedt
2011-04-01  7:12       ` Pavan Savoy
2011-04-01 13:46         ` Steven Rostedt
2011-04-05 11:13           ` Pavan Savoy
2011-04-05 13:04             ` Steven Rostedt [this message]
2011-04-06  8:56               ` Pavan Savoy
2011-05-17 11:30                 ` Pavan Savoy

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=1302008671.17430.10.camel@frodo \
    --to=rostedt@goodmis.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavan_savoy@sify.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