diff options
author | 2009-09-01 11:38:59 -0400 | |
---|---|---|
committer | 2009-09-19 13:13:40 -0700 | |
commit | 8bc2c1b2daf95029658868cb1427baea2da87139 (patch) | |
tree | 9895248e23de85d55a4d4ec9234aec7e58de285b /lib/dma-debug.c | |
parent | usb-serial: put subroutines in logical order (diff) | |
download | linux-dev-8bc2c1b2daf95029658868cb1427baea2da87139.tar.xz linux-dev-8bc2c1b2daf95029658868cb1427baea2da87139.zip |
usb-serial: change logic of serial lookups
This patch (as1286) changes usb_serial_get_by_index(). Now the
routine will check whether the serial device has been disconnected; if
it has then the return value will be NULL. If the device hasn't been
disconnected then the routine will return with serial->disc_mutex
held, so that the caller can use the structure without fear of racing
against driver unloads.
This permits the scope of table_mutex in destroy_serial() to be
reduced. Instead of protecting the entire function, it suffices to
protect the part that actually uses serial_table[], i.e., the call to
return_serial(). There's no longer any danger of the refcount being
incremented after it reaches 0 (which was the reason for having the
large scope previously), because it can't reach 0 until the serial
device has been disconnected.
Also, the patch makes serial_install() check that serial is non-NULL
before attempting to use it.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib/dma-debug.c')
0 files changed, 0 insertions, 0 deletions