lkml.org 
[lkml]   [2006]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: 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/

    \
     
     \ /
      Last update: 2006-12-22 20:11    [W:6.876 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site