mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Bret Towe" <magnade@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.18-rc1 bttv modprobe null pointer dereference
Date: Thu, 6 Jul 2006 23:35:21 -0700	[thread overview]
Message-ID: <20060706233521.686300d2.akpm@osdl.org> (raw)
In-Reply-To: <dda83e780607062219q1db55c58ga7eb1d5438635dcc@mail.gmail.com>

On Thu, 6 Jul 2006 22:19:09 -0700
"Bret Towe" <magnade@gmail.com> wrote:

> > > Code: 4c 8b bf 48 01 00 00 48 8b bf c0 00 00 00 8b 5e 10 48 81 c7
> > > RIP  [<ffffffff802f1f9b>] sysfs_add_file+0x2b/0xb0
> > >  RSP <ffff81002ac71c28>
> > > CR2: 0000000000000149
> >
> > There don't seem to have been significant changes in bttv-driver.c for some
> > time, and we're seeing a few reports like this.  I'm suspecting that either
> > a sysfs/driver-core change was wrong, or previously wrong driver behaviour
> > is now causing oopses.
> >
> > And Mauro is offline until July 12.
> >
> > Can you send the .config please?
> 
> of course

I spent ten minutes and got lost.  I suspect videodev's class_device
handling is wrong, but I fail to spot it.

This might tell us something.

--- a/drivers/media/video/videodev.c~videodev-check-return-values
+++ a/drivers/media/video/videodev.c
@@ -1512,6 +1512,7 @@ int video_register_device(struct video_d
 	int i=0;
 	int base;
 	int end;
+	int ret;
 	char *name_base;
 
 	switch(type)
@@ -1571,9 +1572,19 @@ int video_register_device(struct video_d
 	vfd->class_dev.class       = &video_class;
 	vfd->class_dev.devt        = MKDEV(VIDEO_MAJOR, vfd->minor);
 	sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base);
-	class_device_register(&vfd->class_dev);
-	class_device_create_file(&vfd->class_dev,
-				&class_device_attr_name);
+	ret = class_device_register(&vfd->class_dev);
+	if (ret < 0) {
+		printk(KERN_ERR "%s: class_device_register() returned %d\n",
+			__FUNCTION__, ret);
+	} else {
+		ret = class_device_create_file(&vfd->class_dev,
+					&class_device_attr_name);
+		if (ret < 0) {
+			printk(KERN_ERR "%s: class_device_create_file() "
+					"returned %d\n", __FUNCTION__, ret);
+			class_device_unregister(&vfd->class_dev);
+		}
+	}
 
 #if 1
 	/* needed until all drivers are fixed */
@@ -1582,7 +1593,7 @@ int video_register_device(struct video_d
 		       "Please fix your driver for proper sysfs support, see "
 		       "http://lwn.net/Articles/36850/\n", vfd->name);
 #endif
-	return 0;
+	return ret;
 }
 
 /**
_


  reply	other threads:[~2006-07-07  6:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07  3:51 Bret Towe
2006-07-07  4:52 ` Andrew Morton
2006-07-07  5:19   ` Bret Towe
2006-07-07  6:35     ` Andrew Morton [this message]
2006-07-07 17:02       ` Bret Towe
2006-07-07  6:46     ` Dave Jones
2006-07-07 17:04       ` Bret Towe
2006-07-07 22:27         ` Bret Towe
2006-07-07  5:37   ` Bret Towe

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=20060706233521.686300d2.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnade@gmail.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

all inboxes | Powered by JetHome®