Commit b512504e authored by Frank Gevaerts's avatar Frank Gevaerts Committed by Greg Kroah-Hartman

[PATCH] USB: ipaq.c bugfixes

This patch fixes several problems in the ipaq.c driver with connecting
and disconnecting pocketpc devices:

* The read urb stayed active if the connect failed, causing nullpointer
  dereferences later on.

* If a write failed, the driver continued as if nothing happened. Now it
  handles that case the same way as other usb serial devices (fix by
  Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>)
Signed-off-by: default avatarFrank Gevaerts <frank.gevaerts@fks.be>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b972b68c
...@@ -651,11 +651,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) ...@@ -651,11 +651,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
ipaq_read_bulk_callback, port); ipaq_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result) {
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
goto error;
}
/* /*
* Send out control message observed in win98 sniffs. Not sure what * Send out control message observed in win98 sniffs. Not sure what
...@@ -670,6 +665,11 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) ...@@ -670,6 +665,11 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 100); 0x1, 0, NULL, 0, 100);
if (result == 0) { if (result == 0) {
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result) {
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
goto error;
}
return 0; return 0;
} }
} }
...@@ -854,6 +854,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs) ...@@ -854,6 +854,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
if (urb->status) { if (urb->status) {
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
return;
} }
spin_lock_irqsave(&write_list_lock, flags); spin_lock_irqsave(&write_list_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment