linux-yocto/drivers/w1
Chenyuan Yang 4f750b8462 w1: fix NULL pointer dereference in probe
[ Upstream commit 0dd6770a72 ]

The w1_uart_probe() function calls w1_uart_serdev_open() (which includes
devm_serdev_device_open()) before setting the client ops via
serdev_device_set_client_ops(). This ordering can trigger a NULL pointer
dereference in the serdev controller's receive_buf handler, as it assumes
serdev->ops is valid when SERPORT_ACTIVE is set.

This is similar to the issue fixed in commit 5e700b384e
("platform/chrome: cros_ec_uart: properly fix race condition") where
devm_serdev_device_open() was called before fully initializing the
device.

Fix the race by ensuring client ops are set before enabling the port via
w1_uart_serdev_open().

Fixes: a3c0880436 ("w1: add UART w1 bus driver")
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Acked-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
Link: https://lore.kernel.org/r/20250111181803.2283611-1-chenyuan0y@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:39:22 +02:00
..
masters w1: fix NULL pointer dereference in probe 2025-04-10 14:39:22 +02:00
slaves w1: ds2433: add support for ds28ec20 eeprom 2023-12-20 09:25:25 +01:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
w1_family.c
w1_int.c w1: Drop allocation error message 2024-05-28 17:45:02 +02:00
w1_internal.h
w1_io.c
w1_netlink.c connector/cn_proc: Add filtering to fix some bugs 2023-07-23 11:34:22 +01:00
w1_netlink.h w1: Replace zero-length array with flexible-array 2020-06-15 23:08:32 -05:00
w1.c w1: Add missing newline and fix typos in w1_bus_master comment 2024-05-27 13:51:29 +02:00