Re: (subset) [PATCH] mfd: cros_ec: Delay dev_set_drvdata() until probe success
From: Lee Jones
Date: Thu May 14 2026 - 10:34:31 EST
On Mon, 27 Apr 2026 13:17:21 +0000, Andrei Kuchynski wrote:
> If ec_device_probe() fails, cros_ec_class_release releases memory for the
> cros_ec_dev structure. However, because the drvdata was already set,
> sub-drivers like cros_ec_typec can still retrieve the stale pointer via the
> platform device. This leads to a use-after-free when cros_ec_typec attempts
> to access &typec->ec->ec->dev on a device that has already been released.
> Move dev_set_drvdata() to ensure that the pointer is only made available
> once all initialization steps have succeeded.
>
> [...]
Applied, thanks!
[1/1] mfd: cros_ec: Delay dev_set_drvdata() until probe success
commit: 3c3a92cf6f3305505c6a98569f784ecdae8a909a
--
Lee Jones [李琼斯]