Searched hist:"9 ed19428a51d53477e2b79be3303fa08f8575749" (Results 1 – 2 of 2) sorted by relevance
/linux/include/linux/ |
H A D | serial_core.h | diff 9ed19428a51d53477e2b79be3303fa08f8575749 Sun Apr 10 03:56:34 CEST 2016 Peter Hurley <peter@hurleysoftware.com> serial: core: Prevent unsafe uart port access, part 2
For serial core operations not already excluded by holding port->mutex, use reference counting to protect deferencing the state->uart_port.
Introduce helper functions, uart_port_ref() and uart_port_deref(), to wrap uart_port access, and helper macros, uart_port_lock() and uart_port_unlock(), to wrap combination uart_port access with uart port lock sections.
Port removal in uart_remove_one_port() waits for reference count to drop to zero before detaching the uart port from struct uart_state.
For functions only reading the tx circular buffer indexes (where the uart port lock is claimed to prevent concurrent users), a NULL uart port is simply ignored and the operation completes normally.
For functions change the tx circular buffer indexes (where the uart port lock is claimed to prevent concurrent users), the operation is aborted if the uart port is NULL (ie., has been detached).
Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
/linux/drivers/tty/serial/ |
H A D | serial_core.c | diff 9ed19428a51d53477e2b79be3303fa08f8575749 Sun Apr 10 03:56:34 CEST 2016 Peter Hurley <peter@hurleysoftware.com> serial: core: Prevent unsafe uart port access, part 2
For serial core operations not already excluded by holding port->mutex, use reference counting to protect deferencing the state->uart_port.
Introduce helper functions, uart_port_ref() and uart_port_deref(), to wrap uart_port access, and helper macros, uart_port_lock() and uart_port_unlock(), to wrap combination uart_port access with uart port lock sections.
Port removal in uart_remove_one_port() waits for reference count to drop to zero before detaching the uart port from struct uart_state.
For functions only reading the tx circular buffer indexes (where the uart port lock is claimed to prevent concurrent users), a NULL uart port is simply ignored and the operation completes normally.
For functions change the tx circular buffer indexes (where the uart port lock is claimed to prevent concurrent users), the operation is aborted if the uart port is NULL (ie., has been detached).
Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|