Hi!
I found a bug in the USB core (present in linux-2.6.20-rc5-git2 with your patch
from http://kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/:
gregkh-03-usb-2.6.20-rc5-git2.patch )
in the core/driver.c file, function store_new_id()
the problem comes from the call to list_add_tail() which is done as
list_add_tail(head, new) instead of list_add_tail(new, head)
This is OK for the first inclusion, but not for the second, and any following
ones, because previously added entries are no more referenced.
This also creates a memory leak (we loose the reference to the alocated memory).
See attached patch.
I'm actually working on dynamic ids for a serial driver (using the generic part
for all but the new features, which are dynamic ids and static allocation of
ttyUSB numbers depending on geographic position on USB bus.)
I saw the modifications you made for dynamic ids in usb-serial, but why not
exporting usb_match_dynamic_id() from core/driver.c instead of rewriting it in
serial/usb-serial.c
I know usb_match_dynamic_id() needs a usb_driver and not a usb_serial_driver,
but the usb_serial_driver struct now contain a pointer to a usb_driver.
Using this would enable the new serial driver to create it's usb_driver struct
with ".no_dynamic_id = 0," and update this pointer (I did not check what it is
used for yet, but I think this is the goal).
This creates the sysfs new_id file automatically, and ids added with this file
are then seen by the usb-serial.
Another way should be to call the probe function registered in the
usb_serial_driver struct, and let the device do the matching.
Feel free to ask any question if my english is not comprehensible (or if you do
not see what I want to say).
Send copy of reply to my presonnal address for I'm not in the linux-usb-devel
list.
--- drivers/usb/core/driver.c 2007-01-24 12:55:56.970877762 +0100
+++ drivers/usb/core/new_driver.c 2007-01-24 12:56:55.662222391 +0100
@@ -58,7 +58,7 @@
dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE;
spin_lock(&dynids->lock);
- list_add_tail(&dynids->list, &dynid->node);
+ list_add_tail(&dynid->node, &dynids->list);
spin_unlock(&dynids->lock);
if (get_driver(driver)) {
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel