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 027D038C42A; Fri, 7 Aug 2026 15:09:51 +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=1786115392; cv=none; b=SJUCO7RAhZ1/wuZQpGL70E04FZp28grJChc0sHTOFXoJutbv/89Wh7iTgD1CsI/UHohvDu0cscGvlnBZlrCExL4eh9A66cLW8inq6GUBu5umh/dexnUtidXsCHZM3FByHaibkr7dwOmRJInWb/A+e02uJTGnH5GoXy7I5X6G2tk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786115392; c=relaxed/simple; bh=vL39b0VQ29IQjIJ4kh6PW71LjBD5nudiHNWvOn6MlIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ragGNY0Tx6K82l5hqebKalZOoVZgrMFUojQK80xSQd/M9qK6hpDUe/kjbsk+tVAsiAT7SvXu1IVOD9vXxtLguPGZP7ZHdGhk4XZ/Jav2A7yr/b+58Z5bK3pfU2pFQPCgr3HYKbv8KPNBQJnpbwzXMJWYBt0JLOfjQD1wk1f16Zw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ARDrBYFd; 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="ARDrBYFd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 555C91F000E9; Fri, 7 Aug 2026 15:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786115390; bh=BhghLOnJ7ri3lwjr4yRUnE/5WqpKIu/UAithvK11kJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ARDrBYFd1ThZEOK1FjFaZsfPTx/K1ABXKHk7TOMizfIyTxouKoMqZOOqy9lsIk+qr dPG23RuK8jVYIsFfzAWah5YcrbsJ6jMdoVqQXp947bGuAc3HZadEQdY/euoLX44WdF GIp4O9otGRWbOUoMLy6QiZziqe8l85VMZKWNSQaM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hongyan Xu , Guenter Roeck Subject: [PATCH 6.18 260/396] hwmon: (npcm750-pwm-fan): stop fan timer on device detach Date: Fri, 7 Aug 2026 16:37:00 +0200 Message-ID: <20260807143429.860788678@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143424.272339768@linuxfoundation.org> References: <20260807143424.272339768@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev 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: Hongyan Xu commit f27f6976ea269219c1259a7c2f8c6dfe782540a3 upstream. When a fan tach channel is present, npcm7xx_pwm_fan_probe() starts fan_timer. The timer callback polls tach state and rearms the timer, but the driver has no remove callback or devm cleanup action to stop it. On device detach, the devm-managed driver data and I/O mappings can be released while the timer is still pending or running. Register a devm cleanup action before starting the timer and shut the timer down synchronously from that action. This issue was found by a static analysis tool. Fixes: f1fd4a4db777 ("hwmon: Add NPCM7xx PWM and Fan driver") Cc: stable@vger.kernel.org Signed-off-by: Hongyan Xu Link: https://lore.kernel.org/r/20260729100116.790-1-getshell@seu.edu.cn Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/npcm750-pwm-fan.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -364,6 +364,11 @@ static void npcm7xx_fan_polling(struct t add_timer(&data->fan_timer); } +static void npcm7xx_fan_cleanup(void *timer) +{ + timer_shutdown_sync(timer); +} + static inline void npcm7xx_fan_compute(struct npcm7xx_pwm_fan_data *data, u8 fan, u8 cmp, u8 fan_id, u8 flag_int, u8 flag_mode, u8 flag_clear) @@ -1027,6 +1032,12 @@ static int npcm7xx_pwm_fan_probe(struct msecs_to_jiffies(NPCM7XX_FAN_POLL_TIMER_200MS); timer_setup(&data->fan_timer, npcm7xx_fan_polling, 0); + ret = devm_add_action_or_reset(dev, + npcm7xx_fan_cleanup, + &data->fan_timer); + if (ret) + return ret; + add_timer(&data->fan_timer); break; }