This is a note to let you know that I've just added the patch titled staging: greybus: uart: Fix atomicity violation in get_serial_info() to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: staging-greybus-uart-fix-atomicity-violation-in-get_.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit be8fa963ec0b0e359b07ab763a7a10f460e2ddde Author: Qiu-ji Chen <chenqiuji666@xxxxxxxxx> Date: Thu Nov 7 19:33:37 2024 +0800 staging: greybus: uart: Fix atomicity violation in get_serial_info() [ Upstream commit fe0ebeafc3b723b2f8edf27ecec6d353b08397df ] Our static checker found a bug where set_serial_info() uses a mutex, but get_serial_info() does not. Fortunately, the impact of this is relatively minor. It doesn't cause a crash or any other serious issues. However, if a race condition occurs between set_serial_info() and get_serial_info(), there is a chance that the data returned by get_serial_info() will be meaningless. Signed-off-by: Qiu-ji Chen <chenqiuji666@xxxxxxxxx> Fixes: 0aad5ad563c8 ("greybus/uart: switch to ->[sg]et_serial()") Reviewed-by: Johan Hovold <johan+linaro@xxxxxxxxxx> Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Reviewed-by: Alex Elder <elder@xxxxxxxxxxxx> Link: https://lore.kernel.org/r/20241107113337.402042-1-chenqiuji666@xxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index dc4ed0ff1ae27..b6b136d6a691d 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -597,11 +597,13 @@ static int get_serial_info(struct tty_struct *tty, struct gb_tty *gb_tty = tty->driver_data; ss->line = gb_tty->minor; + mutex_lock(&gb_tty->port.mutex); ss->close_delay = jiffies_to_msecs(gb_tty->port.close_delay) / 10; ss->closing_wait = gb_tty->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? ASYNC_CLOSING_WAIT_NONE : jiffies_to_msecs(gb_tty->port.closing_wait) / 10; + mutex_unlock(&gb_tty->port.mutex); return 0; }