summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
Commit message (Collapse)AuthorAgeFilesLines
* USB: fix BUG: sleeping function called from invalid context at ↵Oliver Neukum2007-07-301-9/+8
| | | | | | | | | | | | /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524, in_atomic():1, irqs_disabled():0 Clearly there's a bug in drivers/usb/serial/usb-serial.c:usb_serial_put(). It shouldn't call kref_put() while holding a spinlock. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: fix usb_serial_suspend(): buggy codeOliver Neukum2007-07-301-7/+8
| | | | | | | | | | | | | | | | | | | | Am Montag 23 Juli 2007 schrieb Adrian Bunk: > Commit ec22559e0b7a05283a3413bda5d177e42c950e23 added the following > function to drivers/usb/serial/usb-serial.c: > [..] > > The Coverity checker spotted the inconsequent NULL checking for "serial". > > Looking at the code it also doesn't seem to have been intended to always > return 0. Coverity is right. The check for NULL is wrongly done and the error return is lost. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* synchronization in usb_serial_putBenny Halevy2007-07-121-2/+2
| | | | | | | | | | | | | | | | | | | I think there is a race between usb_serial_put() and usb_serial_get_by_index() (and get_free_serial()) with regards to handling the serial port refcount. usb_serial_get_by_index() gets a reference on the serial port under table_lock while return_serial releases all the returned ports from the table under the same lock. However, the table_lock is not taken around the call to kref_put, theoretically allowing to sneak in and grab a reference after kref_put has already determined that the reference count is zero (and before calling destroy_serial) causing use after free. Signed-off-by: Benny Halevy <bhalevy@ns1.bhalevy.com> Cc: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: suspend support for usb serialOliver Neukum2007-07-121-0/+31
| | | | | | | | this implements generic support for suspend/resume for usb serial. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* header cleaning: don't include smp_lock.h when not usedRandy Dunlap2007-05-081-1/+0
| | | | | | | | | | | | Remove includes of <linux/smp_lock.h> where it is not used/needed. Suggested by Al Viro. Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc, sparc64, and arm (all 59 defconfigs). Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* USB: fix usb-serial regressionJim Radford2007-03-191-6/+5
| | | | | | | | | | | This patch reverts d9a7ecacac5f8274d2afce09aadcf37bdb42b93a since it breaks drivers that need to access the ->port[] array in shutdown (most of them). Signed-Off: Jim Radford <radford@blackbean.org> Acked-by: Mark Lord <mlord@pobox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: further fix for usb-serialOliver Neukum2007-03-091-5/+4
| | | | | | | | this is a fix for the outstanding usb-serial issues. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: fix usb-serial device naming bugOliver Neukum2007-03-091-1/+1
| | | | | | | | | | | | | | | | | Am Montag, 26. Februar 2007 15:16 schrieb Craig Schlenter: > Hi Greg > > 34ef50e5b1f96c2d8c0f3d28b7d407743806256c is definitely > the source of the problem. Reverting that makes the > ftdi port show up as ttyUSB0 again for me and it > can actually be opened. This patch should fix the issue. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Craig Schlenter <craig@codefountain.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb-serial: fix shutdown / device_unregister orderJim Radford2007-03-091-5/+6
| | | | | | | | | | Ensure that the ->port_remove() callbacks get called before the ->shutdown() callback which makeing the order symmetric with ->attach() being called before ->port_probe(). Signed-off-by: Jim Radford <radford@blackbean.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: race fixes for usb-serial, step 3Oliver Neukum2007-02-071-1/+2
| | | | | | | | - fix an error code returned if a device has been disconnected Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: race fixes for usb-serial, step 2Oliver Neukum2007-02-071-2/+12
| | | | | | | | | | - take BKL before looking up a driver to associate with a device to make sure the module is not unloaded after looking up but before association & bumping module count Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: race fixes for usb-serial step 1Oliver Neukum2007-02-071-13/+31
| | | | | | | | | | | | | - introduce a spinlock for serial_table to eliminate the window between looking up a device and getting a reference - delay inscription of a new device into serial_table until it is fully initialised - make sure disconnect() kills all URBs to avoid leckage across a soft unbind Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB serial: add dynamic id support to usb-serial coreGreg Kroah-Hartman2007-02-071-5/+36
| | | | | | | | | | | | | | | | | | Thanks to Johannes Hölzl <johannes.hoelzl@gmx.de> for fixing a few things and getting it all working properly. This adds support for dynamic usb ids to the usb serial core. The file "new_id" will show up under the usb serial driver, not the usb driver associated with the usb-serial driver (yeah, it can be a bit confusing at first glance...) This patch also modifies the USB core to allow the usb-serial core to reuse much of the dynamic id logic. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Johannes Hölzl <johannes.hoelzl@gmx.de>
* [PATCH] tty: switch to ktermiosAlan Cox2006-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the grungy swap all the occurrences in the right places patch that goes with the updates. At this point we have the same functionality as before (except that sgttyb() returns speeds not zero) and are ready to begin turning new stuff on providing nobody reports lots of bugs If you are a tty driver author converting an out of tree driver the only impact should be termios->ktermios name changes for the speed/property setting functions from your upper layers. If you are implementing your own TCGETS function before then your driver was broken already and its about to get a whole lot more painful for you so please fix it 8) Also fill in c_ispeed/ospeed on init for most devices, although the current code will do this for you anyway but I'd like eventually to lose that extra paranoia [akpm@osdl.org: bluetooth fix] [mp3@de.ibm.com: sclp fix] [mp3@de.ibm.com: warning fix for tty3270] [hugh@veritas.com: fix tty_ioctl powerpc build] [jdike@addtoit.com: uml: fix ->set_termios declaration] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Acked-by: Peter Oberparleiter <oberpar@de.ibm.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Merge branch 'master' of ↵David Howells2006-12-051-8/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: drivers/infiniband/core/iwcm.c drivers/net/chelsio/cxgb2.c drivers/net/wireless/bcm43xx/bcm43xx_main.c drivers/net/wireless/prism54/islpci_eth.c drivers/usb/core/hub.h drivers/usb/input/hid-core.c net/core/netpoll.c Fix up merge failures with Linus's head and fix new compilation failures. Signed-Off-By: David Howells <dhowells@redhat.com>
| * usb: usb-serial free urb cleanupMariusz Kozlowski2006-12-011-8/+4
| | | | | | | | | | | | | | | | - usb_free_urb() cleanup Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | WorkStruct: make allyesconfigDavid Howells2006-11-221-3/+4
|/ | | | | | Fix up for make allyesconfig. Signed-Off-By: David Howells <dhowells@redhat.com>
* [PATCH] const struct tty_operationsJeff Dike2006-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | As part of an SMP cleanliness pass over UML, I consted a bunch of structures in order to not have to document their locking. One of these structures was a struct tty_operations. In order to const it in UML without introducing compiler complaints, the declaration of tty_set_operations needs to be changed, and then all of its callers need to be fixed. This patch declares all struct tty_operations in the tree as const. In all cases, they are static and used only as input to tty_set_operations. As an extra check, I ran an i386 allyesconfig build which produced no extra warnings. 53 drivers are affected. I checked the history of a bunch of them, and in most cases, there have been only a handful of maintenance changes in the last six months. serial_core.c was the busiest one that I looked at. Signed-off-by: Jeff Dike <jdike@addtoit.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* usb serial: support Alcor Micro Corp. USB 2.0 TO RS-232 through pl2303 driverJohannes Steingraeber2006-09-271-1/+3
| | | | | | | | | | | | Patch to add support for Alcor Micro Corp. USB 2.0 TO RS-232 converter. This patch adds VID and PID to pl2303.[ch], adds it to the "HORRIBLE HACK FOR PL2303" in usb-serial.c and also prevents cdc-acm to claim driving this device by blacklisting it in hid-core. Signed-off-by: Johannes Steingraeber <Jo_Stein@web.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: fix __must_check warnings in drivers/usb/serial/Greg Kroah-Hartman2006-09-271-1/+4
| | | | | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: usb-serial: Use usb_endpoint_* functions.Luiz Fernando N. Capitulino2006-09-271-12/+7
| | | | | | Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usbserial: Reference leakMatthias Urlichs2006-09-121-1/+3
| | | | | | | | | A sufficiently-large number of USB serial devices causes a reference leak when /proc/tty/drivers/usbserial is read. Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: move usb-serial.h to include/linux/usb/Greg Kroah-Hartman2006-07-121-1/+1
| | | | | | | | | | USB serial outside of the kernel tree can not build properly due to usb-serial.h being buried down in the source tree. This patch moves the location of the file to include/linux/usb and fixes up all of the usb serial drivers to handle the move properly. Cc: Sergei Organov <osv@javad.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: fix usb-serial leaks, oopses on disconnectPete Zaitcev2006-07-121-14/+9
| | | | | | | | | | This fix addresses two issues: - Unattached port structures were not freed - My initial fix for crash when eventd runs a work in a freed port did not go far enough Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Remove obsolete #include <linux/config.h>Jörn Engel2006-06-301-1/+0
| | | | | Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
* [PATCH] devfs: Rename TTY_DRIVER_NO_DEVFS to TTY_DRIVER_DYNAMIC_DEVGreg Kroah-Hartman2006-06-261-1/+1
| | | | | | | | | | I've always found this flag confusing. Now that devfs is no longer around, it has been renamed, and the documentation for when this flag should be used has been updated. Also fixes all drivers that use this flag. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] devfs: Remove the tty_driver devfs_name field as it's no longer neededGreg Kroah-Hartman2006-06-261-1/+0
| | | | | | Also fixes all drivers that set this field. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] usbserial: Fixes wrong return values.Luiz Fernando N. Capitulino2006-06-211-8/+6
| | | | | | | | | Some usbserial functions returns -EINVAL if the port doesn't exist or if it's not opened. However, the right error code for such situations is -ENODEV. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB Serial: clean tty fields on failed device openFrank Gevaerts2006-06-211-0/+2
| | | | | | | | | | If either the driver's open() method or try_module_get() fails, we need to set 'tty->driver_data' and 'port->tty' to NULL in serial_open(), otherwise we'll get an OOPS in usb_device_disconnect() when the device is disconnected. Signed-off-by: Frank Gevaerts <frank.gevaerts@fks.be> Acked-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: rmmod pl2303 after -28Pete Zaitcev2006-06-211-0/+2
| | | | | | | | Wait for the scheduled work to finish before freeing memory, prevent oops. http://bugzilla.kernel.org/show_bug.cgi?id=6596 Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB serial: encapsulate schedule_work, remove double-callingPete Zaitcev2006-06-211-2/+12
| | | | | | | | | | | I'm going to throw schedule_work away, it's retarded. But for starters, let's have it encapsulated. Also, generic and whiteheat were both calling usb_serial_port_softint and scheduled work. Only one was necessary. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB console: fix disconnection issuesGuennadi Liakhovetski2006-06-211-5/+11
| | | | | | | | Prevent sending further output to a USB-serial console after the dongle is disconnected, take care not to leak kref. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: console: prevent ENODEV on nodePaul Fulghum2006-06-211-5/+5
| | | | | | | | Prevent ENODEV on a /dev/ttyUSBx, used as a USB-serial console. From: Paul Fulghum <paulkf@microgate.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] usbserial: Fixes leak in serial_open() error path.Luiz Fernando Capitulino2006-05-121-6/+11
| | | | | | | | | | If serial_open() fails at the port assignment or mutex_lock_interruptible() is interrupted, the 'serial' object will never be freed. We should call kref_put() when those errors happens. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] usbserial: Fixes use-after-free in serial_open().Luiz Fernando Capitulino2006-05-121-1/+1
| | | | | | | | | | | | | | | If the device is disconnected while serial_open() is executing and either try_module_get() or the device specific open function fails, the kref_put() call in the 'bailout_kref_put' label will free the memory pointed out by 'port'. The subsequent dereferences in the 'bailout_kref_put' label will be invalid. The fix is just to assure kref_put() is called after any 'port' usage. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB serial: Converts port semaphore to mutexes.Luiz Fernando Capitulino2006-04-141-8/+8
| | | | | | | | | The usbserial's port semaphore used to synchronize serial_open() and serial_close() are strict mutexes, convert them to the mutex implementation. Signed-off-by: Luiz Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: kzalloc() conversion for rest of drivers/usbEric Sesterhenn2006-03-201-4/+2
| | | | | Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB Serial: fix use-after-free bug in usb-serial coreGreg Kroah-Hartman2006-03-061-5/+5
| | | | | | | | | | | This fixes a use-after-free bug in the usb-serial core. It is simple to trigger this (open a usb-serial port, then yank the device out before closing the port.) Thanks to Stefan Seyfried <seife@suse.de> for reporting this, and to the slab debugging code which enabled it to be tracked down. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* spelling: s/trough/through/Adrian Bunk2006-01-101-1/+1
| | | | | | Additionally, one comment was reformulated by Joe Perches <joe@perches.com>. Signed-off-by: Adrian Bunk <bunk@stusta.de>
* [PATCH] USB: usbserial: race-condition fix.Luiz Fernando Capitulino2006-01-041-1/+13
| | | | | | | | | | | | | | | | | | | There is a race-condition in usb-serial driver that can be triggered if a processes does 'port->tty->driver_data = NULL' in serial_close() while other processes is in kernel-space about to call serial_ioctl() on the same port. This happens because a process can open the device while there is another one closing it. The patch below fixes that by adding a semaphore to ensure that no process will open the device while another process is closing it. Note that we can't use spinlocks here, since serial_open() and serial_close() can sleep. Signed-off-by: Luiz Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: usbserial: Adds missing checks and bug fix.Luiz Fernando Capitulino2006-01-041-0/+32
| | | | | | | | Checks if 'port' is NULL before using it in all tty operations, this can avoid NULL pointer dereferences. Signed-off-by: Luiz Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: remove .owner field from struct usb_driverGreg Kroah-Hartman2006-01-041-1/+0
| | | | | | It is no longer needed, so let's remove it, saving a bit of memory. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: allow usb drivers to disable dynamic idsGreg Kroah-Hartman2006-01-041-0/+1
| | | | | | | | | | | This lets drivers, like the usb-serial ones, disable the ability to add ids from sysfs. The usb-serial drivers are "odd" in that they are really usb-serial bus drivers, not usb bus drivers, so the dynamic id logic will have to go into the usb-serial bus core for those drivers to get that ability. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB Serial: remove driver version from a few driversGreg Kroah-Hartman2005-10-281-4/+2
| | | | | | | | | | | | These numbers are pointless, as they have not been changed in _years_, so we should just remove them to stop pretending there is an actual "version number" for these drivers. This should also help reduce confusion when people try to ask for support of a specific driver version, as there has been no way to tell what they are talking about. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB Serial: move name to driver structureGreg Kroah-Hartman2005-10-281-6/+9
| | | | | | | | This fixes up a lot of problems in sysfs with some of the usb serial drivers, they had incorrect driver names. Also saves a tiny ammount of memory. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB Serial: move old changelog comments out of source codeGreg Kroah-Hartman2005-10-281-307/+2
| | | | | | | Create a new file just for these things, as they just get in the way in the source files. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB Serial: get rid of the .owner field in usb_serial_driverGreg Kroah-Hartman2005-10-281-11/+11
| | | | | | Don't duplicate something that's already in struct driver. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB Serial: rename usb_serial_device_type to usb_serial_driverGreg Kroah-Hartman2005-10-281-15/+15
| | | | | | | I'm tired of trying to explain why a "device_type" is really a driver. This better describes exactly what this structure is. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: drivers/serial/usb-serial: Remove unneeded void * castsTobias Klauser2005-09-081-12/+12
| | | | | | | | | The following patch removes unneeded casts for the following (void *) pointers: - tty_struct->driver_data - void *private argument of usb_serial_port_softint() Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] USB: add ability for usb-serial drivers to determine if their write ↵Greg Kroah-Hartman2005-06-271-0/+1
| | | | | | | | urb is currently being used. This removes a lot of racy and buggy code by trying to check the status of the urb. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
OpenPOWER on IntegriCloud