]> Gentwo Git Trees - linux/.git/commit
genirq/proc: Fix race in show_irq_affinity()
authorMuchun Song <songmuchun@bytedance.com>
Tue, 28 Oct 2025 09:04:08 +0000 (17:04 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 31 Oct 2025 21:30:05 +0000 (22:30 +0100)
commit9ea2b810d51ae662cc5b5578f9395cb620a34a26
tree20f5697e83d7b0281c5b65745169305a84e9e72c
parent68c4c159a0db4409a5d6b5f4703d71b89a96f06a
genirq/proc: Fix race in show_irq_affinity()

Reading /proc/irq/N/smp_affinity* races with irq_set_affinity() and
irq_move_masked_irq(), leading to old or torn output for users.

After a user writes a new CPU mask to /proc/irq/N/affinity*, the syscall
returns success, yet a subsequent read of the same file immediately returns
a value different from what was just written.

That's due to a race between show_irq_affinity() and irq_move_masked_irq()
which lets the read observe a transient, inconsistent affinity mask.

Cure it by guarding the read with irq_desc::lock.

[ tglx: Massaged change log ]

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251028090408.76331-1-songmuchun@bytedance.com
kernel/irq/proc.c