Re: [PATCH v2 2/2] tty: Fix race against tty_open() in tty_register_device_attr()
From: Max Staudt
Date: Mon Jun 02 2025 - 09:41:23 EST
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(), then I deem this code simple enough to leave it
as-is, because I don't have any experience with guard(), and in fact,
until 5 minutes ago, I didn't know at all that GCC cleanup attributes
even exist.
Interestingly, Documentation/process/maintainer-netdev.rst documents a
preference against guard(). I wonder why, but that's for another day.
Do you have an idea on how to solve the circular lock that the kernel
test robot found for v1 of this patch?
https://lore.kernel.org/linux-serial/202505281412.8c836cb7-lkp@xxxxxxxxx/
Max