mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: pavankumaryalagada@gmail.com
To: anna-maria@linutronix.de
Cc: frederic@kernel.org, tglx@kernel.org,
	linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
	Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>,
	syzbot+143e0859898751aa8f94@syzkaller.appspotmail.com
Subject: [PATCH] posix-timers: fix IRQ state handling in posix_timer_delete()
Date: Wed, 26 Aug 2026 01:36:26 +0530	[thread overview]
Message-ID: <20260825200626.139243-1-pavankumaryalagada@gmail.com> (raw)

From: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>

exit_itimers() uses a spinlock_irq guard for timer->it_lock, which
maintains counted IRQ-disable state. However, posix_timer_delete()
temporarily releases and reacquires the lock with spin_unlock_irq()
and spin_lock_irq(), which do not maintain the same IRQ-disable state
while timer_wait_running() may sleep.

Use spin_unlock_irq_enable() and spin_lock_irq_disable() for the
temporary lock handoff to keep the IRQ-disable state balanced.

Reported-by: syzbot+143e0859898751aa8f94@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=143e0859898751aa8f94
Tested-by: syzbot+143e0859898751aa8f94@syzkaller.appspotmail.com
Signed-off-by: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
---
 kernel/time/posix-timers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 436ba794cc0b..5e580b4223de 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -1057,9 +1057,9 @@ static void posix_timer_delete(struct k_itimer *timer)
 
 	while (timer->kclock->timer_del(timer) == TIMER_RETRY) {
 		guard(rcu)();
-		spin_unlock_irq(&timer->it_lock);
+		spin_unlock_irq_enable(&timer->it_lock);
 		timer_wait_running(timer);
-		spin_lock_irq(&timer->it_lock);
+		spin_lock_irq_disable(&timer->it_lock);
 	}
 }
 
-- 
2.43.0


             reply	other threads:[~2026-08-25 20:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 20:06 pavankumaryalagada [this message]
2026-08-25 21:22 ` Thomas Gleixner

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=20260825200626.139243-1-pavankumaryalagada@gmail.com \
    --to=pavankumaryalagada@gmail.com \
    --cc=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=syzbot+143e0859898751aa8f94@syzkaller.appspotmail.com \
    --cc=tglx@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

all inboxes | Powered by JetHome®