From: Frank Gevaerts 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 ) Signed-off-by: Frank Gevaerts Cc: Greg KH Signed-off-by: Andrew Morton --- drivers/usb/serial/ipaq.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff -puN drivers/usb/serial/ipaq.c~ipaqc-bugfixes drivers/usb/serial/ipaq.c --- a/drivers/usb/serial/ipaq.c~ipaqc-bugfixes +++ a/drivers/usb/serial/ipaq.c @@ -652,11 +652,6 @@ static int ipaq_open(struct usb_serial_p usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, 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 @@ -671,6 +666,11 @@ static int ipaq_open(struct usb_serial_p usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, 0x1, 0, NULL, 0, 100); 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; } } @@ -855,6 +855,7 @@ static void ipaq_write_bulk_callback(str if (urb->status) { dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); + return; } spin_lock_irqsave(&write_list_lock, flags); _