diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-12 15:14:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-12 15:14:19 -0400 |
| commit | 0d38eddab9ce6de3a9d6d583043dfa97b6bc0d3b (patch) | |
| tree | 59f1f4d3712ce3658f7540704d64c8d8ad6d4635 /drivers/usb/serial/usb-serial.c | |
| parent | 1a2acc9e9214699a99389e323e6686e9e0e2ca67 (diff) | |
| parent | df3fccb14ad02c5fabe095a104a0323c223f2833 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6:
[PATCH] USB: fix omninet driver bug
[PATCH] USB: add ark3116 usb to serial driver
[PATCH] usbserial: Fixes leak in serial_open() error path.
[PATCH] usbserial: Fixes use-after-free in serial_open().
[PATCH] USB: Emagic USB firmware loading fixes
[PATCH] USB: add an IBM USB keyboard to the HID_QUIRK_NOGET blacklist
[PATCH] USB: Add Sieraa Wireless 580 evdo card to airprime.c
[PATCH] USB: ftdi_sio: add device id for ACT Solutions HomePro ZWave interface
[PATCH] USB: ftdi_sio: Add support for HCG HF Dual ISO RFID Reader
[PATCH] USB: ub oops in block_uevent
[PATCH] USB: usbcore: don't check the device's power source
[PATCH] USB: fix OHCI PM regression
[PATCH] USB: pegasus fixes (logstorm, suspend)
[PATCH] USBATM: fix modinfo output
[PATCH] USBATM: change the default speedtouch iso altsetting
[PATCH] USB: fix bug in ohci-hcd.c ohci_restart()
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
| -rw-r--r-- | drivers/usb/serial/usb-serial.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 071f86a59c08..9c36f0ece20f 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
| @@ -189,11 +189,15 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
| 189 | 189 | ||
| 190 | portNumber = tty->index - serial->minor; | 190 | portNumber = tty->index - serial->minor; |
| 191 | port = serial->port[portNumber]; | 191 | port = serial->port[portNumber]; |
| 192 | if (!port) | 192 | if (!port) { |
| 193 | return -ENODEV; | 193 | retval = -ENODEV; |
| 194 | goto bailout_kref_put; | ||
| 195 | } | ||
| 194 | 196 | ||
| 195 | if (mutex_lock_interruptible(&port->mutex)) | 197 | if (mutex_lock_interruptible(&port->mutex)) { |
| 196 | return -ERESTARTSYS; | 198 | retval = -ERESTARTSYS; |
| 199 | goto bailout_kref_put; | ||
| 200 | } | ||
| 197 | 201 | ||
| 198 | ++port->open_count; | 202 | ++port->open_count; |
| 199 | 203 | ||
| @@ -209,7 +213,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
| 209 | * safe because we are called with BKL held */ | 213 | * safe because we are called with BKL held */ |
| 210 | if (!try_module_get(serial->type->driver.owner)) { | 214 | if (!try_module_get(serial->type->driver.owner)) { |
| 211 | retval = -ENODEV; | 215 | retval = -ENODEV; |
| 212 | goto bailout_kref_put; | 216 | goto bailout_mutex_unlock; |
| 213 | } | 217 | } |
| 214 | 218 | ||
| 215 | /* only call the device specific open if this | 219 | /* only call the device specific open if this |
| @@ -224,10 +228,11 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
| 224 | 228 | ||
| 225 | bailout_module_put: | 229 | bailout_module_put: |
| 226 | module_put(serial->type->driver.owner); | 230 | module_put(serial->type->driver.owner); |
| 227 | bailout_kref_put: | 231 | bailout_mutex_unlock: |
| 228 | kref_put(&serial->kref, destroy_serial); | ||
| 229 | port->open_count = 0; | 232 | port->open_count = 0; |
| 230 | mutex_unlock(&port->mutex); | 233 | mutex_unlock(&port->mutex); |
| 234 | bailout_kref_put: | ||
| 235 | kref_put(&serial->kref, destroy_serial); | ||
| 231 | return retval; | 236 | return retval; |
| 232 | } | 237 | } |
| 233 | 238 | ||
