1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
From akpm@osdl.org Fri Jun 30 16:40:04 2006
Message-Id: <200606300934.k5U9YiSw001784@shell0.pdx.osdl.net>
From: Frank Gevaerts <frank.gevaerts@fks.be>
Subject: USB: ipaq.c bugfixes
To: greg@kroah.com
Cc: akpm@osdl.org, frank.gevaerts@fks.be, lcapitulino@mandriva.com.br
Date: Fri, 30 Jun 2006 02:34:44 -0700
From: Frank Gevaerts <frank.gevaerts@fks.be>
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: Frank Gevaerts <frank.gevaerts@fks.be>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/usb/serial/ipaq.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--- gregkh-2.6.orig/drivers/usb/serial/ipaq.c
+++ gregkh-2.6/drivers/usb/serial/ipaq.c
@@ -651,11 +651,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
@@ -670,6 +665,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;
}
}
@@ -854,6 +854,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);
|