* [PATCH] serial: core: Don't drop port_mutex in serial_core_remove_one_port
@ 2023-06-01 10:55 Steven Price
2023-06-01 10:58 ` Tony Lindgren
0 siblings, 1 reply; 2+ messages in thread
From: Steven Price @ 2023-06-01 10:55 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Tony Lindgren
Cc: linux-kernel, linux-serial, Andy Shevchenko, linux-omap,
Vignesh Raghavendra, Sebastian Andrzej Siewior, Johan Hovold,
John Ogness, Ilpo Järvinen, Dhruva Gole, Steven Price
Commit 84a9582fd203 ("serial: core: Start managing serial controllers to
enable runtime PM") required the caller to hold port_mutex rather than
taking it locally. However the mutex_unlock() call wasn't removed
causing the mutex to be dropped unexpectly. Remove the call to
mutex_unlock() (and fix up the early return) to restore correct
behaviour.
Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
Signed-off-by: Steven Price <steven.price@arm.com>
---
drivers/tty/serial/serial_core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 29bd5ede0b25..efda90215ee9 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3194,7 +3194,7 @@ static void serial_core_remove_one_port(struct uart_driver *drv,
if (!uart_port) {
mutex_unlock(&port->mutex);
- goto out;
+ return;
}
mutex_unlock(&port->mutex);
@@ -3234,8 +3234,6 @@ static void serial_core_remove_one_port(struct uart_driver *drv,
wait_event(state->remove_wait, !atomic_read(&state->refcount));
state->uart_port = NULL;
mutex_unlock(&port->mutex);
-out:
- mutex_unlock(&port_mutex);
}
/**
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: core: Don't drop port_mutex in serial_core_remove_one_port
2023-06-01 10:55 [PATCH] serial: core: Don't drop port_mutex in serial_core_remove_one_port Steven Price
@ 2023-06-01 10:58 ` Tony Lindgren
0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2023-06-01 10:58 UTC (permalink / raw)
To: Steven Price
Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial,
Andy Shevchenko, linux-omap, Vignesh Raghavendra,
Sebastian Andrzej Siewior, Johan Hovold, John Ogness,
Ilpo Järvinen, Dhruva Gole
* Steven Price <steven.price@arm.com> [230601 10:56]:
> Commit 84a9582fd203 ("serial: core: Start managing serial controllers to
> enable runtime PM") required the caller to hold port_mutex rather than
> taking it locally. However the mutex_unlock() call wasn't removed
> causing the mutex to be dropped unexpectly. Remove the call to
> mutex_unlock() (and fix up the early return) to restore correct
> behaviour.
>
> Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
Reviewed-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-01 10:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01 10:55 [PATCH] serial: core: Don't drop port_mutex in serial_core_remove_one_port Steven Price
2023-06-01 10:58 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).