Linux EDAC development
 help / color / mirror / Atom feed
From: Jad Keskes <inasj268@gmail.com>
To: Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jad Keskes <inasj268@gmail.com>
Subject: [PATCH 2/2] edac: edac_device: don't re-arm workqueue during teardown
Date: Wed,  8 Jul 2026 15:10:00 +0100	[thread overview]
Message-ID: <20260708141000.1764100-2-inasj268@gmail.com> (raw)
In-Reply-To: <20260708141000.1764100-1-inasj268@gmail.com>

edac_device_del_device stops the workqueue then removes the sysfs
attributes.  But the sysfs store for poll_msec calls
edac_device_reset_delay_period which unconditionally re-arms the
workqueue.  If someone writes to poll_msec in that window, the
re-armed work runs after edac_dev is freed.

Check op_state instead.  del_device already sets it to OP_OFFLINE
before tearing down the workqueue, so reset_delay_period will see
it and skip the mod_work call.

Signed-off-by: Jad Keskes <inasj268@gmail.com>
---
 drivers/edac/edac_device.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index cf0d3c2dfc04..50ae7f1e5152 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -354,6 +354,10 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
 	edac_dev->poll_msec = msec;
 	edac_dev->delay	    = msecs_to_jiffies(msec);
 
+	/* Don't re-arm the workqueue if the device is being torn down */
+	if (edac_dev->op_state == OP_OFFLINE)
+		return;
+
 	/* See comment in edac_device_workq_setup() above */
 	if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL)
 		edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
-- 
2.55.0


  reply	other threads:[~2026-07-08 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 14:09 [PATCH 1/2] edac: edac_device_sysfs: reject poll_msec value 0 Jad Keskes
2026-07-08 14:10 ` Jad Keskes [this message]
2026-07-10  3:24 ` Borislav Petkov

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=20260708141000.1764100-2-inasj268@gmail.com \
    --to=inasj268@gmail.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /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