All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clockevents: Match the CPU when unbinding devices via sysfs
@ 2026-11-01 14:11 Avi Weiss
  2026-11-03 13:52 ` Frederic Weisbecker
  2026-11-09 19:53 ` [tip: timers/core] " tip-bot2 for Avi Weiss
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Weiss @ 2026-11-01 14:11 UTC (permalink / raw)
  To: anna-maria, frederic, tglx; +Cc: linux-kernel, Avi Weiss

Clockevent devices belonging to different CPUs can share the same
name. The sysfs unbind handler selects the first matching name from
the global device list, which can cause a request for one CPU to
unbind another CPU's device or incorrectly return -EBUSY.

Check the device's CPU mask when selecting the clockevent to unbind
so that the request targets a device eligible for the specified CPU.

Fixes: 03e13cf5ee60 ("clockevents: Implement unbind functionality")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 kernel/time/clockevents.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 62ad7c000386..05e9d966b024 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -756,7 +756,8 @@ static ssize_t unbind_device_store(struct device *dev,
 	mutex_lock(&clockevents_mutex);
 	raw_spin_lock_irq(&clockevents_lock);
 	list_for_each_entry(iter, &clockevent_devices, list) {
-		if (!strcmp(iter->name, name)) {
+		if (!strcmp(iter->name, name) &&
+		    cpumask_test_cpu(dev->id, iter->cpumask)) {
 			ret = __clockevents_try_unbind(iter, dev->id);
 			ce = iter;
 			break;

base-commit: cbbddb6b08cc9900a87cccaa9b22bbe06aa4f50a
-- 
2.53.0


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

* Re: [PATCH] clockevents: Match the CPU when unbinding devices via sysfs
  2026-11-01 14:11 [PATCH] clockevents: Match the CPU when unbinding devices via sysfs Avi Weiss
@ 2026-11-03 13:52 ` Frederic Weisbecker
  2026-11-09 19:53 ` [tip: timers/core] " tip-bot2 for Avi Weiss
  1 sibling, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2026-11-03 13:52 UTC (permalink / raw)
  To: Avi Weiss; +Cc: anna-maria, tglx, linux-kernel

Le Sun, Nov 01, 2026 at 04:11:20PM +0200, Avi Weiss a écrit :
> Clockevent devices belonging to different CPUs can share the same
> name. The sysfs unbind handler selects the first matching name from
> the global device list, which can cause a request for one CPU to
> unbind another CPU's device or incorrectly return -EBUSY.
> 
> Check the device's CPU mask when selecting the clockevent to unbind
> so that the request targets a device eligible for the specified CPU.
> 
> Fixes: 03e13cf5ee60 ("clockevents: Implement unbind functionality")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>

-- 
Frederic Weisbecker
SUSE Labs

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

* [tip: timers/core] clockevents: Match the CPU when unbinding devices via sysfs
  2026-11-01 14:11 [PATCH] clockevents: Match the CPU when unbinding devices via sysfs Avi Weiss
  2026-11-03 13:52 ` Frederic Weisbecker
@ 2026-11-09 19:53 ` tip-bot2 for Avi Weiss
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Avi Weiss @ 2026-11-09 19:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Avi Weiss, Thomas Gleixner, Frederic Weisbecker, x86,
	linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     6b1f622e0a725e0b9a3dc36c24276d24b5b6e295
Gitweb:        https://git.kernel.org/tip/6b1f622e0a725e0b9a3dc36c24276d24b5b6e295
Author:        Avi Weiss <thnkslprpt@gmail.com>
AuthorDate:    Sun, 01 Nov 2026 16:11:20 +02:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Mon, 09 Nov 2026 20:25:25 +01:00

clockevents: Match the CPU when unbinding devices via sysfs

Clockevent devices belonging to different CPUs can share the same
name. The sysfs unbind handler selects the first matching name from
the global device list, which can cause a request for one CPU to
unbind another CPU's device or incorrectly return -EBUSY.

Check the device's CPU mask when selecting the clockevent to unbind
so that the request targets a device eligible for the specified CPU.

Fixes: 03e13cf5ee60 ("clockevents: Implement unbind functionality")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://patch.msgid.link/20261101141120.367124-1-thnkslprpt@gmail.com
---
 kernel/time/clockevents.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 62ad7c0..05e9d96 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -756,7 +756,8 @@ static ssize_t unbind_device_store(struct device *dev,
 	mutex_lock(&clockevents_mutex);
 	raw_spin_lock_irq(&clockevents_lock);
 	list_for_each_entry(iter, &clockevent_devices, list) {
-		if (!strcmp(iter->name, name)) {
+		if (!strcmp(iter->name, name) &&
+		    cpumask_test_cpu(dev->id, iter->cpumask)) {
 			ret = __clockevents_try_unbind(iter, dev->id);
 			ce = iter;
 			break;

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

end of thread, other threads:[~2026-11-09 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 14:11 [PATCH] clockevents: Match the CPU when unbinding devices via sysfs Avi Weiss
2026-11-03 13:52 ` Frederic Weisbecker
2026-11-09 19:53 ` [tip: timers/core] " tip-bot2 for Avi Weiss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.