Am Freitag, 22. Dezember 2006 21:51 schrieb J:

I am dropping linux-kernel. This is an USB issue.

> Now, I am not yet 100% convinced that ref counting
> will, indeed, work. Atomics are known to have
> problems on SMP CPUs, which can reorder operations.
> But I would not discard atomics yet.
> Global mutex is go ugly.

Well, to be blunt, this driver has further locking problems, eg:

static int serial_write (struct tty_struct * tty, const unsigned char *buf, int 
count)
{
        struct usb_serial_port *port = tty->driver_data;
        int retval = -EINVAL;

        if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED)
                goto exit;

        dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);

        if (!port->open_count) {
                dbg("%s - port not opened", __FUNCTION__);
                goto exit;
        }

        /* pass on to the driver specific version of this function */
        retval = port->serial->type->write(port, buf, count);

exit:
        return retval;
}

There's no use checking for attachement. The state may have changed.
In fact, if a device is disconnected via sysfs, this code will happily write
to a device somebody else has claimed.

        Regards
                Oliver

-------------------------------------------------------------------------
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

Reply via email to