Re: [syzbot] Re: [syzbot] [acpi?] KASAN: slab-use-after-free Read in software_node_notify_remove

From: syzbot
Date: Wed Apr 09 2025 - 20:57:25 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: Re: [syzbot] [acpi?] KASAN: slab-use-after-free Read in software_node_notify_remove
Author: lizhi.xu@xxxxxxxxxxxxx

no register no remove

#syz test

diff --git a/drivers/base/core.c b/drivers/base/core.c
index d2f9d3a59d6b..a4b9fe99aa28 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2384,7 +2384,8 @@ static void device_platform_notify(struct device *dev)

static void device_platform_notify_remove(struct device *dev)
{
- software_node_notify_remove(dev);
+ if (device_is_registered(dev))
+ software_node_notify_remove(dev);

acpi_device_notify_remove(dev);
}