Re: 2.6.18-rc1 bttv modprobe null pointer dereference
From: Andrew Morton
Date: Fri Jul 07 2006 - 02:33:43 EST
On Thu, 6 Jul 2006 22:19:09 -0700
"Bret Towe" <magnade@xxxxxxxxx> 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;
}
/**
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/