mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	linux1394-devel@lists.sourceforge.net,
	linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Ben Backx <ben@bbackx.com>, Henrik Kurelid <henrik@kurelid.se>
Subject: Re: [git pull] DVB + ieee1394: firedtv driver
Date: Thu, 26 Feb 2009 08:40:04 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0902260824470.3111@localhost.localdomain> (raw)
In-Reply-To: <49A6BC72.5050206@s5r6.in-berlin.de>



On Thu, 26 Feb 2009, Stefan Richter wrote:
> 
> Alas I have no Linux box at hand before Saturday.  I wonder, was
> ieee1394_bus_type not yet registered (i.e. ieee1394's ieee1394_init() not yet
> called) at the moment when fdtv_init is executed?
> 
> Or what else could have been the NULL pointer dereference in driver_find?

Afaik, the only way that NULL pointer dereference can happen is if

	struct kobject *k = kset_find_obj(bus->p->drivers_kset, name);

gets a NULL pointer exception either because of a NULL "bus" pointer as 
the argument, or if "bus->p" is NULL.

And in this case, it's the latter. The Code: decode shows the whole 
function in this case:

  1c:	55                   	push   %rbp
  1d:	89 e5                	mov    %esp,%ebp
  1f:	e8 34 5f c8 ff       	callq  0xffffffffffc85f58
  24:	89 c1                	mov    %eax,%ecx
  26:	8b 42 38             	mov    0x38(%rdx),%eax
  29:	89 ca                	mov    %ecx,%edx
  2b:*	8b 40 54             	mov    0x54(%rax),%eax     <-- trapping instruction
  2e:	e8 6c 48 f9 ff       	callq  0xfffffffffff9489f
  33:	31 d2                	xor    %edx,%edx
  35:	85 c0                	test   %eax,%eax
  37:	74 03                	je     0x3c
  39:	8b 50 6c             	mov    0x6c(%rax),%edx
  3c:	5d                   	pop    %rbp
  3d:	89 d0                	mov    %edx,%eax
  3f:	c3                   	retq   

and that first "callq" seems to be due to Ingo having function tracing on, 
while the second callq would have been that 'kset_find_obj()' thing.

So it does look like "&ieee1394_bus_type" has simply not been initialized 
yet. It looks like ieee1394_init() is called too late.

Two choices that I can see:

 - do the ieee1394_init() as a fs_initcall(), earlier

 - move drivers/ieee1394 linking up to before drivers/media

but I suspect that drivers/media wants to be early, in order to do the 
_media_ layer initialization early.

Does this work?

		Linus

---
 drivers/ieee1394/ieee1394_core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index 1028e72..8723380 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -1275,7 +1275,7 @@ static void __exit ieee1394_cleanup(void)
 	unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
 }
 
-module_init(ieee1394_init);
+fs_initcall(ieee1394_init);
 module_exit(ieee1394_cleanup);
 
 /* Exported symbols */

  reply	other threads:[~2009-02-26 16:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-24 17:48 Stefan Richter
2009-02-26  1:37 ` Ingo Molnar
2009-02-26 15:59   ` Stefan Richter
2009-02-26 16:40     ` Linus Torvalds [this message]
2009-02-26 17:03       ` Ingo Molnar
2009-02-27  8:20         ` Stefan Richter

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=alpine.LFD.2.00.0902260824470.3111@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=ben@bbackx.com \
    --cc=henrik@kurelid.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=mchehab@infradead.org \
    --cc=mingo@elte.hu \
    --cc=stefanr@s5r6.in-berlin.de \
    /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

all inboxes | Powered by JetHome®