Repository navigation
Fix driver open modes and mount lifetime during hotplug work - #72
Merged
Merged
Conversation
This was referenced Oct 16, 2026
Merged
JohnAmadis
approved these changes
Oct 16, 2026
JohnAmadis
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Valid read/write VFS opens use DMFSI_O_RDWR=3, while strict drivers expect DMDRVI_O_RDWR=4. Translate access bits at the filesystem/driver boundary, preserve existing modifiers and reject missing access bits. Add per-handle mock-driver coverage for all access modes.
Repeated mount/unmount also exposed a use-after-free in asynchronous node reporting: the hotplug worker checked that a mount was live, released the mutex, then used driver metadata and module pointers after unmount could free them. Retain the mount throughout unlocked worker operations; unmount unregisters it first and waits on a semaphore for active work before freeing drivers. Generation-tagged mount notifications reject stale queued pointers when an allocator reuses a mount address. Driver callbacks and waits run outside the global registry mutex.
Validation: full native ctest 10/10; test_order, test_dmdevmon and the new deterministic lifetime regression each pass 20 consecutive executions. The regression pauses a class probe, starts unmount concurrently and verifies no driver free or completed unmount until the probe is released; queued work for an unrelated mount can be cancelled meanwhile. Running it against the exact pre-fix source fails (premature driver free/unmount, exit 1). STM32F7 build passed. The board booted with commit 4172cf2: RTC 12/12, dmdrvi 6/6, RNG 6/6, cat /dev/rtc and DHCP confirmed after Verified OK flashing. Details: docs/open-mode-validation.md.
Test consumers clear inherited MAL implementation settings. Dependency versions remain inferred by the packager. RTC consumer: choco-technologies/dmrtc#1.