diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-10-09 20:54:28 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-10-14 10:25:00 -0700 |
| commit | 7f0b4c25fdab38f1c2dd11f8ec17db3f48891192 (patch) | |
| tree | d533846349c655d5459aa8c03ffdb038822237af /rust/kernel/alloc/kvec/errors.rs | |
| parent | 2b4bcdd40ca00695ed21980f3bc7860823d1423e (diff) | |
Input: reject parent overrides on managed input devices
When an input device is allocated with devm_input_allocate_device(), the
owner struct device is set as dev->dev.parent and holds the
devm_input_device_release resource. Later, input_register_device()
attaches the devm_input_device_unregister resource to dev->dev.parent.
Clearing or overriding dev->dev.parent before registration splits devres
ownership across different devices, which breaks managed lifetime
assumptions.
Verify via devres_find() that dev->dev.parent is non-NULL and still
holds the matching devm_input_device_release entry before registering a
managed input device, rejecting registration with -EINVAL otherwise.
Also add KUnit test coverage in input_test.c verifying that reparented
and NULL-parent managed input devices are rejected while preserving the
owner parent succeeds.
Assisted-by: LLM
Link: https://patch.msgid.link/asmCc1VxVPLIMgY6@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions
