Messages in this thread | | | Date | Fri, 22 Dec 2006 11:08:00 -0800 (PST) | From | J <> | Subject | Re: Possible race condition in usb-serial.c |
| |
> This problem will need some deeper surgery probably > involving > removal of the refcounting.
Refcounting may be OK if used consistently. It is not OK when some pointers are ref-counted, but other (in serial_table) are not (like it is in the current version).
As for the deeper surgery, what do you think about my earlier suggestion to start by rewriting usb_serial_probe to fully initialize usb_serial before it is added to serial_table?
So, instead of the current: 1. create_serial ... 2. mutex_lock(&table_lock); 3. get_free_serial (which inserts serial to serial_table) ... 4. initializes serial 5. mutex_unlock(&table_lock);
we will get:
1. create_serial 2. initializes serial
3. add_serial_toserial_table (with internal mutex lock if needed)
Similar approach should be used in other places to minimize the code executed under the mutex.
John
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |