Skip to content
Snippets Groups Projects
Commit 83dde25b authored by Brian Duddie's avatar Brian Duddie
Browse files

Fix double-close on direct channel registration

In the AIDL sensor HAL wrapper, file descriptors associated with a
direct channel were being wrapped in the AIDL NativeHandle type using
makeToAidl(), which ends up taking ownership of the fds, and
unintentionally closing them when the object goes out of scope (via
ndk::ScopedFileDescriptor), so the same fds would be closed at a later
point when the original native_handle_t is closed.

Switch to dupToAidl() which does not take ownership of the input file
handles.

Bug: 234456046
Test: apply fdsan protection (in different CL), confirm via
      test-sensorservice that the file descriptor is not closed twice
Change-Id: I51c0ba0f31b43c56bf055d186a599b289ca0065f
parent 2c23a2ee
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment