Re: [Patch] USBVision - Fix NT1005 Bridge detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






Mauro Carvalho Chehab a écrit :
Hi Thierry,

I am currently debugging the Trent's patch that makes a kernel oops and I don't know why. The usbvision_probe is called event if the device is not plugged, and the kernel oops occurs on this piece of code:
    model = devid->driver_info;
    printk(KERN_INFO "%s: %s found\n", __FUNCTION__,
                usbvision_device_data[model].ModelString);

Memory alignment problem ? Why this probe is called even if there is no device plugged-in ?
Very weird. It shouldn't be called when no device is plugged...

By putting something like:
    model = devid->driver_info;
    if(model<0 || model >HPG_WINTV) {
        printk(KERN_INFO "model out of bounds %d\n",model);
        return -ENODEV;
    } else printk(KERN_INFO "model is %d\n",model);

The problem disappeared...

A similar code is also present on em28xx. Anyway, it is better to have
this kind of protection. I've added a patch, based on yours, fixing the
bug. As you'd agreed, I've pushed the patches to master tree.

It is better, however, to check why it is calling the code, without a
valid USB ID, since it may mean a future trouble...

If I delete this line in the device_table:
{ USB_DEVICE(0xfff0, 0xfff0), .driver_info=DUMMY_DEVICE },
there is no more call to the usb probe function. But I think I will lose the custom device facility. I think these USB_DEVICE parameters are special ones indicating to usb core that usbvision_probe must be called for unclaimed devices. I plugged a new USB peripheral without having plugged the corresponding driver, I got the "model out of bounds" message. printk should be changed to a PDEBUG in order to deactivate this log by default (did it in my repository).
Btw, I think we can also apply this one also:

diff -r 6b6805e3c76d linux/drivers/media/video/usbvision/usbvision-video.c
--- a/linux/drivers/media/video/usbvision/usbvision-video.c	Sat Apr 14 15:17:08 2007 -0300
+++ b/linux/drivers/media/video/usbvision/usbvision-video.c	Sat Apr 14 15:19:06 2007 -0300
@@ -1985,8 +1985,6 @@ static int __devinit usbvision_probe(str
 		return -ENODEV;
 	}
- usb_get_dev(dev);
-
 	if ((usbvision = usbvision_alloc(dev)) == NULL) {
 		err("%s: couldn't allocate USBVision struct", __FUNCTION__);
 		return -ENOMEM;


usb_get_dev() is already called previously on usbvision_probe.



_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux