summaryrefslogtreecommitdiff
path: root/Documentation/serial
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-10-17 00:54:20 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 05:53:54 +0300
commit7c8ab967e3cd1513cd79fd5edc404fb43c7f3a96 (patch)
tree2fadec4ea6f6d183b2b6e5b81453a57b8670e390 /Documentation/serial
parent2e758910832dce99761a29688b33fd77dcbf6f6c (diff)
downloadlinux-7c8ab967e3cd1513cd79fd5edc404fb43c7f3a96.tar.xz
serial: Fix locking for uart driver set_termios() method
The low-level uart driver may modify termios settings to override settings that are not compatible with the uart, such as CRTSCTS. Thus, callers of the low-level uart driver's set_termios() method must hold termios_rwsem write lock to prevent concurrent access to termios, in case such override occurs. The termios_rwsem lock requirement does not extend to console setup (ie., uart_set_options), as console setup cannot race with tty operations. Nor does this lock requirement extend to functions which cannot be concurrent with tty ioctls (ie., uart_port_startup() and uart_resume_port()). Further, always claim the port mutex to protect hardware re-reprogramming in the set_termios() uart driver method. Note this is unnecessary for console initialization in uart_set_options() which cannot be concurrent with other uart operations. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/serial')
-rw-r--r--Documentation/serial/driver6
1 files changed, 4 insertions, 2 deletions
diff --git a/Documentation/serial/driver b/Documentation/serial/driver
index ba64e4b892e9..c415b0ef4493 100644
--- a/Documentation/serial/driver
+++ b/Documentation/serial/driver
@@ -59,7 +59,9 @@ The core driver uses the info->tmpbuf_sem lock to prevent multi-threaded
access to the info->tmpbuf bouncebuffer used for port writes.
The port_sem semaphore is used to protect against ports being added/
-removed or reconfigured at inappropriate times.
+removed or reconfigured at inappropriate times. Since v2.6.27, this
+semaphore has been the 'mutex' member of the tty_port struct, and
+commonly referred to as the port mutex (or port->mutex).
uart_ops
@@ -248,7 +250,7 @@ hardware.
Other flags may be used (eg, xon/xoff characters) if your
hardware supports hardware "soft" flow control.
- Locking: none.
+ Locking: caller holds port->mutex
Interrupts: caller dependent.
This call must not sleep