diff options
author | Oliver Neukum <oliver@neukum.org> | 2009-08-04 17:52:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-08-07 19:05:14 -0400 |
commit | cf7fdd57f978d40ceb9a0f58a25f5cf9c84d6f33 (patch) | |
tree | 17de519a492c4353dc65111bec683bd4f038a311 /drivers/usb/class | |
parent | c15e3ca1d822abba78c00b1ffc3e7b382a50396e (diff) |
USB: fix oops on disconnect in cdc-acm
This patch fixes an oops caused when during an unplug a device's table
of endpoints is zeroed before the driver is notified. A pointer to
the endpoint must be cached.
this fixes a regression caused by commit
5186ffee2320942c3dc9745f7930e0eb15329ca6
Therefore it should go into 2.6.31
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/class')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 10 | ||||
-rw-r--r-- | drivers/usb/class/cdc-acm.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e1f89416ef8c..2bfc41ece0e1 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -387,7 +387,6 @@ static void acm_rx_tasklet(unsigned long _acm) | |||
387 | struct acm_ru *rcv; | 387 | struct acm_ru *rcv; |
388 | unsigned long flags; | 388 | unsigned long flags; |
389 | unsigned char throttled; | 389 | unsigned char throttled; |
390 | struct usb_host_endpoint *ep; | ||
391 | 390 | ||
392 | dbg("Entering acm_rx_tasklet"); | 391 | dbg("Entering acm_rx_tasklet"); |
393 | 392 | ||
@@ -463,14 +462,12 @@ urbs: | |||
463 | 462 | ||
464 | rcv->buffer = buf; | 463 | rcv->buffer = buf; |
465 | 464 | ||
466 | ep = (usb_pipein(acm->rx_endpoint) ? acm->dev->ep_in : acm->dev->ep_out) | 465 | if (acm->is_int_ep) |
467 | [usb_pipeendpoint(acm->rx_endpoint)]; | ||
468 | if (usb_endpoint_xfer_int(&ep->desc)) | ||
469 | usb_fill_int_urb(rcv->urb, acm->dev, | 466 | usb_fill_int_urb(rcv->urb, acm->dev, |
470 | acm->rx_endpoint, | 467 | acm->rx_endpoint, |
471 | buf->base, | 468 | buf->base, |
472 | acm->readsize, | 469 | acm->readsize, |
473 | acm_read_bulk, rcv, ep->desc.bInterval); | 470 | acm_read_bulk, rcv, acm->bInterval); |
474 | else | 471 | else |
475 | usb_fill_bulk_urb(rcv->urb, acm->dev, | 472 | usb_fill_bulk_urb(rcv->urb, acm->dev, |
476 | acm->rx_endpoint, | 473 | acm->rx_endpoint, |
@@ -1183,6 +1180,9 @@ made_compressed_probe: | |||
1183 | spin_lock_init(&acm->read_lock); | 1180 | spin_lock_init(&acm->read_lock); |
1184 | mutex_init(&acm->mutex); | 1181 | mutex_init(&acm->mutex); |
1185 | acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress); | 1182 | acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress); |
1183 | acm->is_int_ep = usb_endpoint_xfer_int(epread); | ||
1184 | if (acm->is_int_ep) | ||
1185 | acm->bInterval = epread->bInterval; | ||
1186 | tty_port_init(&acm->port); | 1186 | tty_port_init(&acm->port); |
1187 | acm->port.ops = &acm_port_ops; | 1187 | acm->port.ops = &acm_port_ops; |
1188 | 1188 | ||
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index 1602324808ba..c4a0ee8ffccf 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h | |||
@@ -126,6 +126,8 @@ struct acm { | |||
126 | unsigned int ctrl_caps; /* control capabilities from the class specific header */ | 126 | unsigned int ctrl_caps; /* control capabilities from the class specific header */ |
127 | unsigned int susp_count; /* number of suspended interfaces */ | 127 | unsigned int susp_count; /* number of suspended interfaces */ |
128 | int combined_interfaces:1; /* control and data collapsed */ | 128 | int combined_interfaces:1; /* control and data collapsed */ |
129 | int is_int_ep:1; /* interrupt endpoints contrary to spec used */ | ||
130 | u8 bInterval; | ||
129 | struct acm_wb *delayed_wb; /* write queued for a device about to be woken */ | 131 | struct acm_wb *delayed_wb; /* write queued for a device about to be woken */ |
130 | }; | 132 | }; |
131 | 133 | ||