Thread (15 messages) 15 messages, 2 authors, 2025-09-14

Re: [PATCH 0/5] platform/chrome: Fix a race when probing drivers

From: Tzung-Bi Shih <tzungbi@kernel.org>
Date: 2025-09-14 03:47:21
Also in: chrome-platform

On Thu, Aug 28, 2025 at 08:35:56AM +0000, Tzung-Bi Shih wrote:
A race is observed when cros_ec_lpc and cros-ec-keyb are all built as
modules.  cros_ec_lpc is cros-ec-keyb's parent.  However, they can be
probed at the same time.

Example:

+ -----------------------------------------------------------------+
| Some init process (e.g. udevd) | deferred_probe_work_func worker |
+ -----------------------------------------------------------------+
| Probe cros-ec-keyb.            |                                 |
| - Decide to defer[1].          |                                 |
|                                | A device bound to a driver[2].  |
| Probe cros_ec_lpc.             |                                 |
| - Init the struct[3].          |                                 |
|                                | Retry cros-ec-keyb from the     |
|                                | deferred list[4].               |
|                                | - Won't defer again as [3].     |
|                                | - Access uninitialized data in  |
|                                |   the struct.                   |
| - Register the device.         |                                 |
+ -----------------------------------------------------------------+
[...]
Applied to

    https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next

[1/5] platform/chrome: Centralize cros_ec_device allocation
      commit: 918856986014142271a70a334d300994b9c41720
[2/5] platform/chrome: Centralize common cros_ec_device initialization
      commit: e19ceeb1c0f63e3e15b197c5f34797134b51ba0e
[3/5] platform/chrome: cros_ec: Separate initialization from cros_ec_register()
      commit: 7a79b0bfd8b3995a39d25bffcf57273635c0e542
[4/5] platform/chrome: cros_ec: Add a flag to track registration state
      commit: 56cb557279d70397cefb497e0f06bdd6fd685f8e
[5/5] Input: cros_ec_keyb - Defer probe until parent EC device is registered
      commit: 48633acccf38d706d7b368400647bb9db9caf1ae

Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help