Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: drivers/usb/class/cdc-acm.c

Issue 6824041: USB: cdc-acm: fix deadlock in acm_tty_open (Closed)
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * cdc-acm.c 2 * cdc-acm.c
3 * 3 *
4 * Copyright (c) 1999 Armin Fuerst <fuerst@in.tum.de> 4 * Copyright (c) 1999 Armin Fuerst <fuerst@in.tum.de>
5 * Copyright (c) 1999 Pavel Machek <pavel@suse.cz> 5 * Copyright (c) 1999 Pavel Machek <pavel@suse.cz>
6 * Copyright (c) 1999 Johannes Erdfelt <johannes@erdfelt.com> 6 * Copyright (c) 1999 Johannes Erdfelt <johannes@erdfelt.com>
7 * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> 7 * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz>
8 * Copyright (c) 2004 Oliver Neukum <oliver@neukum.name> 8 * Copyright (c) 2004 Oliver Neukum <oliver@neukum.name>
9 * Copyright (c) 2005 David Kubicek <dave@awk.cz> 9 * Copyright (c) 2005 David Kubicek <dave@awk.cz>
10 * 10 *
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 acm->ctrlurb->dev = acm->dev; 580 acm->ctrlurb->dev = acm->dev;
581 if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) { 581 if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) {
582 dbg("usb_submit_urb(ctrl irq) failed"); 582 dbg("usb_submit_urb(ctrl irq) failed");
583 goto bail_out; 583 goto bail_out;
584 } 584 }
585 585
586 if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS) && 586 if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS) &&
587 (acm->ctrl_caps & USB_CDC_CAP_LINE)) 587 (acm->ctrl_caps & USB_CDC_CAP_LINE))
588 goto full_bailout; 588 goto full_bailout;
589 589
590 usb_autopm_put_interface(acm->control);
591
592 INIT_LIST_HEAD(&acm->spare_read_urbs); 590 INIT_LIST_HEAD(&acm->spare_read_urbs);
593 INIT_LIST_HEAD(&acm->spare_read_bufs); 591 INIT_LIST_HEAD(&acm->spare_read_bufs);
594 INIT_LIST_HEAD(&acm->filled_read_bufs); 592 INIT_LIST_HEAD(&acm->filled_read_bufs);
595 593
596 for (i = 0; i < acm->rx_buflimit; i++) 594 for (i = 0; i < acm->rx_buflimit; i++)
597 list_add(&(acm->ru[i].list), &acm->spare_read_urbs); 595 list_add(&(acm->ru[i].list), &acm->spare_read_urbs);
598 for (i = 0; i < acm->rx_buflimit; i++) 596 for (i = 0; i < acm->rx_buflimit; i++)
599 list_add(&(acm->rb[i].list), &acm->spare_read_bufs); 597 list_add(&(acm->rb[i].list), &acm->spare_read_bufs);
600 598
601 acm->throttle = 0; 599 acm->throttle = 0;
602 600
603 set_bit(ASYNCB_INITIALIZED, &acm->port.flags); 601 set_bit(ASYNCB_INITIALIZED, &acm->port.flags);
604 rv = tty_port_block_til_ready(&acm->port, tty, filp); 602 rv = tty_port_block_til_ready(&acm->port, tty, filp);
605 tasklet_schedule(&acm->urb_task); 603 tasklet_schedule(&acm->urb_task);
606 604
607 mutex_unlock(&acm->mutex); 605 mutex_unlock(&acm->mutex);
606 usb_autopm_put_interface(acm->control);
608 out: 607 out:
609 mutex_unlock(&open_mutex); 608 mutex_unlock(&open_mutex);
610 return rv; 609 return rv;
611 610
612 full_bailout: 611 full_bailout:
613 usb_kill_urb(acm->ctrlurb); 612 usb_kill_urb(acm->ctrlurb);
614 bail_out: 613 bail_out:
615 acm->port.count--; 614 acm->port.count--;
616 mutex_unlock(&acm->mutex); 615 mutex_unlock(&acm->mutex);
617 usb_autopm_put_interface(acm->control); 616 usb_autopm_put_interface(acm->control);
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 put_tty_driver(acm_tty_driver); 1711 put_tty_driver(acm_tty_driver);
1713 } 1712 }
1714 1713
1715 module_init(acm_init); 1714 module_init(acm_init);
1716 module_exit(acm_exit); 1715 module_exit(acm_exit);
1717 1716
1718 MODULE_AUTHOR(DRIVER_AUTHOR); 1717 MODULE_AUTHOR(DRIVER_AUTHOR);
1719 MODULE_DESCRIPTION(DRIVER_DESC); 1718 MODULE_DESCRIPTION(DRIVER_DESC);
1720 MODULE_LICENSE("GPL"); 1719 MODULE_LICENSE("GPL");
1721 MODULE_ALIAS_CHARDEV_MAJOR(ACM_TTY_MAJOR); 1720 MODULE_ALIAS_CHARDEV_MAJOR(ACM_TTY_MAJOR);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698