From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Markus Probst <markus.probst@posteo.de>
Cc: "Ayush Singh" <ayush@beagleboard.org>,
"Johan Hovold" <johan@kernel.org>,
"Alex Elder" <elder@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Eric Biggers" <ebiggers@kernel.org>,
"Ard Biesheuvel" <ardb@kernel.org>,
"Lorenzo Stoakes" <ljs@kernel.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Uladzislau Rezki" <urezki@gmail.com>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
greybus-dev@lists.linaro.org, linux-serial@vger.kernel.org,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
driver-core@lists.linux.dev
Subject: Re: [PATCH v4 1/4] tty: serdev: Add mutex lock
Date: Sat, 17 Oct 2026 09:55:14 +0200 [thread overview]
Message-ID: <2026101715-penny-headfirst-1644@gregkh> (raw)
In-Reply-To: <20261016-rust_serdev_probe_refactor-v4-1-46832e034757@posteo.de>
On Fri, Oct 16, 2026 at 06:00:32PM +0000, Markus Probst wrote:
> Besides more predictable behaviour, this allows for several hardened
> behaviour changes:
>
> Return -EALREADY in `serdev_device_open` if the device is already open
> instead of causing undefined behaviour.
>
> Allow calling `serdev_device_close`, even if the device is already
> closed instead of causing a null pointer dereference.
>
> If the device is left open by the driver after remove, close it and warn
> instead of leaving it in a invalid state.
>
> Signed-off-by: Markus Probst <markus.probst@posteo.de>
> ---
> drivers/tty/serdev/core.c | 10 +++++---
> drivers/tty/serdev/serdev-ttyport.c | 46 +++++++++++++++++++++++++++++++------
> include/linux/serdev.h | 2 +-
> 3 files changed, 47 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 7500efcdfc21..77e8e1d4d2a6 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -142,6 +142,11 @@ void serdev_device_remove(struct serdev_device *serdev)
> struct serdev_controller *ctrl = serdev->ctrl;
>
> device_unregister(&serdev->dev);
> +
> + /* Warn if driver did not close the serial device. */
> + if (ctrl->ops->close && WARN_ON(ctrl->ops->close(ctrl)))
> + pm_runtime_put(&ctrl->dev);
Wait, how can close() ever fail? That should be something that just
can't happen right?
thanks,
greg k-h
next prev parent reply other threads:[~2026-10-17 7:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 18:00 [PATCH v4 0/4] rust: serdev: Refactor Markus Probst
2026-10-16 18:00 ` [PATCH v4 1/4] tty: serdev: Add mutex lock Markus Probst
2026-10-16 18:15 ` sashiko-bot
2026-10-17 7:53 ` Greg Kroah-Hartman
2026-10-17 7:55 ` Greg Kroah-Hartman [this message]
2026-10-17 10:49 ` Markus Probst
2026-10-16 18:00 ` [PATCH v4 2/4] tty: serdev: Export functions to pause receive_buf callback calls Markus Probst
2026-10-16 18:13 ` sashiko-bot
2026-10-16 18:00 ` [PATCH v4 3/4] rust: serdev: Replace `active` mutex with receive pause Markus Probst
2026-10-16 18:11 ` sashiko-bot
2026-10-16 18:00 ` [PATCH v4 4/4] rust: serdev: Simplify callbacks Markus Probst
2026-10-16 18:17 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026101715-penny-headfirst-1644@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=ardb@kernel.org \
--cc=ayush@beagleboard.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=driver-core@lists.linux.dev \
--cc=ebiggers@kernel.org \
--cc=elder@kernel.org \
--cc=gary@garyguo.net \
--cc=greybus-dev@lists.linaro.org \
--cc=jirislaby@kernel.org \
--cc=johan@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=lossin@kernel.org \
--cc=markus.probst@posteo.de \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=urezki@gmail.com \
--cc=vbabka@kernel.org \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox