Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df3fccb1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

[PATCH] USB: fix omninet driver bug



I introduced this way back in 2.6.13 when adding the port lock logic.
This device talks out through different "ports" all at the same time, so
the lock logic was wrong, preventing any data from ever being sent
properly.

Thanks a lot to Bernhard Reiter <bernhard@intevation.de> for being
patient and helping with debugging this.

Cc: Bernhard Reiter <bernhard@intevation.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 815ddc99
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -257,14 +257,14 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
		return (0);
	}

	spin_lock(&port->lock);
	if (port->write_urb_busy) {
		spin_unlock(&port->lock);
	spin_lock(&wport->lock);
	if (wport->write_urb_busy) {
		spin_unlock(&wport->lock);
		dbg("%s - already writing", __FUNCTION__);
		return 0;
	}
	port->write_urb_busy = 1;
	spin_unlock(&port->lock);
	wport->write_urb_busy = 1;
	spin_unlock(&wport->lock);

	count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;

@@ -283,7 +283,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
	wport->write_urb->dev = serial->dev;
	result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
	if (result) {
		port->write_urb_busy = 0;
		wport->write_urb_busy = 0;
		err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
	} else
		result = count;