Messages in this thread | | | Subject | request_module() oops | From | Peter Riocreux <> | Date | 03 Dec 1999 10:30:44 +0000 |
| |
I am writing a module to load USB device-specific driver modules based on their vendor and product ids, and have run into a problem with request_module() OOPSen.
Some extracts from my code:
--------------
static void * usb_generic_loader_probe(struct usb_device *dev, unsigned int ifnum) { char modulename[32];
if(dev == NULL) { #ifdef CONFIG_USB_GENERIC_LOADER_DEBUG printk("USB: generic loader: null device\n"); #endif return NULL; }
#ifdef CONFIG_USB_GENERIC_LOADER_DEBUG printk("USB: generic loader: probing\n"); printk("\t%04x %04x %02x %02x %02x\n", dev->descriptor.idVendor, dev->descriptor.idProduct, dev->descriptor.bDeviceClass, dev->descriptor.bDeviceSubClass, dev->descriptor.bDeviceProtocol); #endif
/* try to load a module for the vendor-device pair */ sprintf(modulename, "usb-device-%04x-%04x", dev->descriptor.idVendor, dev->descriptor.idProduct); if(!request_module(modulename)) { #ifdef CONFIG_USB_GENERIC_LOADER_DEBUG printk("USB: generic loader: loaded module based on vendor and product IDs - %s.\n", modulename); #endif return NULL; }
[etc.]
--------------
The first time I call this function, it works fine, but subsequent calls cause an OOPS from within or below request_module(). I don't have the OOPS details available ATM (I forgot to bring it into work), but I remember it was complaining about a NULL pointer dereference and something about this being at address 00000004.
If I unload the module which contains this code and load it again, then again the first use is fine, but subsequent uses cause an OOPS. The request_module() call performs correctly and does in fact load the relevant module if it can find it, it just generates an OOPS as well. The debug call shows that every time the call is used there is something valid in modulename (and this is confirmed by the fact that the module does in fact get loaded).
I grepped for request_module, and fs/exec.c appears to use it in exactly the same way.
Am I using it wrongly? Am I doing something I shouldn't? Is there something wrong with kmod? I couldn't see anything in kmod.c that jumped out at me. I am going to add some debugging to kmod.c tonight to see if I can get more details about what the real problem is, but if anyone has been bitten this way previously...
Be gentle with me, this is my first linux-kernel posting :~}
Peter
-- Peter Riocreux, Amulet Group, Dept. Computer Science, Manchester University, Oxford Road, MANCHESTER, M13 9PL, UK. <http://www.cs.man.ac.uk/amulet/> Voice: +44 161-2753547 Mobile: +44 7970-611366 Fax: +44 161-2756236
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |