WSL2-Linux-Kernel/drivers/platform
Andy Shevchenko 7aefc43277 platform/x86: wmi: Break possible infinite loop when parsing GUID
[ Upstream commit 028e6e204a ]

The while-loop may break on one of the two conditions, either ID string
is empty or GUID matches. The second one, may never be reached if the
parsed string is not correct GUID. In such a case the loop will never
advance to check the next ID.

Break possible infinite loop by factoring out guid_parse_and_compare()
helper which may be moved to the generic header for everyone later on
and preventing from similar mistake in the future.

Interestingly that firstly it appeared when WMI was turned into a bus
driver, but later when duplicated GUIDs were checked, the while-loop
has been replaced by for-loop and hence no mistake made again.

Fixes: a48e23385f ("platform/x86: wmi: add context pointer field to struct wmi_device_id")
Fixes: 844af950da ("platform/x86: wmi: Turn WMI into a bus driver")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230621151155.78279-1-andriy.shevchenko@linux.intel.com
Tested-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-23 13:47:43 +02:00
..
chrome platform/chrome: cros_ec_chardev: fix kernel data leak from ioctl 2023-03-30 12:47:50 +02:00
goldfish platform/goldfish: Convert pipe tasklet to threaded irq 2021-01-27 14:57:06 +01:00
mellanox platform/mellanox: mlxbf-pmc: fix sscanf() error checking 2023-05-30 13:55:33 +01:00
mips MIPS: Loongson-3: fix compile mips cpu_hwmon as module build error. 2022-06-22 14:21:58 +02:00
olpc platform/olpc: Fix uninitialized data in debugfs write 2022-08-17 14:23:58 +02:00
surface platform/surface: aggregator: Allow completion work-items to be executed in parallel 2023-06-14 11:13:00 +02:00
x86 platform/x86: wmi: Break possible infinite loop when parsing GUID 2023-07-23 13:47:43 +02:00
Kconfig platform: Add Surface platform directory 2020-10-27 12:51:03 +01:00
Makefile platform: Add Surface platform directory 2020-10-27 12:51:03 +01:00