mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wmi/core Fix use-after-free in parse_wdg()
@ 2026-06-22  0:02 yahia
  2026-06-22 14:45 ` Armin Wolf
  0 siblings, 1 reply; 13+ messages in thread
From: yahia @ 2026-06-22  0:02 UTC (permalink / raw)
  To: W_Armin; +Cc: platform-driver-x86, linux-kernel, yahia ahmed

From: yahia ahmed <yahia.a.abdrabou@gmail.com>

Fix use-after-free in parse_wdg() function by
setting wblock to null to prevent referencing 
freed memory, if wblock is freed in the if 
(retval) path and address a minor typo.

Signed-off-by: yahia ahmed <yahia.a.abdrabou@gmail.com>
---
 drivers/platform/wmi/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/wmi/core.c b/drivers/platform/wmi/core.c
index 5a2ffcbab6af..9b5bd9ef5ba2 100644
--- a/drivers/platform/wmi/core.c
+++ b/drivers/platform/wmi/core.c
@@ -1328,6 +1328,7 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
 		retval = wmi_create_device(wmi_bus_dev, wblock, device);
 		if (retval) {
 			kfree(wblock);
+			wblock = NULL; /* Set wblock to NULL to prevent a use after free */
 			continue;
 		}
 
@@ -1418,7 +1419,7 @@ static int wmi_notify_device(struct device *dev, void *data)
 		return 0;
 
 	/* The ACPI WMI specification says that _WED should be
-	 * evaluated every time an notification is received, even
+	 * evaluated every time a notification is received, even
 	 * if no consumers are present.
 	 *
 	 * Some firmware implementations actually depend on this
-- 
2.54.0


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

end of thread, other threads:[~2026-07-03 12:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22  0:02 [PATCH] wmi/core Fix use-after-free in parse_wdg() yahia
2026-06-22 14:45 ` Armin Wolf
2026-06-22 19:04   ` [PATCH v2] wmi/core: fix use-after-free in wmi_add_device() yahia
2026-06-22 19:18     ` [PATCH v3] " yahia
2026-06-22 19:45       ` Armin Wolf
2026-06-22 20:25         ` Re " yahia
2026-06-22 20:45           ` Armin Wolf
2026-06-22 20:57             ` yahia
2026-06-22 21:19               ` Armin Wolf
2026-06-23  0:12                 ` yahia
2026-07-01  4:19                   ` Armin Wolf
2026-07-01  9:42                     ` yahia
2026-07-03 12:28       ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox