diff options
author | Danilo Krummrich <dakr@kernel.org> | 2025-08-29 22:58:57 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-09-06 19:52:21 +0200 |
commit | a86537ad21c7ba587241b0dcdd186f894a69fac7 (patch) | |
tree | cf162446ae05931220e050aa617366495af9ffe9 /rust/kernel/debugfs | |
parent | 2b2d4c744e1ab8b8d41c5c2ccf889f5441e50105 (diff) |
driver core: get_dev_from_fwnode(): document potential race
Commit 9a4681a485ee ("driver core: Export get_dev_from_fwnode()") made
get_dev_from_fwnode() publicly available, but didn't document the
guarantees a caller must uphold:
get_dev_from_fwnode() obtains a reference count from the device pointer
stored in a struct fwnode_handle. While having its own reference count,
struct fwnode_handle does not keep a reference count of the device it
has a pointer to.
Consequently, a caller must guarantee that it is impossible that the
last device reference is dropped and the device is released concurrently
while calling get_dev_from_fwnode(), otherwise this is a potential UAF
and hence a bug.
Thus, document this potential race condition for get_dev_from_fwnode().
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250829205911.33142-1-dakr@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/kernel/debugfs')
0 files changed, 0 insertions, 0 deletions