public inbox for autofs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spin_lock_irqsave() in autofs_write() is bogus
@ 2025-08-17 16:36 Al Viro
  2025-08-17 16:50 ` Linus Torvalds
  2025-08-17 18:34 ` Paul Menzel
  0 siblings, 2 replies; 5+ messages in thread
From: Al Viro @ 2025-08-17 16:36 UTC (permalink / raw)
  To: Ian Kent; +Cc: Linus Torvalds, autofs, linux-kernel

	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(&current->sighand->siglock, flags);
+		spin_lock_irq(&current->sighand->siglock);
 		sigdelset(&current->pending.signal, SIGPIPE);
 		recalc_sigpending();
-		spin_unlock_irqrestore(&current->sighand->siglock, flags);
+		spin_unlock_irq(&current->sighand->siglock);
 	}
 
 	/* if 'wr' returned 0 (impossible) we assume -EIO (safe) */

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-21 12:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-17 16:36 [PATCH] spin_lock_irqsave() in autofs_write() is bogus 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox