From: Jiri Slaby <jirislaby@kernel.org>
To: "Max Staudt" <max@enpas.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Johan Hovold <johan@kernel.org>,
linux-serial <linux-serial@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH v2 2/2] tty: Fix race against tty_open() in tty_register_device_attr()
Date: Tue, 3 Jun 2025 15:43:09 +0200 [thread overview]
Message-ID: <2a5432be-41b7-4adc-b68a-1f706036a59f@kernel.org> (raw)
In-Reply-To: <16cc8c9d-f89a-406c-9427-94ca75984752@enpas.org>
On 02. 06. 25, 15:40, Max Staudt wrote:
> On 6/2/25 19:31, Ilpo Järvinen wrote:
>>> + mutex_lock(&tty_mutex);
>>
>> Use guard() so you don't need to change the returns and rollback path.
>
> Thanks, I didn't know about this new kind of helper.
>
> I'll leave it up to the TTY maintainers - if they don't express a
> preference for guard(),
I prefer guard(). Actually, I have a patchset to add a support for
guard() for uart_lock and console_lock too and use it all over (incl.
__free). They untangle the code on many places and get rid of much
unneeded churn.
But in this very case, I see there is a label, I am not sure if it works
right here. Try compiling with clang -- it will tell you. You likely
won't cross the label with the guard().
thanks,
--
js
suse labs
next prev parent reply other threads:[~2025-06-03 13:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 13:28 [PATCH v2 1/2] tty: Register device *after* creating the cdev for a tty Max Staudt
2025-05-28 13:28 ` [PATCH v2 2/2] tty: Fix race against tty_open() in tty_register_device_attr() Max Staudt
2025-06-02 10:31 ` Ilpo Järvinen
2025-06-02 13:40 ` Max Staudt
2025-06-03 13:43 ` Jiri Slaby [this message]
2025-06-03 8:49 ` kernel test robot
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=2a5432be-41b7-4adc-b68a-1f706036a59f@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=max@enpas.org \
--cc=stable@vger.kernel.org \
/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