From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EB9B1EA65; Thu, 28 May 2026 20:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000174; cv=none; b=TeGhe6taL54bUF0BN7UZomQzUYyc2FCtLJ6I1/tQb11XfxCseEY4QqTlve2+J0xdrpfOP8sOJcxB79hA3G/cFYKmx0eFH/Frc/uxgvK5/ChW+mJoxiXcmIiWLVqobWt58KSLW1WZKSp1yMSHpqoCOBhpHgOC5u5zbX27DNlq0Ck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000174; c=relaxed/simple; bh=0aTDs4zaQmgRa37GmKYlk52GoDQHH18qTDRzuLwV0Ck=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JfYMm9slg99WHCJeYvc0Fptp2Sp2uxBzc7w+4CHdB4Fq8CwPyQ7/j0TGwBhtTJ2/FedczjCGNJ5l6nLuALAOyLHHzL3Eam0lWwsmgm5DypPPfVBXQcotaANZo4cgvsDMrjBvvJFAxKrKw+s5fTdOh/xR+Xp3qArvnp/Rdz8WRaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OnRkciD5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OnRkciD5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCF521F000E9; Thu, 28 May 2026 20:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000173; bh=ZEyrSb0r77UR5aNEyd6d7h3q6U5phaZH0sTJLukf0kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OnRkciD5ZART6lZOkOB+PweVL+Va1GlnGnDqVYPWWK9gmmDz3ueMjwXRvNkKpiYk9 CRrqkXKLsTuBGpuFhR7nQnvZcftVWJW5/tENWPtpDDUGoIqHXIwoGsvbKvDM9vnZCh wqmJQewvRpnKRCej7oILimdZ0EUCgGQu+v8tb8KM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Guenter Roeck , Sasha Levin Subject: [PATCH 6.18 311/377] hwmon: (lm90) Add lock protection to lm90_alert Date: Thu, 28 May 2026 21:49:09 +0200 Message-ID: <20260528194647.386543426@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194638.371537336@linuxfoundation.org> References: <20260528194638.371537336@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck [ Upstream commit 873e919e3101063a7a75989510ccfc125a4391cf ] Sashiko reports: lm90_alert() executes in the smbus alert context and calls lm90_update_confreg() to disable the hardware alert line, without acquiring hwmon_lock. Concurrently, sysfs write operations (such as lm90_write_convrate) hold the hwmon_lock, temporarily modify data->config, and then restore it. If an alert interrupt occurs concurrently with a sysfs write, the sysfs path will overwrite the alert handler's modifications to data->config and the hardware register. This unintentionally re-enables the hardware alert line while the alarm is still active, causing an interrupt storm. Add the missing lock to lm90_alert() to solve the problem. Fixes: 7a1d220ccb0cc ("hwmon: (lm90) Introduce function to update configuration register") Reported-by: Sashiko Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/lm90.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 41ee2309fe8a2..a465a8a7ef5af 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2963,6 +2963,7 @@ static void lm90_alert(struct i2c_client *client, enum i2c_alert_protocol type, */ struct lm90_data *data = i2c_get_clientdata(client); + hwmon_lock(data->hwmon_dev); if (!data->shutdown && (data->flags & LM90_HAVE_BROKEN_ALERT) && (data->current_alarms & data->alert_alarms)) { if (!(data->config & 0x80)) { @@ -2972,6 +2973,7 @@ static void lm90_alert(struct i2c_client *client, enum i2c_alert_protocol type, schedule_delayed_work(&data->alert_work, max_t(int, HZ, msecs_to_jiffies(data->update_interval))); } + hwmon_unlock(data->hwmon_dev); } else { dev_dbg(&client->dev, "Everything OK\n"); } -- 2.53.0