All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] power: supply: lp8788-charger: fix use-after-free on remove" failed to apply to 5.10-stable tree
@ 2026-09-03 14:38 gregkh
  2026-09-09 11:21 ` [PATCH 5.10.y 1/8] driver core: platform: reorder functions Sasha Levin
  0 siblings, 1 reply; 9+ messages in thread
From: gregkh @ 2026-09-03 14:38 UTC (permalink / raw)
  To: fanwu01, sebastian.reichel; +Cc: stable


The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 831c29a12d560f8a3225f43050b3fbb5dfd79c66
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026090353-unadorned-buffed-09ad@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 831c29a12d560f8a3225f43050b3fbb5dfd79c66 Mon Sep 17 00:00:00 2001
From: Fan Wu <fanwu01@zju.edu.cn>
Date: Sun, 2 Aug 2026 03:54:42 +0000
Subject: [PATCH] power: supply: lp8788-charger: fix use-after-free on remove

lp8788_charger_remove() flushes charger_work before unregistering the
IRQs. An IRQ thread can queue charger_work after flush_work() has
returned. The work can then run after devres frees pchg and dereference
it in lp8788_charger_event().

Unregister the IRQs first. free_irq() waits for any running threaded
handler, so no handler can queue more work afterwards. Then use
cancel_work_sync() to cancel pending work or wait for running work to
finish.

This issue was found by an in-house static analysis tool.

Fixes: 98a276649358 ("power_supply: Add new lp8788 charger driver")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
Link: https://patch.msgid.link/20260802035442.421697-1-fanwu01@zju.edu.cn
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c
index f0a680c155c4..1bc2c150fb91 100644
--- a/drivers/power/supply/lp8788-charger.c
+++ b/drivers/power/supply/lp8788-charger.c
@@ -710,8 +710,8 @@ static void lp8788_charger_remove(struct platform_device *pdev)
 {
 	struct lp8788_charger *pchg = platform_get_drvdata(pdev);
 
-	flush_work(&pchg->charger_work);
 	lp8788_irq_unregister(pdev, pchg);
+	cancel_work_sync(&pchg->charger_work);
 }
 
 static struct platform_driver lp8788_charger_driver = {


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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 14:38 FAILED: patch "[PATCH] power: supply: lp8788-charger: fix use-after-free on remove" failed to apply to 5.10-stable tree gregkh
2026-09-09 11:21 ` [PATCH 5.10.y 1/8] driver core: platform: reorder functions Sasha Levin
2026-09-09 11:21   ` [PATCH 5.10.y 2/8] driver core: platform: change logic implementing platform_driver_probe Sasha Levin
2026-09-09 11:21   ` [PATCH 5.10.y 3/8] driver core: platform: use bus_type functions Sasha Levin
2026-09-09 11:21   ` [PATCH 5.10.y 4/8] driver core: platform: Emit a warning if a remove callback returned non-zero Sasha Levin
2026-09-09 11:21   ` [PATCH 5.10.y 5/8] platform: Provide a remove callback that returns no value Sasha Levin
2026-09-09 11:21   ` [PATCH 5.10.y 6/8] power: supply: lp8788-charger: Convert to platform remove callback returning void Sasha Levin
2026-09-09 11:21   ` [PATCH 5.10.y 7/8] power: supply: lp8788: Use devm_power_supply_register() helper Sasha Levin
2026-09-09 11:21   ` [PATCH 5.10.y 8/8] power: supply: lp8788-charger: fix use-after-free on remove Sasha Levin

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.