[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2a5432be-41b7-4adc-b68a-1f706036a59f@kernel.org>
Date: Tue, 3 Jun 2025 15:43:09 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Max Staudt <max@...as.org>, Ilpo Järvinen
<ilpo.jarvinen@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Johan Hovold <johan@...nel.org>, linux-serial
<linux-serial@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
stable@...r.kernel.org
Subject: Re: [PATCH v2 2/2] tty: Fix race against tty_open() in
tty_register_device_attr()
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
Powered by blists - more mailing lists