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 4FE0E3815F8; Sat, 12 Sep 2026 19:53:59 +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=1789242840; cv=none; b=PWHlE7OZcKgIfIYTVzzqYVUF+N1gswMrQdR3mte3nBIePKuglthSbSC/zkEufIqslDtNRYNnLjWrScyEJLdEdRoNzb4NIyC7C93kT5ZVUVdhhRh0wMnojVYEkFI+ciZ6DUeovl86vx7wv2tN7+XCZ2F4HAWwA2dZTzw6/VEQKiY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242840; c=relaxed/simple; bh=RJ+hh2bRvclx5zfPUZ/itWwhxc/WT5vCfwj9pWXzgm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WyVlzO9bdRkW3DO4PCy3yviTAVrH0Rc4KSVgWoCg+7P/ebonr5l8wo3zypGYAZeVcLhTfx347W2BeM363Pj2US5aNS1M+sYyGbGm7wdvGnfoM28hs41J7cNT6a6Cj2V6TlrNdQMjr71VEU3GJV4U8RDlRRcWKV9t8+9xIPQl5R0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BIy3cUgt; 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="BIy3cUgt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98D121F000FF; Sat, 12 Sep 2026 19:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789242839; bh=TAhjwu6+pckV7+7mahPzTHQFcIFLrAPs35YELk5gqFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BIy3cUgtOKFVSLphwBul45KziUr/Q5/fBu65iL6kvu++bqSbp9x0JGNQbHoMBRzNX d5bmhSsD7YtNG0AJxD9ZU6ZzgbZERc4Md2JeQkfJlAjmcQ77LFVVTLLuzVgzrngqw/ 1jFP9uVhPG9HEeU4FmNL8Cx2qrIsj9tQRfLG5bq8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Baolin Wang , Hongyan Xu , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.10 545/798] power: supply: sc2731_charger: cancel work on remove Date: Sat, 12 Sep 2026 09:02:53 +0200 Message-ID: <20260912065529.618795564@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hongyan Xu [ Upstream commit dfc859bb8d332c525872f1a44028137724fa1998 ] The USB notifier and initial charger detection can schedule info->work. The remove path unregisters the notifier, but does not cancel queued or running work before the devm-allocated driver data is released. Set the platform drvdata used by remove, then cancel the work after unregistering the notifier. This issue was found by a static analysis tool. Fixes: 8ac1091ed18b ("power: supply: sc2731_charger: Add one work to charge/discharge") Reviewed-by: Baolin Wang Signed-off-by: Hongyan Xu Link: https://patch.msgid.link/5d48b827687168cb1b1bfe85f17945566b42829d.1785321763.git.getshell@seu.edu.cn Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/sc2731_charger.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c index 07aba733c447a..abb96fcd36163 100644 --- a/drivers/power/supply/sc2731_charger.c +++ b/drivers/power/supply/sc2731_charger.c @@ -466,6 +466,7 @@ static int sc2731_charger_probe(struct platform_device *pdev) mutex_init(&info->lock); info->dev = &pdev->dev; INIT_WORK(&info->work, sc2731_charger_work); + platform_set_drvdata(pdev, info); info->regmap = dev_get_regmap(pdev->dev.parent, NULL); if (!info->regmap) { @@ -516,6 +517,7 @@ static void sc2731_charger_remove(struct platform_device *pdev) struct sc2731_charger_info *info = platform_get_drvdata(pdev); usb_unregister_notifier(info->usb_phy, &info->usb_notify); + cancel_work_sync(&info->work); } static const struct of_device_id sc2731_charger_of_match[] = { -- 2.53.0