From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Al Viro <viro@zeniv.linux.org.uk>, Ian Kent <raven@themaw.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
autofs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spin_lock_irqsave() in autofs_write() is bogus
Date: Sun, 17 Aug 2025 20:34:35 +0200 [thread overview]
Message-ID: <c1ccb74a-d715-41a7-862b-3038323d8091@molgen.mpg.de> (raw)
In-Reply-To: <20250817163609.GV222315@ZenIV>
Dear Al,
Am 17.08.25 um 18:36 schrieb Al Viro:
> That function should never be (and never is) called with irqs
> disabled - we have an explicit mutex_lock() in there, if nothing else.
> Which makes spin_lock_irqsave() use in there pointless - we do need to
> disable irqs for ->siglock, but that should be spin_lock_irq().
>
> The history is interesting - it goes all way back to 2.1.68pre1,
> and that obviously was a tree-wide work. Might be interesting to look
> for other places with just-in-case spin_lock_irqsave()...
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
> index 33dd4660d82f..4dc226e86360 100644
> --- a/fs/autofs/waitq.c
> +++ b/fs/autofs/waitq.c
> @@ -46,7 +46,7 @@ void autofs_catatonic_mode(struct autofs_sb_info *sbi)
> static int autofs_write(struct autofs_sb_info *sbi,
> struct file *file, const void *addr, int bytes)
> {
> - unsigned long sigpipe, flags;
> + unsigned long sigpipe;
> const char *data = (const char *)addr;
> ssize_t wr = 0;
>
> @@ -66,10 +66,10 @@ static int autofs_write(struct autofs_sb_info *sbi,
> * SIGPIPE unless it was already supposed to get one
> */
> if (wr == -EPIPE && !sigpipe) {
> - spin_lock_irqsave(¤t->sighand->siglock, flags);
> + spin_lock_irq(¤t->sighand->siglock);
> sigdelset(¤t->pending.signal, SIGPIPE);
> recalc_sigpending();
> - spin_unlock_irqrestore(¤t->sighand->siglock, flags);
> + spin_unlock_irq(¤t->sighand->siglock);
> }
>
> /* if 'wr' returned 0 (impossible) we assume -EIO (safe) */
>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
prev parent reply other threads:[~2025-08-17 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-17 16:36 Al Viro
2025-08-17 16:50 ` Linus Torvalds
2025-08-17 17:47 ` Al Viro
2025-08-21 12:03 ` David Laight
2025-08-17 18:34 ` Paul Menzel [this message]
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=c1ccb74a-d715-41a7-862b-3038323d8091@molgen.mpg.de \
--to=pmenzel@molgen.mpg.de \
--cc=autofs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=raven@themaw.net \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®